Bug 1646928 - Bogus scheme typo correction in URIFixup. r=harry, a=RyanVM
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 29 Jun 2020 14:06:06 +0000
changeset 601863 718e80f1f6da48355a1cdd0f7d0c58689f2df3cf
parent 601862 a5d039fe17211440c5be47141ee7adaeda7e33ef
child 601864 fc865ff882f1868aa9126e09b885e7f8a3e98f98
push id13329
push userryanvm@gmail.com
push dateTue, 30 Jun 2020 19:16:32 +0000
treeherdermozilla-beta@1eea2bfc562f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersharry, RyanVM
bugs1646928
milestone79.0
Bug 1646928 - Bogus scheme typo correction in URIFixup. r=harry, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D81329
docshell/base/URIFixup.jsm
docshell/test/unit/test_URIFixup_info.js
--- a/docshell/base/URIFixup.jsm
+++ b/docshell/base/URIFixup.jsm
@@ -321,17 +321,17 @@ URIFixup.prototype = {
         ["htp", "http"],
         ["ttps", "https"],
         ["tps", "https"],
         ["ps", "https"],
         ["htps", "https"],
         ["ile", "file"],
         ["le", "file"],
       ].some(([typo, fixed]) => {
-        if (uriString.startsWith(typo)) {
+        if (uriString.startsWith(typo + ":")) {
           scheme = fixed;
           uriString = scheme + uriString.substring(typo.length);
           isCommonProtocol = true;
           return true;
         }
         return false;
       });
     }
--- a/docshell/test/unit/test_URIFixup_info.js
+++ b/docshell/test/unit/test_URIFixup_info.js
@@ -645,16 +645,21 @@ var testcases = [
     fixedURI: "http://mozilla/%20test%20/",
     alternateURI: "http://www.mozilla.com/%20test%20/",
     protocolChange: true,
   },
   {
     input: "mozilla /test/",
     keywordLookup: true,
   },
+  {
+    input: "pserver:8080",
+    fixedURI: "http://pserver:8080/",
+    protocolChange: true,
+  },
 ];
 
 if (AppConstants.platform == "win") {
   testcases.push({
     input: "C:\\some\\file.txt",
     fixedURI: "file:///C:/some/file.txt",
     protocolChange: true,
   });