fix: capture the promise global to avoid userland mutation (#20925)
This commit is contained in:
parent
4de04da27a
commit
267821831c
6 changed files with 39 additions and 2 deletions
|
@ -8,6 +8,8 @@
|
|||
const path = require('path')
|
||||
const util = require('util')
|
||||
|
||||
const Promise = global.Promise
|
||||
|
||||
const envNoAsar = process.env.ELECTRON_NO_ASAR &&
|
||||
process.type !== 'browser' &&
|
||||
process.type !== 'renderer'
|
||||
|
|
8
lib/common/webpack-globals-provider.ts
Normal file
8
lib/common/webpack-globals-provider.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Captures original globals into a scope to ensure that userland modifications do
|
||||
// not impact Electron. Note that users doing:
|
||||
//
|
||||
// global.Promise.resolve = myFn
|
||||
//
|
||||
// Will mutate this captured one as well and that is OK.
|
||||
|
||||
export const Promise = global.Promise
|
Loading…
Add table
Add a link
Reference in a new issue