Bug 1377772 - URL.searchParams should exist also when nsSimpleURI is used, r=smaug

This commit is contained in:
Andrea Marchesini 2017-07-05 11:31:28 +02:00
parent b25c28477d
commit e6f301da4a
2 changed files with 9 additions and 6 deletions

View File

@ -325,12 +325,9 @@ URLMainThread::UpdateURLSearchParams()
}
nsAutoCString search;
nsCOMPtr<nsIURL> 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);

View File

@ -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: {} },