Skip to content

fix(runtime): register the URL hash accessor once - #2180

Merged
edusperoni merged 1 commit into
mainfrom
fix/url-hash-accessor
Dec 5, 2026
Merged

edusperoni merged 1 commit into
mainfrom
fix/url-hash-accessor

Conversation

@edusperoni

@edusperoni edusperoni commented Dec 5, 2026 •

Copy link
Copy Markdown
Collaborator

Description

URLImpl::GetCtor registered the hash native data property twice on the URL instance template (once before and once after host). The second registration was a plain duplicate of the first (same GetHash/SetHash), so it is removed.

I checked whether the duplicate was meant to be a different accessor. The remaining set (hash, host, hostname, href, origin (read-only), password, pathname, port, protocol, search, username, plus toString, toJSON and URL.canParse) matches the iOS runtime's URL binding one-for-one. searchParams, the one WHATWG member not in the native template, is defined on URL.prototype by the blob-url.js builtin on both runtimes. So no accessor is missing.

Does your commit message include the wording below to reference a specific issue in this repo?

No, there is no issue for this.

Related Pull Requests

None.

Does your pull request have unit tests?

Yes. testURLImpl.js gets a spec that reads hash, sets it, clears it, and checks that href follows each change. The full test-app suite passes on an arm64-v8a emulator (API 35): 2211/2211.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected URL hash handling so fragments can be set without a leading # or cleared, with the resulting URL reflecting the change.
  • Tests
    • Added coverage for reading and updating URL fragments.

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The URL constructor no longer registers the hash property twice. A test checks reading a URL hash, setting a new hash, and clearing the hash.

Changes: URL hash behavior

Layer / File(s) Summary
Hash registration and behavior test
test-app/runtime/src/main/cpp/URLImpl.cpp, test-app/app/src/main/assets/app/tests/testURLImpl.js
The duplicate hash property registration was removed. The test checks the parsed hash, setting it to "other" and updating href, then clearing it and removing the fragment from href.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: nathanwalker

Merge Risk: Minimal · up to 43dbb

This change removes a redundant URL hash registration and adds a test for the hash behavior. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title says the fix registers the URL hash accessor once, which matches the change: the duplicate hash property registration was removed from URLImpl::GetCtor, and a test covering hash read, set, a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title says the fix registers the URL hash accessor once, which matches the change: the duplicate hash property registration was removed from URLImpl::GetCtor, and a test covering hash read, set, and clear was added. The title names the main change from the developer's view and is specific enough for history scanning.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ff42476 and 43dbbe9.

Files selected for processing: 2

  • test-app/app/src/main/assets/app/tests/testURLImpl.js
  • test-app/runtime/src/main/cpp/URLImpl.cpp
Files with no reviewable changes: 1

  • test-app/runtime/src/main/cpp/URLImpl.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@edusperoni
edusperoni merged commit c956284 into main Dec 5, 2026
8 checks passed
@edusperoni
edusperoni deleted the fix/url-hash-accessor branch December 5, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant