diff --git a/browser/base/content/test/browser_urlHighlight.js b/browser/base/content/test/browser_urlHighlight.js
index 73903da6e25..3ab31273841 100644
--- a/browser/base/content/test/browser_urlHighlight.js
+++ b/browser/base/content/test/browser_urlHighlight.js
@@ -62,6 +62,8 @@ function test() {
testVal("mozilla.org");
testVal("mozilla.org<:666/file.ext>");
+ testVal("mozilla.org<:666/file.ext>");
+ testVal("localhost<:666/file.ext>");
let IPs = ["192.168.1.1",
"[::]",
@@ -87,6 +89,7 @@ function test() {
IPs.forEach(function (IP) {
testVal(IP);
testVal(IP + "");
+ testVal(IP + "<:666/file.ext>");
testVal("" + IP);
testVal("" + IP + "");
testVal("" + IP + "<:666/file.ext>");
diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml
index aaa9c62d7ce..2e65ee5e931 100644
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -204,7 +204,7 @@
let textNode = this.editor.rootElement.firstChild;
let value = textNode.textContent;
- let protocol = value.match(/^[a-z\d.+\-]+:/);
+ let protocol = value.match(/^[a-z\d.+\-]+:(?=[^\d])/);
if (protocol &&
["http:", "https:", "ftp:"].indexOf(protocol[0]) == -1)
return;