Skip to content

closes #650: URL pathname/search/hash setters (v0.5.794) - #663

Merged
proggeramlug merged 1 commit into
mainfrom
loop/650-url-setters
May 10, 2026
Merged

closes #650: URL pathname/search/hash setters (v0.5.794)#663
proggeramlug merged 1 commit into
mainfrom
loop/650-url-setters

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Summary

Closes #650 — last remaining sub-issue: URL pathname / search / hash setters.

Pre-fix u.pathname = "/x" etc. fell through to generic PropertySet — the named field updated but href stayed stale (the issue's exact symptom: u2.href reads the original after u2.pathname = "/changed").

Fix:

  • HIR variants Expr::UrlSetPathname / _Search / _Hash ({ url, value } shape)
  • HIR detection in expr_assign.rs: URL-typed receiver + pathname/search/hash prop assignments → URL setter variants
  • Codegen unboxes URL pointer + extracts StringHeader value, calls one of three runtime helpers
  • Runtime: helpers update field + normalize leading sigil + clear on empty + call new internal rebuild_url_href() that reads all components and recomposes href matching create_url_object's logic
  • Search setter additionally re-parses the new query into the stored URLSearchParams object

#650 was tracked across 7 sub-issues; all now resolved across v0.5.770 / v0.5.789 / v0.5.791 / v0.5.792 / v0.5.793 / v0.5.794.

Out of scope

The pre-existing chained-access limitation url.searchParams.get(key) (where the receiver is a PropertyGet, not a typed local) — the URLSearchParams-method dispatch only fires on typed locals. Left as a separate followup; not part of #650's setter symptoms.

Test plan

  • Extended test_issue_650_url_static.ts covers each setter + normalization + empty-clear — byte-identical to Node
  • 10 sanity tests pass byte-identical to Node

The last remaining #650 sub-issue. Pre-fix u.pathname = "/x" etc.
fell through to generic PropertySet — the named field updated but
href stayed stale (the issue's exact symptom).

Fix:
- HIR variants UrlSetPathname / UrlSetSearch / UrlSetHash
- HIR detection in expr_assign.rs: route URL-typed receiver +
  pathname/search/hash prop assignments to the new variants
- Codegen unboxes URL pointer + StringHeader value, calls runtime
- Runtime helpers update field + normalize leading sigil + clear
  on empty + call new rebuild_url_href() that reads all components
  and recomposes href matching create_url_object
- Search setter additionally re-parses query into the stored
  URLSearchParams object

Closes #650 (all 7 sub-issues now resolved across 0.5.770 / 0.5.789 /
0.5.791 / 0.5.792 / 0.5.793 / 0.5.794).

Sanity: 10 representative tests byte-identical to Node.
@proggeramlug
proggeramlug merged commit 0033833 into main May 10, 2026
2 of 10 checks passed
@TheHypnoo
TheHypnoo deleted the loop/650-url-setters branch May 16, 2026 12:20
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.

WHATWG URL class instance properties + setters broken

1 participant