Skip to content

fix(runtime): preserve URL state in subclasses - #11090

Closed
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/10639-url-subclass-state
Closed

proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/10639-url-subclass-state

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • construct implicit and explicit URL subclasses through the branded builtin constructor path
  • preserve the subclass prototype while retaining URL parsing state
  • teach static instanceof URL lowering about branded and recorded-prototype URL instances
  • add parity coverage for relative URLs, subclass fields, and both constructor forms

Fixes #10639

Root cause

URL was absent from the exotic builtin constructor lists used by implicit derived constructors and explicit super(...) calls. The explicit path also classified URL as a runtime-valued parent, so it could be invoked through the plain call path instead of the builtin construct path. Instances kept their subclass shape but never received URL state.

Validation

  • focused parity fixture test_gap_10639_url_subclass: 1/1 passed, 100% parity
  • cargo build --profile perry-dev -p perry -p perry-runtime-static -p perry-stdlib-static
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: cd2c44ac-0155-43d1-bbb3-e0dadd535bb7

📥 Commits

Reviewing files that changed from the base of the PR and between e27f0a0 and b921d04.

📒 Files selected for processing (8)
  • changelog.d/11090-url-subclass-state.md
  • crates/perry-codegen/src/expr/instance_misc1.rs
  • crates/perry-codegen/src/expr/this_super_call.rs
  • crates/perry-codegen/src/lower_call/new.rs
  • crates/perry-runtime/src/object/class_registry/construct.rs
  • crates/perry-runtime/src/object/instanceof.rs
  • crates/perry-runtime/src/object/instanceof/static_dispatch.rs
  • test-files/test_gap_10639_url_subclass.ts

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

Comment @coderabbitai help to get the list of available commands.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main in merge train 265 (#11108), released as v0.5.1648 at 9d26936298.

Cherry-picked from this PR's head b921d04de7 and validated as one tree with 15 other PRs — CI 22/22 green, all 6 gap-suite shards. A train rebase gives the commits new SHAs, so GitHub cannot auto-close the source PR; closing by hand.

Nothing needed from you. Thanks.

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.

class X extends URL {} produces an instance with no URL state (hostname/pathname undefined), silently — explicit super(href) fails identically

1 participant