Bug 652186 - Fix tests involving URL backslash replacement r=bz
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 03 Mar 2016 15:50:22 +0100
changeset 323061 49b3509fa00aaa6652f3bf8d5ae6fd242de6e6c6
parent 323060 ac54c03b1f99cb72781b184a6cf287cd8d0e7af7
child 323062 170a1aa5791b47cffadd0393cb307497b73ce3b0
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs652186
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 652186 - Fix tests involving URL backslash replacement r=bz MozReview-Commit-ID: JgWFkJN7Mtc
docshell/test/unit/test_nsDefaultURIFixup_info.js
dom/base/test/test_url.html
--- a/docshell/test/unit/test_nsDefaultURIFixup_info.js
+++ b/docshell/test/unit/test_nsDefaultURIFixup_info.js
@@ -466,56 +466,48 @@ var testcases = [ {
     fixedURI: "http://mozilla5/2",
     alternateURI: "http://www.mozilla5.com/2",
     protocolChange: true,
   }, {
     input: "mozilla/foo",
     fixedURI: "http://mozilla/foo",
     alternateURI: "http://www.mozilla.com/foo",
     protocolChange: true,
+  }, {
+    input: "mozilla\\",
+    fixedURI: "http://mozilla/",
+    alternateURI: "http://www.mozilla.com/",
+    keywordLookup: true,
+    protocolChange: true,
+    affectedByDNSForSingleHosts: true,
   }];
 
 if (Services.appinfo.OS.toLowerCase().startsWith("win")) {
   testcases.push({
     input: "C:\\some\\file.txt",
     fixedURI: "file:///C:/some/file.txt",
     protocolChange: true,
   });
   testcases.push({
     input: "//mozilla",
     fixedURI: "http://mozilla/",
     alternateURI: "http://www.mozilla.com/",
     protocolChange: true,
   });
-  testcases.push({
-    input: "mozilla\\",
-    fixedURI: "http://mozilla/",
-    alternateURI: "http://www.mozilla.com/",
-    protocolChange: true,
-  });
 } else {
   testcases.push({
     input: "/some/file.txt",
     fixedURI: "file:///some/file.txt",
     protocolChange: true,
   });
   testcases.push({
     input: "//mozilla",
     fixedURI: "file:////mozilla",
     protocolChange: true,
   });
-  // \ is an invalid character in the hostname until bug 652186 is implemented
-  testcases.push({
-    input: "mozilla\\",
-    // fixedURI: "http://mozilla\\/",
-    // alternateURI: "http://www.mozilla/",
-    keywordLookup: true,
-    protocolChange: true,
-    // affectedByDNSForSingleHosts: true,
-  });
 }
 
 function sanitize(input) {
   return input.replace(/\r|\n/g, "").trim();
 }
 
 
 var gSingleWordHostLookup = false;
--- a/dom/base/test/test_url.html
+++ b/dom/base/test/test_url.html
@@ -356,10 +356,36 @@
     URL.revokeObjectURL(url);
     ok(true, "Calling revokeObjectURL twice should be ok");
   </script>
 
   <script>
     URL.revokeObjectURL('blob:something');
     ok(true, "This should not throw.");
   </script>
+
+  <script>
+    var base = new URL("http:\\\\test.com\\path/to\\file?query\\backslash#hash\\");
+    is(base.href, "http://test.com/path/to/file?query\\backslash#hash\\");
+
+    var url = new URL("..\\", base);
+    is(url.href, "http://test.com/path/");
+
+    url = new URL("\\test", base);
+    is(url.href, "http://test.com/test");
+
+    url = new URL("\\test\\", base);
+    is(url.href, "http://test.com/test/");
+
+    url = new URL("http://example.org/test", base);
+    is(url.href, "http://example.org/test");
+
+    url = new URL("ftp://tmp/test", base);
+    is(url.href, "ftp://tmp/test");
+
+    url = new URL("ftp:\\\\tmp\\test", base);
+    is(url.href, "ftp://tmp/test");
+
+    url = new URL("scheme://tmp\\test", base);
+    is(url.href, "scheme://tmp\\test");
+  </script>
 </body>
 </html>