Open Bug 1577737 Opened 5 years ago Updated 2 years ago

WebExt browser.storage.local broken after Services.qms.clear()

Categories

(WebExtensions :: Storage, defect, P3)

defect

Tracking

(firefox69 affected, firefox70 affected, firefox71 affected)

Tracking Status
firefox69 --- affected
firefox70 --- affected
firefox71 --- affected

People

(Reporter: acat, Unassigned)

Details

In Tor Browser we currently call Services.qms.clear() (after temporarily switching on dom.quotaManager.testing pref) in order to clear asm.js caches, which at some point were not aware of Private Browsing Mode. When switching to ESR 68 we realized that this was breaking the browser.storage.local WebExtension API. This does not happen when using the old backend (extensions.webextensions.ExtensionStorageIDB.enabled = false).

Reproduced in Firefox 68:

  1. Create a new profile.
  2. Install NoScript from AMO.
  3. Set dom.quotaManager.testing pref to true.
  4. Call Services.qms.clear() in browser console.
  5. Set dom.quotaManager.testing pref to false.
  6. Open debug addon window for NoScript in about:debugging.
  7. Run browser.storage.local.set({foo:bar}), it throws InvalidStateError: A mutation operation was attempted on a database that did not allow mutations..

indexedDB itself seems to work fine in WebExtensions, so maybe Services.qms.clear() leaves the ExtensionStorageIDB in an invalid state?

Let's first see if this is a web extensions issue.

Component: DOM: Quota Manager → Storage
Product: Core → WebExtensions

clear() will break all open IndexedDB databases, so the database will need to be re-opened, yes. Tor is probably better off using the Sanitizer.jsm logic if you want to clear all storages rather than using a testing-only QuotaManager API. (Sanitizer will find out the origins in use and then clear the origin specifically. And QuotaManager supports clearing specific clients to boot.)

Flags: needinfo?(acat)

Hello,

The issue can be reproduced on the latest Nightly (71.0a1/20190910213950), Beta (70.0b5/20190909162732) and Release versions (69.0/20190827005903) by following the above STR under Windows 10 Pro 64-bit and macOS High Sierra 10.13.6.

Please note that the mentioned error (InvalidStateError: A mutation operation was attempted on a database that did not allow mutations.) is also thrown each time a new tab is opened after performing Step 4 and after running browser.storage.local.set({foo:bar}) without setting the mentioned pref (dom.quotaManager.testing) back to false (as per Step 5).

Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → Trunk

I'm not sure it's appropriate to mark any versions of Firefox as affected. The steps to reproduce from comment 0 involve enabling an explicitly test-only pref. It's expected that this breaks everything.

Thanks, we will try Sanitizer.jsm. Not sure if the bug should be closed as the steps to reproduce seem to be not supported. Feel free to do so if you think that's the case.

Flags: needinfo?(acat)

The priority flag is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Priority: -- → P3
Flags: needinfo?(jmathies)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.