proper naming of variables

This commit is contained in:
gorhill 2014-07-14 14:53:06 -04:00
parent 89fe740d2b
commit b563d8bc43

View file

@ -31,14 +31,14 @@
// Intercept root frame requests. This is where we identify and block popups. // Intercept root frame requests. This is where we identify and block popups.
var onBeforeRootDocumentRequestHandler = function(tabId, details) { var onBeforeRootDocument = function(tabId, details) {
var µb = µBlock; var µb = µBlock;
// Ignore non-http schemes: I don't think this could ever happened // Ignore non-http schemes: I don't think this could ever happened
// because of filters at addListener() time... Will see. // because of filters at addListener() time... Will see.
var requestURL = details.url; var requestURL = details.url;
if ( requestURL.slice(0, 4) !== 'http' ) { if ( requestURL.slice(0, 4) !== 'http' ) {
console.error('onBeforeRootDocumentRequestHandler(): Unexpected scheme!'); console.error('onBeforeRootDocument(): Unexpected scheme!');
µb.unbindTabFromPageStats(tabId); µb.unbindTabFromPageStats(tabId);
return; return;
} }
@ -90,7 +90,7 @@ var onBeforeRootDocumentRequestHandler = function(tabId, details) {
// Intercept and filter web requests according to white and black lists. // Intercept and filter web requests according to white and black lists.
var onBeforeRequestHandler = function(details) { var onBeforeSendHeaders = function(details) {
//console.debug('onBeforeRequestHandler()> "%s": %o', details.url, details); //console.debug('onBeforeRequestHandler()> "%s": %o', details.url, details);
// Do not block behind the scene requests. // Do not block behind the scene requests.
@ -102,14 +102,14 @@ var onBeforeRequestHandler = function(details) {
// Special handling for root document. // Special handling for root document.
var requestType = details.type; var requestType = details.type;
if ( requestType === 'main_frame' && details.parentFrameId < 0 ) { if ( requestType === 'main_frame' && details.parentFrameId < 0 ) {
return onBeforeRootDocumentRequestHandler(tabId, details); return onBeforeRootDocument(tabId, details);
} }
// Ignore non-http schemes: I don't think this could ever happened // Ignore non-http schemes: I don't think this could ever happened
// because of filters at addListener() time... Will see. // because of filters at addListener() time... Will see.
var requestURL = details.url; var requestURL = details.url;
if ( requestURL.slice(0, 4) !== 'http' ) { if ( requestURL.slice(0, 4) !== 'http' ) {
console.error('onBeforeRequestHandler(): Unexpected scheme!'); console.error('onBeforeSendHeaders(): Unexpected scheme!');
return; return;
} }
@ -144,7 +144,7 @@ var onBeforeRequestHandler = function(details) {
} }
// Blocked // Blocked
//console.debug('µBlock> onBeforeRequestHandler()> BLOCK "%s" because "%s"', details.url, reason); //console.debug('µBlock> onBeforeSendHeaders()> BLOCK "%s" because "%s"', details.url, reason);
// https://github.com/gorhill/uBlock/issues/18 // https://github.com/gorhill/uBlock/issues/18
// Do not use redirection, we need to block outright to be sure the request // Do not use redirection, we need to block outright to be sure the request
@ -169,12 +169,12 @@ var referrerFromHeaders = function(headers) {
chrome.webRequest.onBeforeSendHeaders.addListener( chrome.webRequest.onBeforeSendHeaders.addListener(
//function(details) { //function(details) {
// quickProfiler.start('onBeforeRequest'); // quickProfiler.start('onBeforeSendHeaders');
// var r = onBeforeRequestHandler(details); // var r = onBeforeSendHeaders(details);
// quickProfiler.stop(); // quickProfiler.stop();
// return r; // return r;
//}, //},
onBeforeRequestHandler, onBeforeSendHeaders,
{ {
"urls": [ "urls": [
"http://*/*", "http://*/*",