Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
code review: #433
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Dec 28, 2014
1 parent 1fe7045 commit b49b086
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/js/pagestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ PageStore.factory = function(tabId, pageURL) {

/******************************************************************************/

PageStore.prototype.bitFromRequestType = {
PageStore.prototype.bitFromResult = {
'': 1,
'sb': 2,
'sa': 4,
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 6 additions & 8 deletions src/js/ublock.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,20 +371,18 @@ 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();
}
}
}

df.evaluateCellZY(rootHostname, requestHostname, requestType);
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
Expand Down

0 comments on commit b49b086

Please sign in to comment.