fix event ordering
This commit is contained in:
parent
ef579c91a9
commit
579c9da58b
@ -801,7 +801,7 @@ export class BridgeIDBFactory {
|
|||||||
bubbles: false,
|
bubbles: false,
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
});
|
});
|
||||||
event2.eventPath = [request];
|
event2.eventPath = [];
|
||||||
request.dispatchEvent(event2);
|
request.dispatchEvent(event2);
|
||||||
} else if (existingVersion < requestedVersion) {
|
} else if (existingVersion < requestedVersion) {
|
||||||
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-steps-for-running-a-versionchange-transaction
|
// 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,
|
bubbles: false,
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
});
|
});
|
||||||
event2.eventPath = [request];
|
event2.eventPath = [];
|
||||||
request.dispatchEvent(event2);
|
request.dispatchEvent(event2);
|
||||||
} else {
|
} else {
|
||||||
const event2 = new FakeEvent("success", {
|
const event2 = new FakeEvent("success", {
|
||||||
bubbles: false,
|
bubbles: false,
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
});
|
});
|
||||||
event2.eventPath = [request];
|
event2.eventPath = [];
|
||||||
|
|
||||||
request.dispatchEvent(event2);
|
request.dispatchEvent(event2);
|
||||||
}
|
}
|
||||||
@ -1988,7 +1988,6 @@ export class BridgeIDBTransaction
|
|||||||
|
|
||||||
// Should this directly remove from _requests?
|
// Should this directly remove from _requests?
|
||||||
for (const { request } of this._requests) {
|
for (const { request } of this._requests) {
|
||||||
console.log("ready state:", request.readyState);
|
|
||||||
if (request.readyState !== "done") {
|
if (request.readyState !== "done") {
|
||||||
// This will cancel execution of this request's operation
|
// This will cancel execution of this request's operation
|
||||||
request.readyState = "done";
|
request.readyState = "done";
|
||||||
@ -2002,8 +2001,7 @@ export class BridgeIDBTransaction
|
|||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true,
|
cancelable: true,
|
||||||
});
|
});
|
||||||
event.eventPath = [request, this, this._db];
|
event.eventPath = [this._db, this];
|
||||||
console.log("dispatching error event for request after abort");
|
|
||||||
request.dispatchEvent(event);
|
request.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2149,7 +2147,7 @@ export class BridgeIDBTransaction
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
event.eventPath = [request, this, this._db];
|
event.eventPath = [this._db, this];
|
||||||
request.dispatchEvent(event);
|
request.dispatchEvent(event);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (BridgeIDBFactory.enableTracing) {
|
if (BridgeIDBFactory.enableTracing) {
|
||||||
@ -2211,7 +2209,7 @@ export class BridgeIDBTransaction
|
|||||||
console.log("dispatching 'complete' event on transaction");
|
console.log("dispatching 'complete' event on transaction");
|
||||||
}
|
}
|
||||||
const event = new FakeEvent("complete");
|
const event = new FakeEvent("complete");
|
||||||
event.eventPath = [this, this._db];
|
event.eventPath = [this._db, this];
|
||||||
this.dispatchEvent(event);
|
this.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user