Tor Browser 12.0.3 broke img2tab

Report or discuss any bugs that you might encounter
Post Reply
loveimg2tab
Posts: 1
Joined: Sun Mar 12, 2023 12:55 pm

Tor Browser 12.0.3 broke img2tab

Post by loveimg2tab »

The Tor developers changed webextensions.storage.sync.enabled to false by default in Tor Browser 12.0.3 (released February 15, 2023).

This change breaks img2tab.

You can work around this by going to about:config and changing webextensions.storage.sync.enabled to true

Details:

The Tor developers changed webextensions.storage.sync.enabled to false "to eliminate 3 files from the profile folder". They reverted it because it broke the NoScript extensions, but NoScript changed their code to support sync being disabled, so the Tor developers set webextensions.storage.sync.enabled to false again.
NoScript fixed their issue by using browser.storage.local if browser.storage.sync is unavailable:
The bug in img2tab.js:

Code: Select all

//Handle options
var globalOptions;
model.storage.sync.get({
	tabBackgroundColor: '#000000',
	tabForegroundColor: '#FFFFFF',
	ignoreThumbs: false,
	instagramHighQuality: true,
	urlRegexMatch: null,
	urlRegexReplace: null
}, function(options) {
	globalOptions = options;
});
Because sync is disabled, the call to browser.storage.sync.get() fails and does not call the callback. globalOptions is left undefined

When the user chooses from the img2tab context menu, this sends a message to the img2tab.js listener which then calls getImages() or getLinkedImages(), which then call processUrls(), which then accesses globalOptions as an object, but globalOptions is undefined. Boom, exception

Browser console logs:

Code: Select all

Unchecked lastError value: Error: globalOptions is undefined [background.js:66]
    onExplodeLinkedImagesClick moz-extension://6b1346b6-3947-4396-83a2-2890956adf36/background.js:66

payload is undefined [background.js:157]
    urlsToTabbedWindow moz-extension://6b1346b6-3947-4396-83a2-2890956adf36/background.js:157
    onExplodeLinkedImagesClick moz-extension://6b1346b6-3947-4396-83a2-2890956adf36/background.js:67
Post Reply