[tbb-commits] [torbutton/master] Bug 27760: Fix NoScript IPC for about:blank by whitelisting messages

gk at torproject.org gk at torproject.org
Tue Sep 18 10:50:39 UTC 2018


commit 6016a170f0266cf926b7ff305796ba83cc353536
Author: Rusty Bird <rustybird at net-c.com>
Date:   Fri Sep 14 13:05:08 2018 +0000

    Bug 27760: 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 934a4ef0..621f2b7f 100644
--- a/src/modules/noscript-control.js
+++ b/src/modules/noscript-control.js
@@ -129,6 +129,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 (!["started", "pageshow"].includes(a.__meta.name)) {
+        return;
+      }
       extensionContext.api.browser.runtime.onMessage.removeListener(messageListener);
       bindPrefAndInit(
         "extensions.torbutton.security_slider",



More information about the tbb-commits mailing list