diff options
author | Florian Dold <florian@dold.me> | 2021-02-16 15:07:23 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-02-16 15:07:23 +0100 |
commit | 579c9da58b4bc0cacf713bb64c92d13045adb29b (patch) | |
tree | f015d774ed0a168d07273f7001dd2fe52ec4ceef /packages | |
parent | ef579c91a96b1c84cee65dc43e0420b25575c0e4 (diff) |
fix event ordering
Diffstat (limited to 'packages')
-rw-r--r-- | packages/idb-bridge/src/bridge-idb.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/idb-bridge/src/bridge-idb.ts b/packages/idb-bridge/src/bridge-idb.ts index 21c335b36..2bfb01793 100644 --- a/packages/idb-bridge/src/bridge-idb.ts +++ b/packages/idb-bridge/src/bridge-idb.ts @@ -801,7 +801,7 @@ export class BridgeIDBFactory { bubbles: false, cancelable: false, }); - event2.eventPath = [request]; + event2.eventPath = []; request.dispatchEvent(event2); } else if (existingVersion < requestedVersion) { // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-steps-for-running-a-versionchange-transaction @@ -867,14 +867,14 @@ export class BridgeIDBFactory { bubbles: false, cancelable: false, }); - event2.eventPath = [request]; + event2.eventPath = []; request.dispatchEvent(event2); } else { const event2 = new FakeEvent("success", { bubbles: false, cancelable: false, }); - event2.eventPath = [request]; + event2.eventPath = []; request.dispatchEvent(event2); } @@ -1988,7 +1988,6 @@ export class BridgeIDBTransaction // Should this directly remove from _requests? for (const { request } of this._requests) { - console.log("ready state:", request.readyState); if (request.readyState !== "done") { // This will cancel execution of this request's operation request.readyState = "done"; @@ -2002,8 +2001,7 @@ export class BridgeIDBTransaction bubbles: true, cancelable: true, }); - event.eventPath = [request, this, this._db]; - console.log("dispatching error event for request after abort"); + event.eventPath = [this._db, this]; request.dispatchEvent(event); } } @@ -2149,7 +2147,7 @@ export class BridgeIDBTransaction }); try { - event.eventPath = [request, this, this._db]; + event.eventPath = [this._db, this]; request.dispatchEvent(event); } catch (err) { if (BridgeIDBFactory.enableTracing) { @@ -2211,7 +2209,7 @@ export class BridgeIDBTransaction console.log("dispatching 'complete' event on transaction"); } const event = new FakeEvent("complete"); - event.eventPath = [this, this._db]; + event.eventPath = [this._db, this]; this.dispatchEvent(event); } |