mirror of https://github.com/gorhill/uBlock.git
this fixes #185
This commit is contained in:
parent
ec5dab2c97
commit
77aae44fee
|
@ -109,7 +109,11 @@ PageStore.prototype.init = function(tabId, pageURL) {
|
|||
this.previousPageURL = '';
|
||||
this.pageURL = pageURL;
|
||||
this.pageHostname = µb.URI.hostnameFromURI(pageURL);
|
||||
this.pageDomain = µb.URI.domainFromHostname(this.pageHostname);
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/185
|
||||
// Use hostname if no domain can be extracted
|
||||
this.pageDomain = µb.URI.domainFromHostname(this.pageHostname) || this.pageHostname;
|
||||
|
||||
this.frames = disposeFrameStores(this.frames);
|
||||
this.netFiltering = true;
|
||||
this.netFilteringReadTime = 0;
|
||||
|
|
29
js/ublock.js
29
js/ublock.js
|
@ -30,11 +30,14 @@
|
|||
|
||||
// The caller may provide an already known domain -- convenient to reduce
|
||||
// overhead of extracting a domain from the url
|
||||
if ( domain === undefined ) {
|
||||
if ( typeof domain !== 'string' ) {
|
||||
domain = this.URI.domainFromHostname(keyHostname);
|
||||
}
|
||||
if ( !domain ) {
|
||||
return true;
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/185
|
||||
// Use hostname if no domain can be extracted
|
||||
if ( domain === '' ) {
|
||||
domain = keyHostname;
|
||||
}
|
||||
|
||||
var exceptions = this.netWhitelist[domain];
|
||||
|
@ -73,8 +76,11 @@
|
|||
// The caller may provide an already known domain -- convenient to reduce
|
||||
// overhead of extracting a domain from `key`
|
||||
var domain = this.URI.domainFromHostname(keyHostname);
|
||||
if ( !domain ) {
|
||||
return false;
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/185
|
||||
// Use hostname if no domain can be extracted
|
||||
if ( domain === '' ) {
|
||||
domain = keyHostname;
|
||||
}
|
||||
|
||||
var currentState = this.getNetFilteringSwitch(url, domain);
|
||||
|
@ -153,14 +159,15 @@
|
|||
µBlock.whitelistFromString = function(s) {
|
||||
var exceptions = {};
|
||||
var lines = s.split(/[\n\r]+/);
|
||||
var line, domain, bucket;
|
||||
var line, hostname, domain, bucket;
|
||||
for ( var i = 0; i < lines.length; i++ ) {
|
||||
line = lines[i].trim();
|
||||
domain = line.indexOf('/') !== -1 ?
|
||||
this.URI.domainFromURI(line) :
|
||||
this.URI.domainFromHostname(line);
|
||||
if ( !domain ) {
|
||||
continue;
|
||||
hostname = line.indexOf('/') !== -1 ? this.URI.hostnameFromURI(line) : line;
|
||||
domain = this.URI.domainFromHostname(hostname);
|
||||
// https://github.com/gorhill/uBlock/issues/185
|
||||
// Use hostname if no domain can be extracted
|
||||
if ( domain === '' ) {
|
||||
domain = hostname;
|
||||
}
|
||||
bucket = exceptions[domain];
|
||||
if ( bucket === undefined ) {
|
||||
|
|
Loading…
Reference in New Issue