ipc: no longer require own load promise
This commit is contained in:
parent
5a965bf40a
commit
c6c5cc935d
@ -109,7 +109,6 @@ export default async (CDP, proc, injectionType = 'browser', { dataPath, browserN
|
|||||||
browserType
|
browserType
|
||||||
}, {
|
}, {
|
||||||
evalInWindow,
|
evalInWindow,
|
||||||
frameLoadPromise,
|
|
||||||
evalOnNewDocument: source => CDP.sendMessage('Page.addScriptToEvaluateOnNewDocument', { source }, sessionId)
|
evalOnNewDocument: source => CDP.sendMessage('Page.addScriptToEvaluateOnNewDocument', { source }, sessionId)
|
||||||
});
|
});
|
||||||
onWindowMessage = ipcMessageCallback;
|
onWindowMessage = ipcMessageCallback;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default ({ browserName, browserInfo, browserType }, { evalInWindow, evalOnNewDocument, pageLoadPromise }) => {
|
export default ({ browserName, browserInfo, browserType }, { evalInWindow, evalOnNewDocument }) => {
|
||||||
const injection = `(() => {
|
const injection = `(() => {
|
||||||
if (window.Gluon) return;
|
if (window.Gluon) return;
|
||||||
let onIPCReply = {}, ipcListeners = {};
|
let onIPCReply = {}, ipcListeners = {};
|
||||||
@ -133,7 +133,6 @@ delete window._gluonSend;
|
|||||||
const isReply = !!id;
|
const isReply = !!id;
|
||||||
id = id ?? Math.random().toString().split('.')[1];
|
id = id ?? Math.random().toString().split('.')[1];
|
||||||
|
|
||||||
await pageLoadPromise; // wait for page to load before sending, otherwise messages won't be heard
|
|
||||||
evalInWindow(`window.Gluon.ipc._receive(${JSON.stringify({
|
evalInWindow(`window.Gluon.ipc._receive(${JSON.stringify({
|
||||||
id,
|
id,
|
||||||
type,
|
type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user