launcher: fix more IPC parsing
This commit is contained in:
parent
df5ffa7e83
commit
66d3cb2a30
@ -3,7 +3,7 @@ import IPCApi from '../lib/ipc.js';
|
|||||||
export default async (CDP, injectionType = 'browser', { browserName }) => {
|
export default async (CDP, injectionType = 'browser', { browserName }) => {
|
||||||
let pageLoadCallback = () => {}, onWindowMessage = () => {};
|
let pageLoadCallback = () => {}, onWindowMessage = () => {};
|
||||||
CDP.onMessage(msg => {
|
CDP.onMessage(msg => {
|
||||||
if (msg.method === 'Runtime.bindingCalled' && msg.name === '_gluonSend') onWindowMessage(JSON.parse(msg.params.payload));
|
if (msg.method === 'Runtime.bindingCalled' && msg.params.name === '_gluonSend') onWindowMessage(JSON.parse(msg.params.payload));
|
||||||
if (msg.method === 'Page.frameStoppedLoading') pageLoadCallback(msg.params);
|
if (msg.method === 'Page.frameStoppedLoading') pageLoadCallback(msg.params);
|
||||||
if (msg.method === 'Runtime.executionContextCreated') injectIPC(); // ensure IPC injection again
|
if (msg.method === 'Runtime.executionContextCreated') injectIPC(); // ensure IPC injection again
|
||||||
});
|
});
|
||||||
@ -27,7 +27,6 @@ export default async (CDP, injectionType = 'browser', { browserName }) => {
|
|||||||
log('browser:', browserInfo.product);
|
log('browser:', browserInfo.product);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CDP.sendMessage('Runtime.enable', {}, sessionId); // enable runtime API
|
CDP.sendMessage('Runtime.enable', {}, sessionId); // enable runtime API
|
||||||
|
|
||||||
CDP.sendMessage('Runtime.addBinding', { // setup sending from window to Node via Binding
|
CDP.sendMessage('Runtime.addBinding', { // setup sending from window to Node via Binding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user