From 5e18378df7491b4cc45f7c4858fccb9593e7f20c Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 16 Apr 2020 10:59:27 -0700 Subject: [PATCH] fix(webkit): do not access mainFrame when initialization has failed (#1825) --- src/webkit/wkPage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webkit/wkPage.ts b/src/webkit/wkPage.ts index 94d126e071..03b21bc110 100644 --- a/src/webkit/wkPage.ts +++ b/src/webkit/wkPage.ts @@ -262,7 +262,7 @@ export class WKPage implements PageDelegate { } if (targetInfo.isPaused) this._pageProxySession.send('Target.resume', { targetId: targetInfo.targetId }).catch(debugError); - if (this._page.mainFrame().url() === '') { + if ((pageOrError instanceof Page) && this._page.mainFrame().url() === '') { // Initial empty page has an empty url. We should wait until the first real url has been loaded, // even if that url is about:blank. This is especially important for popups, where we need the // actual url before interacting with it.