Skip to content

Commit 3130e6f

Browse files
rustybirdarthuredelstein
authored andcommitted
Bug 27427: 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.
1 parent 9156c55 commit 3130e6f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/modules/noscript-control.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,12 @@ var initialize = () => {
125125

126126
// Wait for the first message from NoScript to arrive, and then
127127
// bind the security_slider pref to the NoScript settings.
128-
let messageListener = (a,b,c) => {
129-
log(3, `Message received from NoScript: ${JSON.stringify([a,b,c])}`);
128+
let messageListener = (message,b,c) => {
129+
log(3, `Message received from NoScript: ${JSON.stringify([message,b,c])}`);
130+
if (message._messageName !== "started" &&
131+
message._messageName !== "pageshow") {
132+
return;
133+
}
130134
extensionContext.api.browser.runtime.onMessage.removeListener(messageListener);
131135
bindPrefAndInit(
132136
"extensions.torbutton.security_slider",

0 commit comments

Comments
 (0)