From 357b44c26516c95a90080ece2f7334e760ebb026 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 1 Dec 2017 08:48:31 -0500 Subject: [PATCH] [corrected commit message] code review of ad9d591b1666: remove more obsolete code --- src/js/contentscript.js | 10 +++++----- src/js/httpsb.js | 1 - src/js/matrix.js | 2 +- src/js/messaging.js | 6 ++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/js/contentscript.js b/src/js/contentscript.js index 1982290..f4cf7b2 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -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); diff --git a/src/js/httpsb.js b/src/js/httpsb.js index cee7bb9..0f2ad53 100644 --- a/src/js/httpsb.js +++ b/src/js/httpsb.js @@ -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); diff --git a/src/js/matrix.js b/src/js/matrix.js index e49fcb8..537f72a 100644 --- a/src/js/matrix.js +++ b/src/js/matrix.js @@ -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 ] ]); diff --git a/src/js/messaging.js b/src/js/messaging.js index ed3f82b..05e34c0 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -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 } };