rustybird reported that NoScript is broken when setting TOR_SKIP_LAUNCH=1 (see comment:13:ticket:26128):
"""
This seems to break on a fresh 8.0a9-build3 linux64 installation whenever TOR_SKIP_LAUNCH=1 is set (with system tor
running on the usual ports). JavaScript is effectively disabled and the browser console says:
[06-25 18:36:50] Torbutton NOTE: security-prefs.js initialization completeError: Could not establish connection. Receiving end does not exist. ExtensionCommon.jsm:456:12
Some sort of extension startup race?
"""
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
Thanks, rustybird! I can reproduce this. The cause of the reported error is that NoScript starts (or at least starts listening for messages) later than torbutton tries to send initial settings. Unfortunately I haven't figured out yet how to determine when NoScript is ready to receive messages.
Now it seems to fire too late - on first site load (not including about:tor). If that first loaded site contains JavaScript, it will be disabled there. Tested on e.g. https://enable-javascript.com
I tried with a line log(5, "XXX sending"); added inside the sendNoScriptSettings function and noticed that both the first site load and moving the slider resulted in //multiple// messages to NoScript - not sure if that's a problem. (Slightly related, noscript-control.js has a guard against the initialized variable, but it's never set to true.)
Now it seems to fire too late - on first site load (not including about:tor). If that first loaded site contains JavaScript, it will be disabled there. Tested on e.g. https://enable-javascript.com
I tried with a line log(5, "XXX sending"); added inside the sendNoScriptSettings function and noticed that both the first site load and moving the slider resulted in //multiple// messages to NoScript - not sure if that's a problem.
I wasn't able to reproduce these two issues. I even tried setting https://enable-javascript.com as the browser's homepage, but in every case the NoScript state seems to be set correctly. Do you still see these issues with the revised patch?
The "multiple messages to NoScript" problem is gone with the revised patch. I still have the "first site load" problem on a freshly extracted and patched TB - sorry if it's tediously verbose:
Run system tor on SocksPort 9150, ControlPort 9151
Extract tor-browser-linux64-8.0a9_en-US.tar.xz to a new directory
In the extensions directory, unzip -d torbutton@torproject.org/ torbutton@torproject.org.xpi and delete the .xpi
In torbutton@torproject.org/, apply the revised patch with -p2
Make a backup of the pristine patched tor-browser_en-US/ directory
It shows "JavaScript is disabled in your web browser" until I refresh the site, at which point it switches to "JavaScript is enabled". Same for other websites that depend on JavaScript, e.g. https://twitter.com/torproject (after restarting with a new copy of the backed up directory from step 5).
@arthuredelstein: As an experiment, I added a patch (debug-retry.diff) on top of your second patch. It reverts to the previous approach of immediately calling sendMessage() instead of waiting for a message from NoScript first, and it also retries on failure. Weirdly, after logging about ten failures and then a success to the Browser Console, JavaScript is still disabled! (On a fresh TB installation.) Maybe there's a second race condition somewhere, e.g. NoScript ignoring a message delivered successfully but very early?
BTW should this ticket have the AffectsTails keyword?
BTW should this ticket have the AffectsTails keyword?
Thanks for caring! Tails does not use TOR_SKIP_LAUNCH=1. Instead we set TOR_CONFIGURE_ONLY=1 before starting Tor Launcher (as an independent XUL application). I've tested on my current build of Tails with Tor Browser 8.0a10 and:
NoScript seems to work just fine
I see JavaScript error: re[/gre/modules/ExtensionCommon.jsm,](/gre/modules/ExtensionCommon.jsm,) line 456: Error: Could not establish connection. Receiving end does not exist. in the logs.
If I raise the security slider to "Safest" then JavaScript is correctly disabled.
I don't know how to test whether "the communication between Torbutton and NoScript" works.
Let me know if there's any other info I can provide, happy to help :)
Tails does not use TOR_SKIP_LAUNCH=1. Instead we set TOR_CONFIGURE_ONLY=1 before starting Tor Launcher (as an independent XUL application).
I think it's equivalent for this bug (except with maybe a slightly different timing in the race?) to use TOR_SKIP_LAUNCH=1, or extensions.torlauncher.start_tor=false, or to completely disable/remove the TorLauncher extension in the main Tor Browser profile (e.g. because you're starting it independently).
I see JavaScript error: re[/gre/modules/ExtensionCommon.jsm,](/gre/modules/ExtensionCommon.jsm,) line 456: Error: Could not establish connection. Receiving end does not exist. in the logs.
Yup, there it is. :\
If I raise the security slider to "Safest" then JavaScript is correctly disabled.
I don't know how to test whether "the communication between Torbutton and NoScript" works.
The symptom to look out for is JavaScript //not// working on websites even though it should be enabled, especially in the default state after installation. If you start a fresh browser and don't open the Torbutton Security Settings dialog at all, the slider level defaults to Standard, so JavaScript should be enabled - but:
situation on vanilla 8.0a9 and 8.0a10: You can only make JavaScript work if you move the slider away from Standard to Safer or Safest, confirm with OK, and then move it back to Standard again
situation with the proposed second patch: JavaScript only works (and the slider only becomes functional) after the first website has been loaded