This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29049 - Queue a microtask to unset active on transaction
Summary: Queue a microtask to unset active on transaction
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-10 08:52 UTC by Jake Archibald
Modified: 2015-08-10 16:57 UTC (History)
4 users (show)

See Also:


Attachments

Description Jake Archibald 2015-08-10 08:52:50 UTC
When a transaction is created, 'active' is unset when control is returned to the event loop http://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction (8).

When onsuccess is fired, 'active' is unset once the event has dispatched http://w3c.github.io/IndexedDB/#fire-a-success-event (4).

If both of these were "queue a microtask to unset 'active'", it would be more consistent and allow promise-based APIs to interact with IDB.

Currently, building an abstraction like this is impossible:

beginTransaction();
getValue('foo').then(function(val) {
  console.log(val);
  return setValue(val)
});

Assuming `getValue` returns a compliant promise, `setValue` fails as the transaction is inactive.
Comment 1 Joshua Bell 2015-08-10 16:57:50 UTC
Moved to https://github.com/w3c/IndexedDB/issues/27