Browse Source

[corrected commit message] code review of ad9d591b1666: remove more obsolete code

pull/2/head
gorhill 7 years ago
parent
commit
357b44c265
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 10
      src/js/contentscript.js
  2. 1
      src/js/httpsb.js
  3. 2
      src/js/matrix.js
  4. 6
      src/js/messaging.js

10
src/js/contentscript.js

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

1
src/js/httpsb.js

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

2
src/js/matrix.js

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

6
src/js/messaging.js

@ -458,7 +458,7 @@ var evaluateURLs = function(tabId, requests) {
} }
var rootHostname = tabContext.rootHostname; 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 pageStore = µm.pageStoreFromTabId(tabId);
var µmuri = µm.URI; var µmuri = µm.URI;
@ -550,8 +550,7 @@ var onMessage = function(request, sender, callback) {
callback(response); 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, userSettings: µm.userSettings,
matrixSwitches: { matrixSwitches: {
'https-strict': µm.pMatrix.evaluateSwitch('https-strict', '*') === 1, 'https-strict': µm.pMatrix.evaluateSwitch('https-strict', '*') === 1,
'ua-spoof': µm.pMatrix.evaluateSwitch('ua-spoof', '*') === 1,
'referrer-spoof': µm.pMatrix.evaluateSwitch('referrer-spoof', '*') === 1 'referrer-spoof': µm.pMatrix.evaluateSwitch('referrer-spoof', '*') === 1
} }
}; };

Loading…
Cancel
Save