commit efdc83fec6244d5f2e4b8880fef010a6e362d9dc Author: Rusty Bird rustybird@net-c.com Date: Mon Sep 3 12:32:04 2018 +0000
Fix NoScript IPC for about:blank by whitelisting messages
If about:blank is the homepage (or has been passed as a command line parameter), NoScript will send a message named "fetchChildPolicy" _before_ "started". Torbutton would then send its "updateSettings" too soon, resulting in the dreaded error "Could not establish connection. Receiving end does not exist" (see bug 26520).
Fix this by whitelisting the relevant messages from NoScript: "started" and also "pageshow" for a slightly more graceful failure mode in case Torbutton somehow misses NoScript startup. --- src/modules/noscript-control.js | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/modules/noscript-control.js b/src/modules/noscript-control.js index a03755de..02fa1bc8 100644 --- a/src/modules/noscript-control.js +++ b/src/modules/noscript-control.js @@ -127,6 +127,9 @@ var initialize = () => { // bind the security_slider pref to the NoScript settings. let messageListener = (a,b,c) => { log(3, `Message received from NoScript: ${JSON.stringify([a,b,c])}`); + if (a._messageName != "started" && a._messageName != "pageshow") { + return; + } extensionContext.api.browser.runtime.onMessage.removeListener(messageListener); bindPrefAndInit( "extensions.torbutton.security_slider",
tbb-commits@lists.torproject.org