[mq]: url_searchParams.patch
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 04 Jul 2017 06:15:02 +0200
changeset 1175905 fdfbd0b96c61f39b432c6372c5ffdcfd4689f85a
parent 1175452 7c9d378376c9d7afa8e5dc95a308ea1c1a1b0e29
child 1175906 17eab2fbcd7e3b7bb2fe8cfa2ef7bed9259bd8fe
push id202536
push useramarchesini@mozilla.com
push dateTue, 04 Jul 2017 17:11:40 +0000
treeherdertry@17eab2fbcd7e [default view] [failures only]
milestone56.0a1
[mq]: url_searchParams.patch
dom/url/URLMainThread.cpp
dom/url/tests/urlSearchParams_commons.js
--- a/dom/url/URLMainThread.cpp
+++ b/dom/url/URLMainThread.cpp
@@ -320,22 +320,19 @@ URLMainThread::SetHost(const nsAString& 
 void
 URLMainThread::UpdateURLSearchParams()
 {
   if (!mSearchParams) {
     return;
   }
 
   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);
 }
 
 void
 URLMainThread::GetHostname(nsAString& aHostname, ErrorResult& aRv) const
 {
--- a/dom/url/tests/urlSearchParams_commons.js
+++ b/dom/url/tests/urlSearchParams_commons.js
@@ -42,18 +42,24 @@ function testURL() {
   ok(url.searchParams.has('a'), "URL.searchParams.has('a')");
   is(url.searchParams.get('a'), 'b', "URL.searchParams.get('a')");
   ok(url.searchParams.has('c'), "URL.searchParams.has('c')");
   is(url.searchParams.get('c'), 'd', "URL.searchParams.get('c')");
 
   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: {} },
     { input: 'a', data: { 'a' : [''] } },
     { input: 'a=b', data: { 'a' : ['b'] } },
     { input: 'a=', data: { 'a' : [''] } },
     { input: '=b', data: { '' : ['b'] } },
     { input: '&', data: {} },