diff --git a/src/library_idbfs.js b/src/library_idbfs.js index be6f0a0185b1..3f482866b53d 100644 --- a/src/library_idbfs.js +++ b/src/library_idbfs.js @@ -269,8 +269,9 @@ addToLibrary({ } }; - transaction.onerror = (e) => { - done(this.error); + // transaction may abort if (for example) there is a QuotaExceededError + transaction.onerror = transaction.onabort = (e) => { + done(e.target.error); e.preventDefault(); }; @@ -280,12 +281,6 @@ addToLibrary({ } }; - // transaction may abort if (for example) there is a QuotaExceededError - transaction.onabort = (e) => { - done(e.target.error); // DOMException - e.preventDefault(); - }; - // sort paths in ascending order so directory entries are created // before the files inside them create.sort().forEach((path) => {