Tor Browser 7.0.9 doesn't run background scripts from Web Extensions
While doing some last minute tests before the release of the port of the Tails ISO image verification extension to Web Extensions we realized that it was not working on Debian while it is working on Tails and Windows.
Investigating this further we think that the background scripts of Web Extensions are not run correctly in Tor Browser 7.0.9 on Debian. For example, running the dummy extension described in https://trac.torproject.org/projects/tor/ticket/21270 leads to a ping in the console on both Tor Browser 7.0.8 in Windows and Tor Browser 7.0.6 in Tails but not on Tor Browser 7.0.9 in Debian. I'm sorry I'm comparing different version of Tor Browser on different OSes so I can't tell if it's OS-specific or version-specific... Note that they were all in "low" security in the slider.
Here is the code of the dummy extension I used to do the tests, inspired from #21270 (moved):
$ cat ping/manifest.json
{
"manifest_version": 2,
"name": "Ping Test",
"version": "1.0",
"description": "Tiny extension which pings the console from a background script.",
"background": {
"scripts": [ "ping.js" ]
}
}
$ cat ping/ping.js
console.log('ping');
The procedure to test it is:
- Start a fresh Tor Browser.
- Press Ctrl+Shift+J to open the JavaScript console.
- Visit about:debugging and load manifest.json as a temporary add-on.
The output of the console in each case is:
Debian: 7.0.9 (based on Mozilla Firefox 52.4.1) (64-bit)
1510597075800 addons.webextension.{73a6fe31-595d-460b-a920-fcc0f8843232} WARN Loading extension '{73a6fe31-595d-460b-a920-fcc0f8843232}': Reading manifest: Error processing permissions.1: Unknown permission "privacy"
1510597075800 addons.webextension.{73a6fe31-595d-460b-a920-fcc0f8843232} WARN Loading extension '{73a6fe31-595d-460b-a920-fcc0f8843232}': Reading manifest: Error processing permissions.4: Unknown permission "unlimitedStorage"
1510597075800 addons.webextension.https-everywhere-eff@eff.org WARN Loading extension 'https-everywhere-eff@eff.org': Reading manifest: Error processing devtools_page: An unexpected property was found in the WebExtension manifest.
Tor NOTICE: Bootstrapped 85%: Finishing handshake with first hop
1510597076000 addons.webextension.https-everywhere-eff@eff.org WARN Please specify whether you want browser_style or not in your browser_action options.
Tor NOTICE: Bootstrapped 90%: Establishing a Tor circuit
Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist. ExtensionCommon.jsm:265
Tor NOTICE: new bridge descriptor 'potagerbis' (fresh): $8D31A74671EACA6B3865DDBD6A5DD70D7F6A24F6~potagerbis at 91.194.60.100
Tor NOTICE: Tor has successfully opened a circuit. Looks like client functionality is working.
Tor NOTICE: Bootstrapped 100%: Done
[11-13 18:18:05] Torbutton NOTE: Initializing security-prefs.js
[11-13 18:18:05] Torbutton NOTE: security-prefs.js initialization complete
Tor NOTICE: New control connection opened from 127.0.0.1.
[11-13 18:18:06] Torbutton WARN: no SOCKS credentials found for current document.
Key event not available on some keyboard layouts: key=“r” modifiers=“accel,alt” id=“toggleReaderMode” browser.xul
Key event not available on GTK2: key=“u” modifiers=“accel shift” id=“torbutton-new-identity-key” browser.xul
Key event not available on some keyboard layouts: key=“i” modifiers=“accel,alt,shift” id=“key_browserToolbox” browser.xul
[11-13 18:18:26] Torbutton WARN: no SOCKS credentials found for current document.
[11-13 18:18:43] Torbutton WARN: no SOCKS credentials found for current document.
JSON.parse: unexpected end of data at line 1 column 1 of the JSON data DirectoryLinksProvider.jsm:391
[11-13 18:18:49] Torbutton WARN: no SOCKS credentials found for current document.
[11-13 18:19:17] Torbutton WARN: no SOCKS credentials found for current document.
Windows: 7.0.8 (based on Mozilla Firefox 52.4.1) (32-bit)
[11-13 18:21:01] TorLauncher NOTE: failed to open authenticated connection: [scrubbed]
1510597261900 addons.webextension.{73a6fe31-595d-460b-a920-fcc0f8843232} WARN Loading extension '{73a6fe31-595d-460b-a920-fcc0f8843232}': Reading manifest: Error processing permissions.1: Unknown permission "privacy"
1510597262000 addons.webextension.{73a6fe31-595d-460b-a920-fcc0f8843232} WARN Loading extension '{73a6fe31-595d-460b-a920-fcc0f8843232}': Reading manifest: Error processing permissions.4: Unknown permission "unlimitedStorage"
1510597272200 addons.webextension.https-everywhere-eff@eff.org WARN Loading extension 'https-everywhere-eff@eff.org': Reading manifest: Error processing devtools_page: An unexpected property was found in the WebExtension manifest.
1510597272600 addons.webextension.https-everywhere-eff@eff.org WARN Please specify whether you want browser_style or not in your browser_action options.
Tor NOTICE: Bootstrapped 85%: Finishing handshake with first hop
Tor NOTICE: Bootstrapped 90%: Establishing a Tor circuit
Tor NOTICE: Tor has successfully opened a circuit. Looks like client functionality is working.
Tor NOTICE: Bootstrapped 100%: Done
Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist. ExtensionCommon.jsm:265
[11-13 18:21:18] Torbutton NOTE: Initializing security-prefs.js
[11-13 18:21:18] Torbutton NOTE: security-prefs.js initialization complete
Tor NOTICE: New control connection opened from 127.0.0.1.
[11-13 18:21:19] Torbutton WARN: no SOCKS credentials found for current document.
[11-13 18:21:20] Torbutton WARN: no SOCKS credentials found for current document.
Key event not available on some keyboard layouts: key=<93>r<94> modifiers=<93>accel,alt<94> id=<93>toggleReaderMode<94> browser.xul
Key event not available on GTK2: key=<93>u<94> modifiers=<93>accel shift<94> id=<93>torbutton-new-identity-key<94> browser.xul
Key event not available on some keyboard layouts: key=<93>i<94> modifiers=<93>accel,alt,shift<94> id=<93>key_browserToolbox<94> browser.xul
[11-13 18:21:33] Torbutton WARN: no SOCKS credentials found for current document.
ping ping.js:1:1
Tails: 7.0.6 (based on Mozilla Firefox 52.4.0) (64-bit)
DEPRECATION WARNING: Search service falling back to synchronous initialization. This is generally the consequence of an add-on using a deprecated search service API.
You may find more details about this deprecation at: https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIBrowserSearchService#async_warning
jar:file:///usr/local/lib/tor-browser/omni.ja!/components/nsSearchService.js 2702 SRCH_SVC__ensureInitialized
jar:file:///usr/local/lib/tor-browser/omni.ja!/components/nsSearchService.js 4003 SRCH_SVC_getEngineByName
mozilla.cfg 4 null
Deprecated.jsm:79
1510598479300 addons.xpi-utils ERROR Unable to read anything useful from the database Log.jsm:753
1510598480100 addons.webextension.<unknown> WARN Loading extension 'null': Reading manifest: Error processing permissions.1: Unknown permission "privacy"
1510598482300 addons.webextension.<unknown> WARN Loading extension 'null': Reading manifest: Error processing devtools_page: An unexpected property was found in the WebExtension manifest.
Warning: attempting to write 4232 bytes to preference extensions.bootstrappedAddons. This is bad for general performance and memory usage. Such an amount of data should rather be written to an external file. This preference will not be sent to any content processes.
1510598483000 addons.xpi WARN Add-on https-everywhere-eff@eff.org is missing bootstrap method install
Warning: attempting to write 4484 bytes to preference extensions.bootstrappedAddons. This is bad for general performance and memory usage. Such an amount of data should rather be written to an external file. This preference will not be sent to any content processes.
Bootstrapped manifest not allowed to use 'component' directive. chrome.manifest:60
Bootstrapped manifest not allowed to use 'contract' directive. chrome.manifest:61
Bootstrapped manifest not allowed to use 'category' directive. chrome.manifest:63
Bootstrapped manifest not allowed to use 'overlay' directive. chrome.manifest:68
Bootstrapped manifest not allowed to use 'overlay' directive. chrome.manifest:69
Bootstrapped manifest not allowed to use 'style' directive. chrome.manifest:71
Bootstrapped manifest not allowed to use 'component' directive. chrome.manifest:74
Bootstrapped manifest not allowed to use 'contract' directive. chrome.manifest:75
Bootstrapped manifest not allowed to use 'category' directive. chrome.manifest:76
1510598486500 addons.webextension.{73a6fe31-595d-460b-a920-fcc0f8843232} WARN Loading extension '{73a6fe31-595d-460b-a920-fcc0f8843232}': Reading manifest: Error processing permissions.1: Unknown permission "privacy"
1510598486600 addons.webextension.https-everywhere-eff@eff.org WARN Loading extension 'https-everywhere-eff@eff.org': Reading manifest: Error processing devtools_page: An unexpected property was found in the WebExtension manifest.
1510598486800 addons.webextension.https-everywhere-eff@eff.org WARN Please specify whether you want browser_style or not in your browser_action options.
SyntaxError: The URI is malformed. (unknown)
[11-13 18:41:32] Torbutton NOTE: Initializing security-prefs.js
[11-13 18:41:32] Torbutton NOTE: security-prefs.js initialization complete
SyntaxError: The URI is malformed. (unknown)
Key event not available on some keyboard layouts: key=“r” modifiers=“accel,alt” id=“toggleReaderMode” browser.xul
Key event not available on GTK2: key=“u” modifiers=“accel shift” id=“torbutton-new-identity-key” browser.xul
Key event not available on some keyboard layouts: key=“i” modifiers=“accel,alt,shift” id=“key_browserToolbox” browser.xul
[11-13 18:41:47] Torbutton WARN: no SOCKS credentials found for current document.
Unix error 2 during operation open on file /home/amnesia/.tor-browser/profile.default/directoryLinks.json (No such file or directory) DirectoryLinksProvider.jsm:402
[11-13 18:42:06] Torbutton WARN: no SOCKS credentials found for current document.
Warning: attempting to write 4730 bytes to preference extensions.bootstrappedAddons. This is bad for general performance and memory usage. Such an amount of data should rather be written to an external file. This preference will not be sent to any content processes.
ping ping.js:1:1