Closed Bug 1476268 Opened 6 years ago Closed 6 years ago

Fix uncaught storage.local IDBTransaction error on explicit IDBTransaction abort

Categories

(WebExtensions :: Storage, enhancement, P1)

enhancement

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Iteration:
63.3 - Aug 6
Tracking Status
firefox63 --- fixed

People

(Reporter: rpl, Assigned: rpl)

References

Details

Attachments

(1 file)

When an IDBTransaction is explicitly aborted [1] the transaction's promise is going to be an uncaught rejected error (also, the error property of the IDBTransaction is actually going to be null [2] when the transaction is explicitly aborted, and we are already raising the original error that is making the "set" method to reject the transaction and so we should catch and ignore the rejection on transaction's promise in that case).

Also related to that IDB transaction, the ExtensionStorageIDB's set method should wait explicitly that the transaction has been completed before returning (by explicitly await on the promise returned by the Transaction's promiseComplete method [3]).

[1]: using the abort() method, as we do inside the ExtensionStorageIDB's set method when we get an exception while storing a set of values inside the storage.local IndexedDB backend: https://searchfox.org/mozilla-central/rev/b0275bc977ad7fda615ef34b822bba938f2b16fd/toolkit/components/extensions/ExtensionStorageIDB.jsm#92
[2]: as also mentioned in the docs related to IDBTransaction.error on MDN https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/error
[3]: https://searchfox.org/mozilla-central/rev/b0275bc977ad7fda615ef34b822bba938f2b16fd/toolkit/modules/IndexedDB.jsm#252-254
Blocks: 1474562
Depends on: 1470213
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Priority: -- → P1
Comment on attachment 8992621 [details]
Bug 1476268 - Fix uncaught storage.local IDBTransaction error on explicit IDBTransaction abort.

https://reviewboard.mozilla.org/r/257498/#review264416

::: toolkit/components/extensions/ExtensionStorageIDB.jsm:222
(Diff revision 1)
> +          // We can ignore this rejection because we are aborting the transaction explicitly,
> +          // and so the transaction.error would be actually null, and we are already rejecting
> +          // the original error below.

We ignore this rejection because we are explicitly aborting the transaction, the transaction.error will be null, and we throw the original error below.
Attachment #8992621 - Flags: review?(mixedpuppy) → review+
Iteration: --- → 63.3 - Aug 6
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/5b6028970a75
Fix uncaught storage.local IDBTransaction error on explicit IDBTransaction abort. r=mixedpuppy
https://hg.mozilla.org/mozilla-central/rev/5b6028970a75
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Flags: qe-verify-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: