[Webkit-unassigned] [Bug 222746] IDBTransaction is closed prematurely if a microtask is awaited after opening the transaction under some circumstances

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 8 11:00:35 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=222746

--- Comment #3 from Chris Dumez <cdumez at apple.com> ---
Interesting part of the repro case:
```
            try {
                const db = await openDatabase(dbName, db => {
                    db.createObjectStore("test", {keyPath: "key"});
                }, 1);
                const readTxn = db.transaction(["test"], "readonly");
                await reqAsPromise(readTxn.objectStore("test").get("somekey"));
                // schedule a macro task in between the two txns
                await new Promise(r => setTimeout(r, 0));
                const writeTxn = db.transaction(["test"], "readwrite");
                await Promise.resolve();
                writeTxn.objectStore("test").add({key: "somekey", value: "foo"});
                await txnAsPromise(writeTxn);
            } catch (err) {
                if (err.name === "TransactionInactiveError") {
                    return true; // BUG
                }
```

So it looks like whenIdle called our lambda before the call to:
writeTxn.objectStore("test").add()

Calling our lambda deactivated the writeTxn, which is why we reject the promise with a TransactionInactiveError.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210308/b1d8f302/attachment.htm>


More information about the webkit-unassigned mailing list