Skip to content

url: align default argument handling for URLPattern with webidl#62719

Open
panva wants to merge 1 commit intonodejs:mainfrom
panva:webidl-urlpattern
Open

url: align default argument handling for URLPattern with webidl#62719
panva wants to merge 1 commit intonodejs:mainfrom
panva:webidl-urlpattern

Conversation

@panva
Copy link
Copy Markdown
Member

@panva panva commented Apr 13, 2026

Aligns URLPattern's argument handling with WebIDL semantics (to some extent at least), matching browser behavior (verified against Chrome):

Constructor:

  • undefined/null for URLPatternInput (arg0) uses default empty init per WebIDL union-with-dictionary rules.
  • 2-arg calls: overload resolution picks overload 2 (input, options) when arg1 is not a string, so null/undefined resolve to default options rather than being treated as baseURL.
  • 3-arg calls: null/undefined for baseURL (USVString) are stringified to "null"/"undefined" per WebIDL, which ada rejects as invalid URLs.
  • null/undefined for options dictionary uses defaults.

test() / exec():

  • null/undefined for input uses default empty init.
  • null for baseURL is stringified to "null" per WebIDL USVString conversion, letting the underlying library handle the error semantics (dict input + baseURL throws; string input + invalid baseURL returns no match).

ignoreCase:

  • Changed from strict IsBoolean() type check to BooleanValue() coercion per WebIDL dictionary boolean member rules.

Tests:

  • Updated WPT fixtures to f07c03cbed.
  • Added tests for all undefined/null/coercion cases in test/parallel/test-urlpattern-types.js.

@panva panva requested a review from anonrig April 13, 2026 08:11
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

nodejs-github-bot commented Apr 13, 2026

Review requested:

  • @nodejs/web-standards
  • @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 Apr 13, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
@panva panva force-pushed the webidl-urlpattern branch from beeaf1e to 5e0f948 Compare April 13, 2026 08:14
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 93.02326% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.79%. Comparing base (dfe438d) to head (5e0f948).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/node_url_pattern.cc 93.02% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62719      +/-   ##
==========================================
- Coverage   89.81%   89.79%   -0.02%     
==========================================
  Files         699      699              
  Lines      216379   216395      +16     
  Branches    41366    41376      +10     
==========================================
- Hits       194340   194321      -19     
- Misses      14139    14150      +11     
- Partials     7900     7924      +24     
Files with missing lines Coverage Δ
src/node_url_pattern.cc 83.72% <93.02%> (-1.07%) ⬇️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@panva panva added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 13, 2026
@panva panva added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 13, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 13, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

3 participants