@@ -32,6 +32,13 @@ lifecycle event returns. WebScene consequently removed the only task that
3232could start the IndexedDB write and observed no terminal persistence work, so
3333` pagehide ` and reload handoff proceeded immediately.
3434
35+ After retaining that callback, repeated installed-package runs exposed the
36+ second half of the shutdown race. VS Code also closes its storage database from
37+ a shutdown microtask before the retained timer starts. One run passed in
38+ 16.204 seconds, while the next failed in 25.623 seconds with the key present
39+ before reload and absent after reopening; the failed log reported that
40+ ` vscode-web-db ` was closed.
41+
3542A focused native fixture reproduces the exact order. Before the fix it reports:
3643
3744``` text
@@ -49,6 +56,12 @@ WebScene retains the accepted callback privately until the handoff boundary.
4956Its microtasks, zero-delay descendants, and IndexedDB operations inherit the
5057same bounded terminal ancestry.
5158
59+ If ` IDBDatabase.close() ` runs from that same lifecycle turn while accepted
60+ terminal persistence remains, the compatibility layer queues the close behind
61+ the retained flush. The database still closes before ` pagehide ` and host
62+ handoff. Calls made outside this narrow terminal condition keep synchronous
63+ close semantics.
64+
5265This terminal-only durability rule is intentionally narrower than ordinary
5366timer cancellation. Timers created outside terminal lifecycle, delayed timers,
5467intervals, animation frames, and work beyond the 1,024-task budget keep their
@@ -65,7 +78,8 @@ WEBSCENE_NATIVE_ENGINE_TEST_FILTER=terminal-indexeddb-navigation \
6578```
6679
6780Result on macOS arm64 Release: pass. The durable transaction-to-handoff gate
68- completed in 0.0036 seconds. The fixture also covers restart durability,
81+ completed in 0.0037 seconds. The fixture also covers a shutdown-microtask
82+ database close before the retained flush, restart durability,
6983pre-existing IndexedDB work, exact lifecycle order, ordinary cancellation,
7084future timers, intervals, native completion descendants, and the bounded
7185self-refilling-task ceiling.
0 commit comments