[Webkit-unassigned] [Bug 216769] Indexed DB transactions outdated immediately after it just created

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 23 09:59:03 PDT 2020


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

--- Comment #6 from Sihui Liu <sihui_liu at apple.com> ---
(In reply to Sihui Liu from comment #5)
> (In reply to zjwpeter from comment #4)
> > Hi I understand this idea of transaction auto commits.
> > You can see I use a function to check if the transaction has been outdated
> > every time before I start a transaction operation.
> > My check do work, if the transaction has been outdated, it will create a new
> > transaction immediately.
> > 
> > After the new transaction created there is no any synchronous operation, on
> > the chrome and Firefox, this work well. But on the safari it seems like it
> > is possible that the transaction is outdated immediately just after it has
> > been created.
> > 
> > Please carefully check my example again, I didn't include a wrong usage of
> > indexed DB transaction.
> 
> ah sorry, I misunderstood your question. You meant 
> await transaction.store.add({ a: 1 }, 'c')
> fails as newly created transaction by beforeTx() is inactive. This seems a
> real bug.
> 
> Specifically, we are deactivating transaction when vm is idle:
> vm.whenIdle([protectedThis = makeRef(*this)]() {
>     protectedThis->deactivate();
> });
> 
> I don't know why we need this, changelog does not provide explanation
> either: https://trac.webkit.org/changeset/198762/webkit. Maybe we should
> remove this.

Another look at the spec today, https://w3c.github.io/IndexedDB/#transaction-inactive
says transaction is inactive when control returns to event loop. For this test case, IIUC, transaction being and records being added are two tasks, i.e. execute JS -> JS VM idle(deactivating transaction) -> execute JS... in this perspective, it seems right to deactivate the transaction :|. @Brady may know more as he initially added this.

-- 
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/20200923/1bac3b74/attachment.htm>


More information about the webkit-unassigned mailing list