From 4b63c83d077b018915ea458dc74c12611e03b021 Mon Sep 17 00:00:00 2001 From: CanadaHonk Date: Sun, 8 Jan 2023 10:58:20 +0000 Subject: [PATCH] launcher: try catch IPC inject on new execution context --- src/launcher/inject.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/launcher/inject.js b/src/launcher/inject.js index 79c6104..67f2be0 100644 --- a/src/launcher/inject.js +++ b/src/launcher/inject.js @@ -10,7 +10,11 @@ export default async (CDP, proc, injectionType = 'browser', { browserName } = { if (msg.method === 'Runtime.bindingCalled' && msg.params.name === '_gluonSend') onWindowMessage(JSON.parse(msg.params.payload)); if (msg.method === 'Page.frameStoppedLoading') frameLoadCallback(msg.params); if (msg.method === 'Page.loadEventFired') pageLoadCallback(); - if (msg.method === 'Runtime.executionContextCreated') injectIPC(); // ensure IPC injection again + if (msg.method === 'Runtime.executionContextCreated') { + try { + injectIPC(); // ensure IPC injection again + } catch { } + } }); const browserInfo = await CDP.sendMessage('Browser.getVersion');