Closed Bug 1377772 Opened 8 years ago Closed 8 years ago

searchParams on new URL() is empty

Categories

(Core :: DOM: Core & HTML, defect)

54 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: rtm, Assigned: baku)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0 Build ID: 20170628075643 Steps to reproduce: const url = new URL('http://foo.bar?q=1'); console.log(url.searchParams.get('q')); Actual results: Reports null. `searchParams` is apparently empty. Expected results: `searchParams` should contain an entry for `q`, and `searchParams.get('q')` should return 1.
I cannot reproduce the issue.
Component: Untriaged → DOM
Product: Firefox → Core
Sorry, please try with 'mailto:rtm@gol.com?subject=Hi`. `new URL('mailto:rtm@gol.com?subject=Hi').searchParams.get('subject')` returns `null`. One would expect it to return `"Hi"`. I am not able to parse the spec to determine whether this is supposed to work, but it does work in Chrome.
Flags: needinfo?(amarchesini)
Initially GetQuery() was not part of nsIURI but only nsIURL.
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Attachment #8883163 - Flags: review?(bugs)
Comment on attachment 8883163 [details] [diff] [review] url_searchParams.patch Huh, there aren't any wpt tests for this?
Attachment #8883163 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/44e7349a4cbb URL.searchParams should exist also when nsSimpleURI is used, r=smaug
WPT added in the patch before landing it.
Backed out for failing wpt /url/a-element-xhtml.xhtml: https://hg.mozilla.org/integration/mozilla-inbound/rev/3ff3bdce13ad38f4eb371bd00364be36648a106c Push with failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=44e7349a4cbbe98ab39e1d97aa5ff7bc608d6ea6&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-resultStatus=retry&filter-resultStatus=usercancel&filter-resultStatus=runnable Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=111892459&repo=mozilla-inbound [task 2017-07-05T09:05:15.867591Z] 09:05:15 INFO - TEST-FAIL | /url/a-element-xhtml.xhtml | Parsing: <blob:d3958f5c-0777-0845-9dcf-2cb28783acaf> against <about:blank> - assert_equals: pathname expected "d3958f5c-0777-0845-9dcf-2cb28783acaf" but got "" [task 2017-07-05T09:05:15.867964Z] 09:05:15 INFO - runURLTests/<@http://web-platform.test:8000/url/a-element.js:47:7 [task 2017-07-05T09:05:15.868314Z] 09:05:15 INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1405:20 [task 2017-07-05T09:05:15.868677Z] 09:05:15 INFO - test@http://web-platform.test:8000/resources/testharness.js:497:9 [task 2017-07-05T09:05:15.869025Z] 09:05:15 INFO - runURLTests@http://web-platform.test:8000/url/a-element.js:30:5 [task 2017-07-05T09:05:15.869386Z] 09:05:15 INFO - request.onload<@http://web-platform.test:8000/url/a-element.js:8:5 [task 2017-07-05T09:05:15.869753Z] 09:05:15 INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1405:20 [task 2017-07-05T09:05:15.870117Z] 09:05:15 INFO - Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1429:20 [task 2017-07-05T09:05:15.870486Z] 09:05:15 INFO - EventHandlerNonNull*@http://web-platform.test:8000/url/a-element.js:7:20 [task 2017-07-05T09:05:15.870860Z] 09:05:15 INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1405:20 [task 2017-07-05T09:05:15.871215Z] 09:05:15 INFO - @http://web-platform.test:8000/url/a-element.js:2:1 [task 2017-07-05T09:05:15.871602Z] 09:05:15 INFO - TEST-UNEXPECTED-FAIL | /url/a-element-xhtml.xhtml | Parsing: <mailto:a@b.com?subject=Hi> against <about:blank> - assert_equals: pathname expected "a@b.com" but got "" [task 2017-07-05T09:05:15.871958Z] 09:05:15 INFO - runURLTests/<@http://web-platform.test:8000/url/a-element.js:47:7 [task 2017-07-05T09:05:15.872324Z] 09:05:15 INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1405:20 [task 2017-07-05T09:05:15.872683Z] 09:05:15 INFO - test@http://web-platform.test:8000/resources/testharness.js:497:9 [task 2017-07-05T09:05:15.873033Z] 09:05:15 INFO - runURLTests@http://web-platform.test:8000/url/a-element.js:30:5 [task 2017-07-05T09:05:15.873401Z] 09:05:15 INFO - request.onload<@http://web-platform.test:8000/url/a-element.js:8:5 [task 2017-07-05T09:05:15.873897Z] 09:05:15 INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1405:20 [task 2017-07-05T09:05:15.874260Z] 09:05:15 INFO - Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1429:20 [task 2017-07-05T09:05:15.874628Z] 09:05:15 INFO - EventHandlerNonNull*@http://web-platform.test:8000/url/a-element.js:7:20 [task 2017-07-05T09:05:15.875051Z] 09:05:15 INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1405:20 [task 2017-07-05T09:05:15.875413Z] 09:05:15 INFO - @http://web-platform.test:8000/url/a-element.js:2:1
Flags: needinfo?(amarchesini)
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/c93deefbf398 URL.searchParams should exist also when nsSimpleURI is used, r=smaug
Flags: needinfo?(amarchesini)
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: