From e16cbc6626cffd40d0caa30801620e7293455006 Mon Sep 17 00:00:00 2001 From: ggorlen Date: Wed, 1 Feb 2023 00:10:02 -0800 Subject: [PATCH] fix: restore WaitTask terminate condition (#9612) --- packages/puppeteer-core/src/common/WaitTask.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/puppeteer-core/src/common/WaitTask.ts b/packages/puppeteer-core/src/common/WaitTask.ts index 720f7e64d35..f08d69368c0 100644 --- a/packages/puppeteer-core/src/common/WaitTask.ts +++ b/packages/puppeteer-core/src/common/WaitTask.ts @@ -177,10 +177,11 @@ export class WaitTask { async terminate(error?: unknown): Promise { this.#world.taskManager.delete(this); + if (this.#timeout) { + clearTimeout(this.#timeout); + } + if (error && !this.#result.finished()) { - if (this.#timeout) { - clearTimeout(this.#timeout); - } this.#result.reject(error); }