code review: #433

This commit is contained in:
gorhill 2014-12-28 12:04:48 -05:00
parent 1fe7045b92
commit b49b0864d3
2 changed files with 10 additions and 12 deletions

View File

@ -296,7 +296,7 @@ PageStore.factory = function(tabId, pageURL) {
/******************************************************************************/
PageStore.prototype.bitFromRequestType = {
PageStore.prototype.bitFromResult = {
'': 1,
'sb': 2,
'sa': 4,
@ -320,8 +320,8 @@ PageStore.prototype.init = function(tabId, pageURL) {
// This is part of the filtering evaluation context
this.requestURL = this.requestHostname = this.requestType = '';
this.requestHostnames = {};
this.requestHostnames = {};
this.frames = {};
this.netFiltering = true;
this.netFilteringReadTime = 0;
@ -452,9 +452,9 @@ PageStore.prototype.filterRequest = function(context) {
var requestHostname = context.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 {
this.requestHostnames[requestHostname] = this.bitFromRequestType[result.slice(0, 2)];
this.requestHostnames[requestHostname] = this.bitFromResult[result.slice(0, 2)];
}
return result;

View File

@ -371,21 +371,19 @@ var matchWhitelistDirective = function(url, hostname, directive) {
if ( df.mustBlockOrAllow() ) {
return df.toFilterString();
}
}
if ( requestType === 'sub_frame' ) {
} else if ( requestType === 'sub_frame' ) {
if ( this.isFirstParty(rootHostname, requestHostname) === false ) {
df.evaluateCellZY(rootHostname, requestHostname, '3p-frame');
if ( df.mustBlockOrAllow() ) {
return df.toFilterString();
}
}
}
} else {
df.evaluateCellZY(rootHostname, requestHostname, requestType);
if ( df.mustBlockOrAllow() ) {
return df.toFilterString();
}
}
// 5. Static filtering never override dynamic filtering
return this.staticNetFilteringEngine.matchString(context);