From e6f301da4af6e646e9e96e18440aef67dd206c96 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 5 Jul 2017 11:31:28 +0200 Subject: [PATCH] Bug 1377772 - URL.searchParams should exist also when nsSimpleURI is used, r=smaug --- dom/url/URLMainThread.cpp | 9 +++------ dom/url/tests/urlSearchParams_commons.js | 6 ++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dom/url/URLMainThread.cpp b/dom/url/URLMainThread.cpp index 7d33c2bb30c9..f15052696f47 100644 --- a/dom/url/URLMainThread.cpp +++ b/dom/url/URLMainThread.cpp @@ -325,12 +325,9 @@ URLMainThread::UpdateURLSearchParams() } nsAutoCString search; - nsCOMPtr url(do_QueryInterface(mURI)); - if (url) { - nsresult rv = url->GetQuery(search); - if (NS_WARN_IF(NS_FAILED(rv))) { - search.Truncate(); - } + nsresult rv = mURI->GetQuery(search); + if (NS_WARN_IF(NS_FAILED(rv))) { + search.Truncate(); } mSearchParams->ParseInput(search); diff --git a/dom/url/tests/urlSearchParams_commons.js b/dom/url/tests/urlSearchParams_commons.js index 0b8fe39a3406..01cb871eb94b 100644 --- a/dom/url/tests/urlSearchParams_commons.js +++ b/dom/url/tests/urlSearchParams_commons.js @@ -47,8 +47,14 @@ function testURL() { url.searchParams.set('e', 'f'); ok(url.href.indexOf('e=f') != 1, 'URL right'); + + url = new URL('mailto:a@b.com?subject=Hi'); + ok(url.searchParams, "URL searchParams exists!"); + ok(url.searchParams.has('subject'), "Hi"); + runTest(); } + function testParserURLSearchParams() { var checks = [ { input: '', data: {} },