Bug 1199601 - r=mak
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 14 Oct 2015 15:59:37 +0100
changeset 331115 a60bad5487ccea8b8102680cb92f105f9e6b16cd
parent 331114 51577bed9ade8703bd80b7a0efa90d3c24d5bd52
child 331116 d16bb239c89373b0cc1c4ecf40e6ffc88971867c
push id10898
push userbgrinstead@mozilla.com
push dateMon, 15 Feb 2016 21:54:37 +0000
reviewersmak
bugs1199601
milestone47.0a1
Bug 1199601 - r=mak MozReview-Commit-ID: DR7HEJa6SMH
browser/base/content/test/general/browser_urlHighlight.js
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/test/general/browser_urlHighlight.js
+++ b/browser/base/content/test/general/browser_urlHighlight.js
@@ -61,16 +61,29 @@ function test() {
   testVal("<user:pass@>mozilla.org");
 
   testVal("<https://>mozilla.org</file.ext>");
   testVal("<https://>mozilla.org</sub/file.ext>");
   testVal("<https://>mozilla.org</sub/file.ext?foo>");
   testVal("<https://>mozilla.org</sub/file.ext?foo&bar>");
   testVal("<https://>mozilla.org</sub/file.ext?foo&bar#top>");
   testVal("<https://>mozilla.org</sub/file.ext?foo&bar#top>");
+  testVal("foo.bar<?q=test>");
+  testVal("foo.bar<#mozilla.org>");
+  testVal("foo.bar<?somewhere.mozilla.org>");
+  testVal("foo.bar<?@mozilla.org>");
+  testVal("foo.bar<#x@mozilla.org>");
+  testVal("foo.bar<#@x@mozilla.org>");
+  testVal("foo.bar<?x@mozilla.org>");
+  testVal("foo.bar<?@x@mozilla.org>");
+  testVal("<foo.bar@x@>mozilla.org");
+  testVal("<foo.bar@:baz@>mozilla.org");
+  testVal("<foo.bar:@baz@>mozilla.org");
+  testVal("<foo.bar@:ba:z@>mozilla.org");
+  testVal("<foo.:bar:@baz@>mozilla.org");
 
   testVal("<https://sub.>mozilla.org<:666/file.ext>");
   testVal("<sub.>mozilla.org<:666/file.ext>");
   testVal("localhost<:666/file.ext>");
 
   let IPs = ["192.168.1.1",
              "[::]",
              "[::1]",
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -256,17 +256,17 @@ file, You can obtain one at http://mozil
           // trimmedLength to ensure we don't count the length of a trimmed protocol
           // when determining which parts of the URL to highlight as "preDomain".
           let trimmedLength = 0;
           if (uriInfo.fixedURI.scheme == "http" && !value.startsWith("http://")) {
             value = "http://" + value;
             trimmedLength = "http://".length;
           }
 
-          let matchedURL = value.match(/^((?:[a-z]+:\/\/)?(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
+          let matchedURL = value.match(/^((?:[a-z]+:\/\/)(?:[^\/#?]+@)?)(.+?)(?::\d+)?(?:[\/#?]|$)/);
           if (!matchedURL)
             return;
 
           // Strike out the "https" part if mixed active content is loaded.
           if (this.getAttribute("pageproxystate") == "valid" &&
               value.startsWith("https:") &&
               gBrowser.securityUI.state &
                 Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT) {