From 4d24e0db4315bf30f708cd2a8cb07338f27e4d39 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:20:45 -0500 Subject: [PATCH] library_idbfs.js: Also use e.target.error for transaction.onerror --- src/library_idbfs.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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) => {