LibWeb: Don't strip leading '?' in query initializing a URL

In our implementation of url-initialize, we were invoking the
constructor of URLSearchParams:

https://url.spec.whatwg.org/#dom-urlsearchparams-urlsearchparams

Instead of the 'initialize' AO:

https://url.spec.whatwg.org/#urlsearchparams-initialize

This has the small difference of stripping any leading '?' from the
query (which we are not meant to be doing!).
This commit is contained in:
Shannon Booth 2024-08-06 23:27:11 +12:00 committed by Tim Ledbetter
parent d7b19b3278
commit fd4e943e12
Notes: github-actions[bot] 2024-08-06 22:09:12 +00:00
5 changed files with 34 additions and 2 deletions

View file

@ -59,7 +59,7 @@ JS::NonnullGCPtr<DOMURL> DOMURL::initialize_a_url(JS::Realm& realm, URL::URL con
// 2. Set urls URL to urlRecord.
// 3. Set urls query object to a new URLSearchParams object.
auto query_object = MUST(URLSearchParams::construct_impl(realm, query));
auto query_object = MUST(URLSearchParams::create(realm, query));
// 4. Initialize urls query object with query.
auto result_url = DOMURL::create(realm, url_record, move(query_object));