From 3bbcab55649766fd3271fefb49ca6cede25c39c7 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov Date: Tue, 23 Apr 2024 15:53:08 +0200 Subject: [PATCH] chore: remove extra function --- .../src/cdp/LifecycleWatcher.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/puppeteer-core/src/cdp/LifecycleWatcher.ts b/packages/puppeteer-core/src/cdp/LifecycleWatcher.ts index 48b2b18a6e4..d75022c0516 100644 --- a/packages/puppeteer-core/src/cdp/LifecycleWatcher.ts +++ b/packages/puppeteer-core/src/cdp/LifecycleWatcher.ts @@ -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 {