Skip to content

add URLSearchParams support#5040

Open
Monti-27 wants to merge 7 commits intoboa-dev:mainfrom
Monti-27:url-searchparams-clean
Open

add URLSearchParams support#5040
Monti-27 wants to merge 7 commits intoboa-dev:mainfrom
Monti-27:url-searchparams-clean

Conversation

@Monti-27
Copy link
Contributor

@Monti-27 Monti-27 commented Mar 13, 2026

Fixes #4743.

Adds URLSearchParams and wires up URL.searchParams.

This also fixes the constructor path for iterable inputs, handles explicit undefined correctly in the two-argument has() and delete() overloads, adds runtime coverage, and re-enables the skipped URL WPT case.

Tests:

  • cargo test -p boa_runtime --lib
  • cargo test --manifest-path tests/wpt/Cargo.toml url -- --nocapture
  • cargo clippy -p boa_runtime --all-features --all-targets -- -D warnings

@github-actions
Copy link

github-actions bot commented Mar 13, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,073 49,935 -138
Ignored 2,072 2,207 +135
Failed 818 821 +3
Panics 0 0 0
Conformance 94.54% 94.28% -0.26%
Broken tests (3):
test/intl402/DateTimeFormat/prototype/toStringTag/toStringTag.js (previously Passed)
test/intl402/DateTimeFormat/prototype/toStringTag/toString.js (previously Passed)
test/intl402/Number/prototype/toLocaleString/throws-same-exceptions-as-NumberFormat.js (previously Passed)

Tested main commit: 0698e7063866a1b40be043a1089be43d3224db4b
Tested PR commit: a594311f4748c1f5461953ea54b30877a73f8538
Compare commits: 0698e70...a594311

@Monti-27 Monti-27 closed this Mar 13, 2026
@Monti-27 Monti-27 deleted the url-searchparams-clean branch March 13, 2026 17:18
@Monti-27 Monti-27 reopened this Mar 13, 2026
@Monti-27 Monti-27 changed the title Implement URL.searchParams and URLSearchParams add URLSearchParams support Mar 13, 2026
@Monti-27
Copy link
Contributor Author

Monti-27 commented Mar 14, 2026

@jedel1043 can you please review this
thank you !!

@jedel1043 jedel1043 added A-Enhancement New feature or request Waiting On Author Waiting on PR changes from the author C-Runtime Issues and PRs related to Boa's runtime features labels Mar 16, 2026
@github-actions github-actions bot added Waiting On Review Waiting on reviews from the maintainers C-Tests Issues and PRs related to the tests. C-Builtins PRs and Issues related to builtins/intrinsics and removed Waiting On Review Waiting on reviews from the maintainers labels Mar 17, 2026
@Monti-27
Copy link
Contributor Author

@jedel1043 updated this. searchParams is now created during URL construction and the getter just returns the same object.

@Monti-27 Monti-27 requested a review from jedel1043 March 17, 2026 17:41
Comment on lines +82 to +96
#[derive(Debug, Clone)]
struct OptionalArg(Option<JsValue>);

impl<'a> TryFromJsArgument<'a> for OptionalArg {
fn try_from_js_argument(
_: &'a JsValue,
rest: &'a [JsValue],
_: &mut Context,
) -> JsResult<(Self, &'a [JsValue])> {
match rest.split_first() {
Some((first, rest)) => Ok((Self(Some(first.clone())), rest)),
None => Ok((Self(None), rest)),
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering about this implementation. Was Option<JsValue> not enough for this? It will additionally automatically map undefined to None, so if that's the correct behaviour it would be better to use Option

@Monti-27
Copy link
Contributor Author

give me 5 mins I'll clutch this :))

@Monti-27 Monti-27 requested a review from jedel1043 March 17, 2026 19:03
@Monti-27
Copy link
Contributor Author

also fixed the clippy failure from the missing errors docs on the Rust side URL constructors

done: bool,
}

impl UrlSearchParamsIterator {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be a class IMO

@jedel1043 jedel1043 added Waiting On Review Waiting on reviews from the maintainers and removed Waiting On Author Waiting on PR changes from the author labels Mar 18, 2026
@Monti-27 Monti-27 requested a review from jedel1043 March 18, 2026 14:49
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 81.66189% with 64 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.37%. Comparing base (6ddc2b4) to head (a594311).
⚠️ Report is 884 commits behind head on main.

Files with missing lines Patch % Lines
core/runtime/src/url.rs 81.66% 64 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5040       +/-   ##
===========================================
+ Coverage   47.24%   59.37%   +12.12%     
===========================================
  Files         476      563       +87     
  Lines       46892    63095    +16203     
===========================================
+ Hits        22154    37462    +15308     
- Misses      24738    25633      +895     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@jedel1043 jedel1043 added Waiting On Author Waiting on PR changes from the author and removed Waiting On Review Waiting on reviews from the maintainers labels Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Enhancement New feature or request C-Builtins PRs and Issues related to builtins/intrinsics C-Runtime Issues and PRs related to Boa's runtime features C-Tests Issues and PRs related to the tests. Waiting On Author Waiting on PR changes from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement URLSearchParams class

2 participants