launcher: fix IPC parsing

This commit is contained in:
CanadaHonk 2022-12-18 12:55:03 +00:00
parent 3a9a4e4e95
commit df5ffa7e83

View File

@ -3,7 +3,7 @@ import IPCApi from '../lib/ipc.js';
export default async (CDP, injectionType = 'browser', { browserName }) => {
let pageLoadCallback = () => {}, onWindowMessage = () => {};
CDP.onMessage(msg => {
if (msg.method === 'Runtime.bindingCalled' && msg.name === '_gluonSend') onWindowMessage(JSON.parse(msg.payload));
if (msg.method === 'Runtime.bindingCalled' && msg.name === '_gluonSend') onWindowMessage(JSON.parse(msg.params.payload));
if (msg.method === 'Page.frameStoppedLoading') pageLoadCallback(msg.params);
if (msg.method === 'Runtime.executionContextCreated') injectIPC(); // ensure IPC injection again
});