Skip to content

Commit 5496e3a

Browse files
Bevis Tsengjgraham
Bevis Tseng
authored andcommitted
Support the 'close' Event on Databases.
Outline of this patch: 1. Define a new ipdl message called |CloseAfterInvalidationComplete| to trigger the close event after all transactions are complete only if the database is invalidated by the user agent. 2. Make sure the following event sequence is consistent during invalidation according to the steps in |5.2. Closing a database| by the following 2 solutions: IDBRequest.onerror -> IDBTransaction.onerror -> IDBTransaction.onabort -> IDBDatabase.onclose. 2.1. In parent process, do not force to abort the transactions after invalidation but wait for all the transactions in its child process are complete. 2.2. In child process, make sure that each IDBTransaction will notify its completion to the parent after all its pending IDBRequests are finished. 3. Add test_database_onclose.js to test the close event especially when read/write operation is ongoing. 4. Add test_database_close_without_onclose.js as a XPCShell test because setTimeout() is not preferred in Mochitest to ensure that the IDBDatabase.onclose event won't be sent after closed normally. Upstreamed from https://bugzilla.mozilla.org/show_bug.cgi?id=1151017
1 parent 209d6f0 commit 5496e3a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

IndexedDB/interfaces.idl

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ interface IDBDatabase : EventTarget {
8383
IDBTransaction transaction ((DOMString or sequence<DOMString>) storeNames, optional IDBTransactionMode mode = "readonly");
8484
void close ();
8585
attribute EventHandler onabort;
86+
attribute EventHandler onclose;
8687
attribute EventHandler onerror;
8788
attribute EventHandler onversionchange;
8889
};

0 commit comments

Comments
 (0)