aboutsummaryrefslogtreecommitdiff
path: root/packages/idb-bridge
diff options
context:
space:
mode:
Diffstat (limited to 'packages/idb-bridge')
-rw-r--r--packages/idb-bridge/src/bridge-idb.ts11
-rw-r--r--packages/idb-bridge/src/idb-wpt-ported/event-dispatch-active-flag.test.ts8
-rw-r--r--packages/idb-bridge/src/testingdb.ts2
3 files changed, 15 insertions, 6 deletions
diff --git a/packages/idb-bridge/src/bridge-idb.ts b/packages/idb-bridge/src/bridge-idb.ts
index f3749c77c..1f9aa7f4b 100644
--- a/packages/idb-bridge/src/bridge-idb.ts
+++ b/packages/idb-bridge/src/bridge-idb.ts
@@ -2471,6 +2471,8 @@ export class BridgeIDBTransaction
return this._committed || this._aborted;
}
+ _counter = 0;
+
_openRequest: BridgeIDBOpenDBRequest | null = null;
_backendTransaction?: DatabaseTransaction;
@@ -2745,7 +2747,14 @@ export class BridgeIDBTransaction
// with error handling already built into operation
await operation();
} else {
- await waitMacroQueue();
+ this._counter++;
+ if (this._counter > 100) {
+ this._counter = 0;
+ // Give a chance for macro tasks to do something
+ // If we don't do this at all, we break WPT tests.
+ // If we always wait, performance is bad.
+ await waitMacroQueue();
+ }
let event;
try {
diff --git a/packages/idb-bridge/src/idb-wpt-ported/event-dispatch-active-flag.test.ts b/packages/idb-bridge/src/idb-wpt-ported/event-dispatch-active-flag.test.ts
index e57b48f76..1d895c712 100644
--- a/packages/idb-bridge/src/idb-wpt-ported/event-dispatch-active-flag.test.ts
+++ b/packages/idb-bridge/src/idb-wpt-ported/event-dispatch-active-flag.test.ts
@@ -9,7 +9,7 @@ import {
test.before("test DB initialization", initTestIndexedDB);
-test("WPT test abort-in-initial-upgradeneeded.htm (subtest 1)", async (t) => {
+test("WPT test event-dispatch-active-flag.html (subtest 1)", async (t) => {
// Transactions are active during success handlers
await indexeddb_test(
t,
@@ -57,7 +57,7 @@ test("WPT test abort-in-initial-upgradeneeded.htm (subtest 1)", async (t) => {
);
});
-test("WPT test abort-in-initial-upgradeneeded.htm (subtest 2)", async (t) => {
+test("WPT test event-dispatch-active-flag.html (subtest 2)", async (t) => {
// Transactions are active during success listeners
await indexeddb_test(
t,
@@ -103,7 +103,7 @@ test("WPT test abort-in-initial-upgradeneeded.htm (subtest 2)", async (t) => {
);
});
-test("WPT test abort-in-initial-upgradeneeded.htm (subtest 3)", async (t) => {
+test("WPT test event-dispatch-active-flag.html (subtest 3)", async (t) => {
// Transactions are active during error handlers
await indexeddb_test(
t,
@@ -152,7 +152,7 @@ test("WPT test abort-in-initial-upgradeneeded.htm (subtest 3)", async (t) => {
);
});
-test("WPT test abort-in-initial-upgradeneeded.htm (subtest 4)", async (t) => {
+test("WPT test event-dispatch-active-flag.html (subtest 4)", async (t) => {
// Transactions are active during error listeners
await indexeddb_test(
t,
diff --git a/packages/idb-bridge/src/testingdb.ts b/packages/idb-bridge/src/testingdb.ts
index c6abffa0f..6c13979ca 100644
--- a/packages/idb-bridge/src/testingdb.ts
+++ b/packages/idb-bridge/src/testingdb.ts
@@ -31,7 +31,7 @@ export async function initTestIndexedDB(): Promise<void> {
});
idbFactory = new BridgeIDBFactory(backend);
- backend.enableTracing = true;
+ backend.enableTracing = false;
BridgeIDBFactory.enableTracing = false;
}