chore: remove extra function

This commit is contained in:
Nikolay Vitkov 2024-04-23 15:53:08 +02:00
parent e8204fc2f0
commit 3bbcab5564

View File

@ -223,8 +223,10 @@ export class LifecycleWatcher {
}
#checkLifecycleComplete(): void {
if (!checkLifecycle(this.#frame, this.#expectedLifecycle)) {
return;
for (const event of this.#expectedLifecycle) {
if (!this.#frame._lifecycleEvents.has(event)) {
return;
}
}
this.#lifecycleDeferred.resolve();
@ -234,19 +236,6 @@ export class LifecycleWatcher {
if (this.#swapped || this.#frame._loaderId !== this.#initialLoaderId) {
this.#newDocumentNavigationDeferred.resolve(undefined);
}
function checkLifecycle(
frame: CdpFrame,
expectedLifecycle: ProtocolLifeCycleEvent[]
): boolean {
for (const event of expectedLifecycle) {
if (!frame._lifecycleEvents.has(event)) {
return false;
}
}
return true;
}
}
dispose(): void {