From fb1c66966ca8a198ba34f56098f254f8a3dff386 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 28 Feb 2022 20:17:50 -0800 Subject: [PATCH] fix: Capture Promise global to avoid userland mutation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This an equivalent of https://github.com/electron/electron/pull/20925. It’s needed for us to pass the test suite when we’re actually testing this module instead of Electron’s builtin remote. Signed-off-by: Anders Kaseorg --- src/main/server.ts | 2 ++ src/renderer/remote.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/server.ts b/src/main/server.ts index abdd4c9..c5799a3 100644 --- a/src/main/server.ts +++ b/src/main/server.ts @@ -6,6 +6,8 @@ import { ipcMain, WebContents, IpcMainEvent, app } from 'electron' import { IPC_MESSAGES } from '../common/ipc-messages'; import { getElectronBinding } from '../common/get-electron-binding' +const { Promise } = global + const v8Util = getElectronBinding('v8_util') const hasWebPrefsRemoteModuleAPI = (() => { diff --git a/src/renderer/remote.ts b/src/renderer/remote.ts index 445adab..f945dfa 100644 --- a/src/renderer/remote.ts +++ b/src/renderer/remote.ts @@ -6,6 +6,8 @@ import { browserModuleNames } from '../common/module-names' import { getElectronBinding } from '../common/get-electron-binding' import { IPC_MESSAGES } from '../common/ipc-messages'; +const { Promise } = global + const callbacksRegistry = new CallbacksRegistry() const remoteObjectCache = new Map() const finalizationRegistry = new FinalizationRegistry((id: number) => {