mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 1603316 - Quantumbar: Fix slow regexp that tests for IPv4 URLs. r=mak
The problem seems to be that there is a dot in both the first square-bracket group and after the group, in this regexp: https://searchfox.org/mozilla-central/rev/c52d5f8025b5c9b2b4487159419ac9012762c40c/toolkit/components/places/UnifiedComplete.jsm#565 Removing the one inside the group fixes both bug 1603316 and bug 1605108. I'm not sure why there was a dot inside the group to begin with. Am I missing something? This regexp is testing for IPv4 addresses. Differential Revision: https://phabricator.services.mozilla.com/D60203 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
f9c361fe7e
commit
50ab04f727
@ -562,7 +562,7 @@ function looksLikeUrl(str, ignoreAlphanumericHosts = false) {
|
||||
!REGEXP_SPACES.test(str) &&
|
||||
(["/", "@", ":", "["].some(c => str.includes(c)) ||
|
||||
(ignoreAlphanumericHosts
|
||||
? /^([\[\]A-Z0-9.-]+\.){3,}[^.]+$/i.test(str)
|
||||
? /^([\[\]A-Z0-9-]+\.){3,}[^.]+$/i.test(str)
|
||||
: str.includes(".")))
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user