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, '': 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;

View File

@ -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