Skip to content

url: align URLPatternInit dictionary conversion with WebIDL - #65498

Open
piyushrajyadav wants to merge 1 commit into
nodejs:mainfrom
piyushrajyadav:fix-urlpattern-webidl-order
Open

url: align URLPatternInit dictionary conversion with WebIDL#65498
piyushrajyadav wants to merge 1 commit into
nodejs:mainfrom
piyushrajyadav:fix-urlpattern-webidl-order

Conversation

@piyushrajyadav

Copy link
Copy Markdown

Fixes: #64780

Description

This pull request aligns URLPatternInit dictionary conversion with the WHATWG / WebIDL specifications:

  1. Member access order: Read URLPatternInit dictionary members in lexicographical order (baseURL, hash, hostname, password, pathname, port, protocol, search, username), ensuring getters and proxy traps observe the access sequence required by WebIDL.
  2. Absent members: Use sparse DictionaryTemplate values (tmpl->NewInstance(context, values)) so that absent dictionary members in URLPatternResult.inputs are omitted rather than exposed as own enumerable properties with undefined values.

Verification

  • Added regression tests in test/parallel/test-urlpattern.js verifying lexicographical access order on Proxy getters and omission of absent members in exec().inputs.
  • Verified formatting and linting via python tools/cpplint.py src/node_url_pattern.cc.

Read URLPatternInit dictionary members in lexicographical order so
getters and proxy traps observe the access sequence required by WebIDL.
Use sparse dictionary template values so URLPatternResult inputs only
expose members present after WebIDL conversion.

Fixes: nodejs#64780
Signed-off-by: piyushrajyadav <piyushyadavrajyadav@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/url

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

url: URLPatternInit dictionary conversion does not follow WebIDL semantics

2 participants