Skip to content

Commit

Permalink
Bug 27427: Fix NoScript IPC for about:blank by whitelisting messages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rustybird authored and arthuredelstein committed Sep 14, 2018
1 parent 9156c55 commit 3130e6f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/modules/noscript-control.js
Expand Up @@ -125,8 +125,12 @@ var initialize = () => {

// Wait for the first message from NoScript to arrive, and then
// 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])}`);
let messageListener = (message,b,c) => {
log(3, `Message received from NoScript: ${JSON.stringify([message,b,c])}`);
if (message._messageName !== "started" &&
message._messageName !== "pageshow") {
return;
}
extensionContext.api.browser.runtime.onMessage.removeListener(messageListener);
bindPrefAndInit(
"extensions.torbutton.security_slider",
Expand Down

0 comments on commit 3130e6f

Please sign in to comment.