mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 09:39:38 +02:00
related to #953
This commit is contained in:
parent
6c0bde394d
commit
d2a6a38db2
@ -49,6 +49,7 @@ var reRFC3986 = /^([^:\/?#]+:)?(\/\/[^\/?#]*)?([^?#]*)(\?[^#]*)?(#.*)?/;
|
||||
// Derived
|
||||
var reSchemeFromURI = /^[^:\/?#]+:/;
|
||||
var reAuthorityFromURI = /^(?:[^:\/?#]+:)?(\/\/[^\/?#]+)/;
|
||||
var reCommonHostnameFromURL = /^https?:\/\/([0-9a-z_][0-9a-z._-]+)\//;
|
||||
|
||||
// These are to parse authority field, not parsed by above official regex
|
||||
// IPv6 is seen as an exception: a non-compatible IPv6 is first tried, and
|
||||
@ -248,7 +249,11 @@ URI.authorityFromURI = function(uri) {
|
||||
// The most used function, so it better be fast.
|
||||
|
||||
URI.hostnameFromURI = function(uri) {
|
||||
var matches = reAuthorityFromURI.exec(uri);
|
||||
var matches = reCommonHostnameFromURL.exec(uri);
|
||||
if ( matches ) {
|
||||
return matches[1];
|
||||
}
|
||||
matches = reAuthorityFromURI.exec(uri);
|
||||
if ( !matches ) {
|
||||
return '';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user