Bug 1199601 - r=mak
MozReview-Commit-ID: DR7HEJa6SMH
--- 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) {