1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-03 10:54:55 +12:00

code review of 88853070a1a4: remove obsolete code

This commit is contained in:
gorhill 2017-12-01 08:48:31 -05:00
parent ad9d591b16
commit 6f7d793abd
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
4 changed files with 8 additions and 11 deletions

View file

@ -35,7 +35,7 @@
// https://github.com/chrisaljoudi/uBlock/issues/464
if ( document instanceof HTMLDocument === false ) {
//console.debug('contentscript-end.js > not a HTLMDocument');
//console.debug('contentscript.js > not a HTLMDocument');
return;
}
@ -46,21 +46,21 @@ if ( !window.location ) {
// This can happen
if ( typeof vAPI !== 'object' ) {
//console.debug('contentscript-end.js > vAPI not found');
//console.debug('contentscript.js > vAPI not found');
return;
}
// https://github.com/chrisaljoudi/uBlock/issues/456
// Already injected?
if ( vAPI.contentscriptEndInjected ) {
//console.debug('contentscript-end.js > content script already injected');
//console.debug('contentscript.js > content script already injected');
return;
}
vAPI.contentscriptEndInjected = true;
/******************************************************************************/
var localMessager = vAPI.messaging.channel('contentscript-end.js');
var localMessager = vAPI.messaging.channel('contentscript.js');
vAPI.shutdown.add(function() {
localMessager.close();
@ -420,7 +420,7 @@ var nodeListsAddedHandler = function(nodeLists) {
// https://github.com/gorhill/httpswitchboard/issues/131
hasInlineScript(document.querySelectorAll('a[href^="javascript:"],script'), summary);
//console.debug('contentscript-end.js > firstObservationHandler(): found %d script tags in "%s"', Object.keys(summary.scriptSources).length, window.location.href);
//console.debug('contentscript.js > firstObservationHandler(): found %d script tags in "%s"', Object.keys(summary.scriptSources).length, window.location.href);
localMessager.send(summary);

View file

@ -36,7 +36,6 @@
µm.pMatrix.setSwitch('matrix-off', 'opera-scheme', 1);
µm.pMatrix.setSwitch('matrix-off', 'behind-the-scene', 1);
µm.pMatrix.setSwitch('referrer-spoof', 'behind-the-scene', 2);
µm.pMatrix.setSwitch('ua-spoof', 'behind-the-scene', 2);
µm.pMatrix.setSwitch('https-strict', 'behind-the-scene', 2);
µm.pMatrix.setCell('*', '*', '*', µm.Matrix.Red);
µm.pMatrix.setCell('*', '*', 'css', µm.Matrix.Green);

View file

@ -89,7 +89,7 @@ var nameToStateMap = {
var switchBitOffsets = new Map([
[ 'matrix-off', 0 ],
[ 'https-strict', 2 ],
[ 'ua-spoof', 4 ],
/* 4 is now unused, formerly assigned to UA spoofing */
[ 'referrer-spoof', 6 ]
]);

View file

@ -458,7 +458,7 @@ var evaluateURLs = function(tabId, requests) {
}
var rootHostname = tabContext.rootHostname;
//console.debug('messaging.js/contentscript-end.js: processing %d requests', requests.length);
//console.debug('messaging.js/contentscript.js: processing %d requests', requests.length);
var pageStore = µm.pageStoreFromTabId(tabId);
var µmuri = µm.URI;
@ -550,8 +550,7 @@ var onMessage = function(request, sender, callback) {
callback(response);
};
vAPI.messaging.listen('contentscript-start.js', onMessage);
vAPI.messaging.listen('contentscript-end.js', onMessage);
vAPI.messaging.listen('contentscript.js', onMessage);
/******************************************************************************/
@ -673,7 +672,6 @@ var onMessage = function(request, sender, callback) {
userSettings: µm.userSettings,
matrixSwitches: {
'https-strict': µm.pMatrix.evaluateSwitch('https-strict', '*') === 1,
'ua-spoof': µm.pMatrix.evaluateSwitch('ua-spoof', '*') === 1,
'referrer-spoof': µm.pMatrix.evaluateSwitch('referrer-spoof', '*') === 1
}
};