Skip to content

Commit

Permalink
library_idbfs.js: Handle transaction.onabort in reconcile()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
past-due committed Feb 13, 2024
1 parent 0671dfc commit 6ceeab8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/library_idbfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 6ceeab8

Please sign in to comment.