mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 17:17:57 +01:00
related to #953
This commit is contained in:
parent
6c0bde394d
commit
d2a6a38db2
1 changed files with 6 additions and 1 deletions
|
@ -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 a new issue