From 6ceeab8d26753fd3c39edff8b9b658e84c4abfee Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:45:10 -0500 Subject: [PATCH] library_idbfs.js: Handle transaction.onabort in reconcile() If the transaction aborts (which can happen due to, for example, a QuotaExceededError), `onabort` must be handled to ensure that the `callback` actually gets called. --- src/library_idbfs.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/library_idbfs.js b/src/library_idbfs.js index 7a670928aab6d..afcdc5ed02ac1 100644 --- a/src/library_idbfs.js +++ b/src/library_idbfs.js @@ -280,6 +280,12 @@ addToLibrary({ } }; + // transaction may abort if (for example) there is a QuotaExceededError + transaction.onabort = (e) => { + done(event.target.error); // DOMException + e.preventDefault(); + }; + // sort paths in ascending order so directory entries are created // before the files inside them create.sort().forEach((path) => {