refactor: replace webFrame.routingId with sync IPC (#47941)
* refactor: replace webFrame.routingId with sync IPC Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> * fix: GetConstructor missing isolate Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> * fix: missing isolate Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
This commit is contained in:
parent
d05f99ff4c
commit
74ad696f98
6 changed files with 88 additions and 42 deletions
|
@ -3,6 +3,7 @@ import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-util
|
|||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
|
||||
import { clipboard } from 'electron/common';
|
||||
import { webFrameMain } from 'electron/main';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
@ -109,3 +110,17 @@ ipcMainInternal.on(IPC_MESSAGES.BROWSER_PRELOAD_ERROR, function (event, preloadP
|
|||
if (event.type !== 'frame') return;
|
||||
event.sender?.emit('preload-error', event, preloadPath, error);
|
||||
});
|
||||
|
||||
ipcMainUtils.handleSync(IPC_MESSAGES.BROWSER_GET_FRAME_ROUTING_ID_SYNC, function (event, frameToken: string) {
|
||||
if (event.type !== 'frame') return;
|
||||
const senderFrame = event.senderFrame;
|
||||
if (!senderFrame || senderFrame.isDestroyed()) return;
|
||||
return webFrameMain.fromFrameToken(senderFrame.processId, frameToken)?.routingId;
|
||||
});
|
||||
|
||||
ipcMainUtils.handleSync(IPC_MESSAGES.BROWSER_GET_FRAME_TOKEN_SYNC, function (event, routingId: number) {
|
||||
if (event.type !== 'frame') return;
|
||||
const senderFrame = event.senderFrame;
|
||||
if (!senderFrame || senderFrame.isDestroyed()) return;
|
||||
return webFrameMain.fromId(senderFrame.processId, routingId)?.frameToken;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue