From 6e0bb2585e795bc3dc4e611679cf5fd2e4881f54 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 23 Dec 2019 10:40:34 -0800 Subject: [PATCH] fix(wk): wait for bootstrap scripts command response (#328) --- src/webkit/wkFrameManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webkit/wkFrameManager.ts b/src/webkit/wkFrameManager.ts index 9a0d89a343..9308ee2bc0 100644 --- a/src/webkit/wkFrameManager.ts +++ b/src/webkit/wkFrameManager.ts @@ -71,7 +71,7 @@ export class WKFrameManager implements PageDelegate { // New bootstrap scripts may have been added during provisional load, push them // again to be on the safe side. if (this._setBootstrapScripts.length) - this._setBootstrapScripts(session); + this._setBootstrapScripts(session).catch(e => debugError(e)); } // This method is called for provisional targets as well. The session passed as the parameter @@ -100,7 +100,7 @@ export class WKFrameManager implements PageDelegate { if (contextOptions.javaScriptEnabled === false) promises.push(session.send('Emulation.setJavaScriptEnabled', { enabled: false })); if (this._setBootstrapScripts.length && session.isProvisional()) - this._setBootstrapScripts(session); + promises.push(this._setBootstrapScripts(session)); if (contextOptions.bypassCSP) promises.push(session.send('Page.setBypassCSP', { enabled: true })); if (this._page._state.extraHTTPHeaders !== null)