Open Bug 1564415 Opened 3 months ago Updated 3 months ago

Add-on "Download Star" is harmed by browser.storage.local.set incompatibility

Categories

(Firefox :: Extension Compatibility, defect)

67 Branch
defect
Not set

Tracking

()

UNCONFIRMED

People

(Reporter: euthanasia_waltz, Unassigned)

Details

"Download Star" add-on(https://github.com/marklieberman/downloadstar) uses browser.storage.local api.
It works fine if extensions.webextensions.ExtensionStorageIDB.enabled is false.
However, it doesn't work well if extensions.webextensions.ExtensionStorageIDB.enabled is true.

Steps To Reproduce:

  1. Install "Download Star" add-on(https://addons.mozilla.org/en-US/firefox/addon/download-star/)
  2. Go to add-on's preference("Download Star Options"), check "Immediately save changes to controls in the popup"
  3. Click toolbar button of the add-on to open popup
  4. Check any items in "Built-in Filters"
  5. Close the popup and reopen it

Expected:
Checked items are still checked.

Actual:
Only "Image" is checked. (it is default settings)
This is because browser.storage.local.set breaks data, so next get() returns empty data, then default settings applied.

Broken data: vm.filters
Initialized at https://github.com/marklieberman/downloadstar/blob/master/src/popup/popup.js#L854

MediaFilters.forEach(filter => {
 Object.defineProperty(vm.filters, filter.type, {
   enumerable: true,
   get: () => filter.enabled,
   set: value => filter.enabled = value
 });
});

Saving code:
https://github.com/marklieberman/downloadstar/blob/master/src/popup/popup.js#L924

Loading code:
https://github.com/marklieberman/downloadstar/blob/master/src/popup/popup.js#L902

(I know
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/StorageArea/set

Some of these unsupported types will restore as an empty object

Test code to omit culprits: this works

function saveControls () {
 let filters = {};
 for (let key in vm.filters) {
   filters[key] = vm.filters[key];
 }
 return browser.storage.local.set({
   controls: vm.controls,
   filters: filters
 });
}

But this is unnecessary when extensions.webextensions.ExtensionStorageIDB.enabled=false.)

You need to log in before you can comment on or make changes to this bug.