mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
code review: #433
This commit is contained in:
parent
1fe7045b92
commit
b49b0864d3
@ -296,7 +296,7 @@ PageStore.factory = function(tabId, pageURL) {
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
PageStore.prototype.bitFromRequestType = {
|
PageStore.prototype.bitFromResult = {
|
||||||
'': 1,
|
'': 1,
|
||||||
'sb': 2,
|
'sb': 2,
|
||||||
'sa': 4,
|
'sa': 4,
|
||||||
@ -320,8 +320,8 @@ PageStore.prototype.init = function(tabId, pageURL) {
|
|||||||
|
|
||||||
// This is part of the filtering evaluation context
|
// This is part of the filtering evaluation context
|
||||||
this.requestURL = this.requestHostname = this.requestType = '';
|
this.requestURL = this.requestHostname = this.requestType = '';
|
||||||
this.requestHostnames = {};
|
|
||||||
|
|
||||||
|
this.requestHostnames = {};
|
||||||
this.frames = {};
|
this.frames = {};
|
||||||
this.netFiltering = true;
|
this.netFiltering = true;
|
||||||
this.netFilteringReadTime = 0;
|
this.netFilteringReadTime = 0;
|
||||||
@ -452,9 +452,9 @@ PageStore.prototype.filterRequest = function(context) {
|
|||||||
|
|
||||||
var requestHostname = context.requestHostname;
|
var requestHostname = context.requestHostname;
|
||||||
if ( this.requestHostnames.hasOwnProperty(requestHostname) ) {
|
if ( this.requestHostnames.hasOwnProperty(requestHostname) ) {
|
||||||
this.requestHostnames[requestHostname] |= this.bitFromRequestType[result.slice(0, 2)];
|
this.requestHostnames[requestHostname] |= this.bitFromResult[result.slice(0, 2)];
|
||||||
} else {
|
} else {
|
||||||
this.requestHostnames[requestHostname] = this.bitFromRequestType[result.slice(0, 2)];
|
this.requestHostnames[requestHostname] = this.bitFromResult[result.slice(0, 2)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -371,20 +371,18 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
|||||||
if ( df.mustBlockOrAllow() ) {
|
if ( df.mustBlockOrAllow() ) {
|
||||||
return df.toFilterString();
|
return df.toFilterString();
|
||||||
}
|
}
|
||||||
}
|
} else if ( requestType === 'sub_frame' ) {
|
||||||
|
|
||||||
if ( requestType === 'sub_frame' ) {
|
|
||||||
if ( this.isFirstParty(rootHostname, requestHostname) === false ) {
|
if ( this.isFirstParty(rootHostname, requestHostname) === false ) {
|
||||||
df.evaluateCellZY(rootHostname, requestHostname, '3p-frame');
|
df.evaluateCellZY(rootHostname, requestHostname, '3p-frame');
|
||||||
if ( df.mustBlockOrAllow() ) {
|
if ( df.mustBlockOrAllow() ) {
|
||||||
return df.toFilterString();
|
return df.toFilterString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
df.evaluateCellZY(rootHostname, requestHostname, requestType);
|
||||||
df.evaluateCellZY(rootHostname, requestHostname, requestType);
|
if ( df.mustBlockOrAllow() ) {
|
||||||
if ( df.mustBlockOrAllow() ) {
|
return df.toFilterString();
|
||||||
return df.toFilterString();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Static filtering never override dynamic filtering
|
// 5. Static filtering never override dynamic filtering
|
||||||
|
Loading…
Reference in New Issue
Block a user