You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(runtime): register the URL hash accessor once - #2180
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?
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.
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.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
URLImpl::GetCtorregistered thehashnative data property twice on the URL instance template (once before and once afterhost). The second registration was a plain duplicate of the first (sameGetHash/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, plustoString,toJSONandURL.canParse) matches the iOS runtime's URL binding one-for-one.searchParams, the one WHATWG member not in the native template, is defined onURL.prototypeby theblob-url.jsbuiltin 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.jsgets a spec that readshash, sets it, clears it, and checks thathreffollows each change. The full test-app suite passes on an arm64-v8a emulator (API 35): 2211/2211.Summary by CodeRabbit
#or cleared, with the resulting URL reflecting the change.