fix(setContent): handle inner _waitForLoadState rejection (#1382)

This commit is contained in:
Dmitry Gozman 2020-03-13 13:09:06 -07:00 committed by GitHub
parent 601d57a300
commit 26479119b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -635,11 +635,11 @@ export class Frame {
async setContent(html: string, options?: types.NavigateOptions): Promise<void> {
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) => {