fix: do not mutate ipc instances across contexts (#23236)
This commit is contained in:
parent
6fa05dd123
commit
8262f24fd8
2 changed files with 47 additions and 41 deletions
|
@ -5,6 +5,8 @@ const v8Util = process.electronBinding('v8_util');
|
|||
const ipcRenderer = v8Util.getHiddenValue<Electron.IpcRenderer>(global, 'ipc');
|
||||
const internal = false;
|
||||
|
||||
// TODO(MarshallOfSound): Remove if statement when isolated_bundle and content_script_bundle are gone
|
||||
if (!ipcRenderer.send) {
|
||||
ipcRenderer.send = function (channel, ...args) {
|
||||
return ipc.send(internal, channel, args);
|
||||
};
|
||||
|
@ -32,5 +34,6 @@ ipcRenderer.invoke = async function (channel, ...args) {
|
|||
ipcRenderer.postMessage = function (channel: string, message: any, transferables: any) {
|
||||
return ipc.postMessage(channel, message, transferables);
|
||||
};
|
||||
}
|
||||
|
||||
export default ipcRenderer;
|
||||
|
|
|
@ -5,6 +5,8 @@ const v8Util = process.electronBinding('v8_util');
|
|||
export const ipcRendererInternal = v8Util.getHiddenValue<Electron.IpcRendererInternal>(global, 'ipc-internal');
|
||||
const internal = true;
|
||||
|
||||
// TODO(MarshallOfSound): Remove if statement when isolated_bundle and content_script_bundle are gone
|
||||
if (!ipcRendererInternal.send) {
|
||||
ipcRendererInternal.send = function (channel, ...args) {
|
||||
return ipc.send(internal, channel, args);
|
||||
};
|
||||
|
@ -28,3 +30,4 @@ ipcRendererInternal.invoke = async function<T> (channel: string, ...args: any[])
|
|||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue