fixed as per code review

pull/2/head 0.8.0.0-alpha.6
gorhill 10 years ago
parent 8653401961
commit cbb0b8a8f1

@ -174,17 +174,19 @@ var onBeforeChromeExtensionRequestHandler = function(details) {
return; return;
} }
var µm = µMatrix;
// Is the target page still blacklisted? // Is the target page still blacklisted?
var pageURL = decodeURIComponent(matches[1]); var pageURL = decodeURIComponent(matches[1]);
var hostname = decodeURIComponent(matches[2]); var hostname = decodeURIComponent(matches[2]);
if ( µMatrix.mustBlock(µMatrix.scopeFromURL(pageURL), hostname, '*') ) { if ( µm.mustBlock(µm.scopeFromURL(pageURL), hostname, '*') ) {
return; return;
} }
µMatrix.asyncJobs.add( µMatrix.asyncJobs.add(
'gotoURL-' + details.tabId, 'gotoURL-' + details.tabId,
{ tabId: details.tabId, url: pageURL }, { tabId: details.tabId, url: pageURL },
µMatrix.utils.gotoURL, µm.utils.gotoURL,
200, 200,
false false
); );
@ -287,7 +289,7 @@ var processRequest = function(µm, details) {
} }
// Block request? // Block request?
var block = µm.mustBlock(µm.scopeFromURL(pageURL), requestHostname, requestType); var block = µm.mustBlock(pageStats.pageHostname, requestHostname, requestType);
// Record request. // Record request.
// https://github.com/gorhill/httpswitchboard/issues/342 // https://github.com/gorhill/httpswitchboard/issues/342
@ -466,13 +468,13 @@ var onBeforeSendHeadersHandler = function(details) {
var changed = false; var changed = false;
if ( µm.mustBlock(µm.scopeFromURL(pageURL), reqHostname, 'cookie') ) { if ( µm.mustBlock(pageStats.pageHostname, reqHostname, 'cookie') ) {
changed = foilCookieHeaders(µm, details) || changed; changed = foilCookieHeaders(µm, details) || changed;
} }
// TODO: use cookie cell to determine whether the referrer info must be // TODO: use cookie cell to determine whether the referrer info must be
// foiled. // foiled.
if ( µm.userSettings.processReferer && µm.mustBlock(this.scopeFromURL(pageURL), reqHostname, '*') ) { if ( µm.userSettings.processReferer && µm.mustBlock(pageStats.pageHostname, reqHostname, '*') ) {
changed = foilRefererHeaders(µm, reqHostname, details) || changed; changed = foilRefererHeaders(µm, reqHostname, details) || changed;
} }
@ -711,7 +713,7 @@ var onMainDocHeadersReceived = function(details) {
} }
// Evaluate // Evaluate
if ( µm.mustAllow(µm.scopeFromURL(µm.pageUrlFromPageStats(pageStats)), requestHostname, 'script') ) { if ( µm.mustAllow(pageStats.pageHostname, requestHostname, 'script') ) {
// https://github.com/gorhill/httpswitchboard/issues/181 // https://github.com/gorhill/httpswitchboard/issues/181
pageStats.pageScriptBlocked = false; pageStats.pageScriptBlocked = false;
return; return;
@ -760,7 +762,7 @@ var onSubDocHeadersReceived = function(details) {
} }
// Evaluate // Evaluate
if ( µm.mustAllow(µm.scopeFromURL(µm.pageUrlFromPageStats(pageStats)), µm.hostnameFromURL(details.url), 'script') ) { if ( µm.mustAllow(pageStats.pageHostname, µm.hostnameFromURL(details.url), 'script') ) {
return; return;
} }

Loading…
Cancel
Save