fix: regressions introduced by adding world isolation to Chrome extension content scripts (#17422)

This commit is contained in:
Milan Burda 2019-03-19 14:45:48 +01:00 committed by Alexey Kuzmin
parent 2fb9085e5b
commit 53f4af7722
6 changed files with 83 additions and 11 deletions

View file

@ -7,9 +7,11 @@ const { EventEmitter } = require('events')
process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess.binding, 'renderer')
const v8Util = process.electronBinding('v8_util')
// The `lib/renderer/ipc-renderer-internal.js` module looks for the ipc object in the
// "ipc-internal" hidden value
v8Util.setHiddenValue(global, 'ipc-internal', new EventEmitter())
v8Util.setHiddenValue(global, 'ipc-internal', v8Util.getHiddenValue(isolatedWorld, 'ipc-internal'))
// The process object created by browserify is not an event emitter, fix it so
// the API is more compatible with non-sandboxed renderers.
for (const prop of Object.keys(EventEmitter.prototype)) {