Dexie.js: Transaction fails if console dev-tools opened (Firefox 67)

Created on 18 Apr 2019  路  3Comments  路  Source: dfahlander/Dexie.js

Hi,

We discovered an issue which involves Dexie/IndexedDB on Firefox 67 (upcoming release). It is not clear if the issue is from Firefox or IndexedDB or Dexie or a combination. We currently could not reproduce the same issue with IndexedDB only so we did not rule-out the possibility of Dexie playing a role. The following WebExtension is enough to reproduce:

import Dexie from 'dexie';

setTimeout(() => {
  const db = new Dexie('test_db');
  db.version(1).stores({ test_table: 'test_key' });
  db.transaction('rw', db.test_table, () => db.test_table.toArray().then(console.log).catch(console.error));
}, 8000);

The delay of 8 seconds is meant to give time to open the dev-tools/console in about:debugging, which is necessary to trigger the issue. This same code has two outcomes, depending on if the dev-tools were opened before this timeout runs:

  • dev-tools opened:
{
  "_e": {},
  "name": "InvalidStateError",
  "message": "An attempt was made to use an object that is not, or is no longer, usable",
  "inner": {},
}
  • dev-tools closed: the transaction succeeds and [] is printed (empty collection)

We put together a repository with detailed steps to easily reproduce this issue locally: https://github.com/remusao/firefox-67-idb-bug-repro

We also opened a ticket on Firefox's bug-tracker, but thought that this might be of interest for the developers of Dexie: https://bugzilla.mozilla.org/show_bug.cgi?id=1545400

Some further observations:

  • This issue appears only in Firefox 67, and not in Firefox 66 or below
  • This issue appears with both Dexie 2.0.7 as well as 3.0.0 alpha
  • This issue appears only when dev tools for the extension are opened
  • This issue does not appear when dev tools are closed
  • This issue does not appear when browser console is open (only when the
    extension dev tool console is)
  • We could not reproduce with a pure-IndexedDB example
  • We did not try to reproduce with a web-page example (only webextension)

Thanks for the great library!

_Edit_: We were also able to reproduce this issue from a single web-page, which allows any site to detect if dev-tools are opened or closed: https://cdn.cliqz.com/browser-f/fun-demo/firefox_devtools.html

Most helpful comment

@sechel We have opened an issue on bugzilla here: https://bugzilla.mozilla.org/show_bug.cgi?id=1545400. The investigation is currently in progress.

All 3 comments

I also see this, pretty annoying, is there an issue at https://bugzilla.mozilla.org/home?

@sechel We have opened an issue on bugzilla here: https://bugzilla.mozilla.org/show_bug.cgi?id=1545400. The investigation is currently in progress.

Loos like a fix for that will ship with Firefox 69 - thanks for filing the bugzilla ticket!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfahlander picture dfahlander  路  4Comments

ghost picture ghost  路  3Comments

ballabusta picture ballabusta  路  4Comments

asdip138 picture asdip138  路  3Comments

CasperPas picture CasperPas  路  3Comments