From 26479119b6de2b18b350a95d61d765c644cd8f4b Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 13 Mar 2020 13:09:06 -0700 Subject: [PATCH] fix(setContent): handle inner _waitForLoadState rejection (#1382) --- src/frames.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frames.ts b/src/frames.ts index c2e508ea6c..7740a27695 100644 --- a/src/frames.ts +++ b/src/frames.ts @@ -635,11 +635,11 @@ export class Frame { async setContent(html: string, options?: types.NavigateOptions): Promise { const tag = `--playwright--set--content--${this._id}--${++this._setContentCounter}--`; const context = await this._utilityContext(); - const lifecyclePromise = new Promise(resolve => { + const lifecyclePromise = new Promise((resolve, reject) => { this._page._frameManager._consoleMessageTags.set(tag, () => { // Clear lifecycle right after document.open() - see 'tag' below. this._page._frameManager.clearFrameLifecycle(this); - resolve(this._waitForLoadState(options)); + this._waitForLoadState(options).then(resolve).catch(reject); }); }); const contentPromise = context.evaluate((html, tag) => {