Skip to content

Broken filter storage in Firefox private mode

Environment

  • Browser and full version: Firefox 100.0
  • Extension using this toolkit: test-mv2
  • Commit hash: d9f77593

Steps to reproduce

  1. Open about:preferences#privacy.
  2. In the History section, select "Use custom settings for history" and select "Always use private browsing mode".
    Note: Selecting "Never remember history" should have the same effect.
  3. Install test-mv2 extension.
  4. Go to about:addons and click on the test extension list item.
  5. Change "Run in Private Windows" to "Allow".
  6. Run await EWE.filters.add(["foooo"]).
  7. Run await EWE.filters.getUserFilters().
  8. Reload the test extension.
  9. Run await EWE.filters.getUserFilters().

Actual behavior

  • After 5) Below error is shown in background page JavaScript console.
  • After 7) Returns an array with one filter object in it.
  • After 8) Below error is shown in background page JavaScript console.
  • After 9) Returns an empty array.
Uncaught (in promise) DOMException: A mutation operation was attempted on a database that did not allow mutations. idb.js:40
    onerror idb.js:40
    (Async: EventHandlerNonNull)
    openDatabase idb.js:40
    openDatabase idb.js:29
    initializationPromise idb.js:49
    init idb.js:60
    start initializer.js:57
    startAsyncModule initializer.js:29
    startupPromise initializer.js:57
    start initializer.js:63
    start index.js:105
    startAsyncModule index.js:67
    start index.js:105
    <anonymous> background.js:170

Expected behavior

  • After 5) No error is shown in background page JavaScript console.
  • After 7) Returns an array with one filter object in it.
  • After 8) No error is shown in background page JavaScript console.
  • After 9) Returns an array with one filter object in it.

Further information

This problem has been observed by multiple Adblock Plus users following the release of its first version that's based on EWE. There are indications that problems with extensions using IndexedDB while in "always private mode" has already been around for years (see Reddit thread). Therefore this regression may have been introduced by the decision to use IndexedDB for storing filter data in EWE, which used to be stored via browser.storage.local in previous versions.

Edited by Thomas Greiner