refactor: replace webFrame.routingId with sync IPC (#47717)
* refactor: replace webFrame.routingId with sync IPC * fix: GetConstructor missing isolate * fix: missing isolate
This commit is contained in:
parent
5c98e3609f
commit
bdaf3b9a2b
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