|
@@ -20,7 +20,7 @@ const FUNCTION_PROPERTIES = [
|
|
|
];
|
|
|
|
|
|
type RendererFunctionId = [string, number] // [contextId, funcId]
|
|
|
-type FinalizerInfo = { id: RendererFunctionId, webContents: electron.WebContents, frameId: number };
|
|
|
+type FinalizerInfo = { id: RendererFunctionId, webContents: electron.WebContents, frameId: [number, number] };
|
|
|
type CallIntoRenderer = (...args: any[]) => void
|
|
|
|
|
|
// The remote functions in renderer processes.
|
|
@@ -43,7 +43,7 @@ function getCachedRendererFunction (id: RendererFunctionId): CallIntoRenderer |
|
|
|
if (deref !== undefined) return deref;
|
|
|
}
|
|
|
}
|
|
|
-function setCachedRendererFunction (id: RendererFunctionId, wc: electron.WebContents, frameId: number, value: CallIntoRenderer) {
|
|
|
+function setCachedRendererFunction (id: RendererFunctionId, wc: electron.WebContents, frameId: [number, number], value: CallIntoRenderer) {
|
|
|
// eslint-disable-next-line no-undef
|
|
|
const wr = new WeakRef<CallIntoRenderer>(value);
|
|
|
const mapKey = id[0] + '~' + id[1];
|
|
@@ -220,7 +220,7 @@ const fakeConstructor = (constructor: Function, name: string) =>
|
|
|
});
|
|
|
|
|
|
// Convert array of meta data from renderer into array of real values.
|
|
|
-const unwrapArgs = function (sender: electron.WebContents, frameId: number, contextId: string, args: any[]) {
|
|
|
+const unwrapArgs = function (sender: electron.WebContents, frameId: [number, number], contextId: string, args: any[]) {
|
|
|
const metaToValue = function (meta: MetaTypeFromRenderer): any {
|
|
|
switch (meta.type) {
|
|
|
case 'nativeimage':
|
|
@@ -423,7 +423,7 @@ handleRemoteCommand(IPC_MESSAGES.BROWSER_GET_CURRENT_WEB_CONTENTS, function (eve
|
|
|
});
|
|
|
|
|
|
handleRemoteCommand(IPC_MESSAGES.BROWSER_CONSTRUCTOR, function (event, contextId, id, args) {
|
|
|
- args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
|
|
+ args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
|
|
const constructor = objectsRegistry.get(id);
|
|
|
|
|
|
if (constructor == null) {
|
|
@@ -434,7 +434,7 @@ handleRemoteCommand(IPC_MESSAGES.BROWSER_CONSTRUCTOR, function (event, contextId
|
|
|
});
|
|
|
|
|
|
handleRemoteCommand(IPC_MESSAGES.BROWSER_FUNCTION_CALL, function (event, contextId, id, args) {
|
|
|
- args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
|
|
+ args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
|
|
const func = objectsRegistry.get(id);
|
|
|
|
|
|
if (func == null) {
|
|
@@ -451,7 +451,7 @@ handleRemoteCommand(IPC_MESSAGES.BROWSER_FUNCTION_CALL, function (event, context
|
|
|
});
|
|
|
|
|
|
handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_CONSTRUCTOR, function (event, contextId, id, method, args) {
|
|
|
- args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
|
|
+ args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
|
|
const object = objectsRegistry.get(id);
|
|
|
|
|
|
if (object == null) {
|
|
@@ -462,7 +462,7 @@ handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_CONSTRUCTOR, function (event, co
|
|
|
});
|
|
|
|
|
|
handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_CALL, function (event, contextId, id, method, args) {
|
|
|
- args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
|
|
+ args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
|
|
const object = objectsRegistry.get(id);
|
|
|
|
|
|
if (object == null) {
|
|
@@ -479,7 +479,7 @@ handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_CALL, function (event, contextId
|
|
|
});
|
|
|
|
|
|
handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_SET, function (event, contextId, id, name, args) {
|
|
|
- args = unwrapArgs(event.sender, event.frameId, contextId, args);
|
|
|
+ args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args);
|
|
|
const obj = objectsRegistry.get(id);
|
|
|
|
|
|
if (obj == null) {
|