Skip to content

Commit

Permalink
fix: Capture Promise global to avoid userland mutation
Browse files Browse the repository at this point in the history
This an equivalent of electron/electron#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 <andersk@mit.edu>
  • Loading branch information
andersk committed Mar 1, 2022
1 parent de29cf5 commit fb1c669
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/server.ts
Expand Up @@ -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 = (() => {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/remote.ts
Expand Up @@ -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) => {
Expand Down

0 comments on commit fb1c669

Please sign in to comment.