electron/spec/fixtures/api/isolated-preload.js
Robo 32158ca5dd chore: refactor context isolation spec (#14394)
* spec: refactor BrowserWindow module contextIsolation option

* spec: check for serialzation in isolated renderers separately
2018-09-01 08:51:29 +12:00

20 lines
662 B
JavaScript

const {ipcRenderer, webFrame} = require('electron')
window.foo = 3
webFrame.executeJavaScript('window.preloadExecuteJavaScriptProperty = 1234;')
window.addEventListener('message', (event) => {
ipcRenderer.send('isolated-world', {
preloadContext: {
preloadProperty: typeof window.foo,
pageProperty: typeof window.hello,
typeofRequire: typeof require,
typeofProcess: typeof process,
typeofArrayPush: typeof Array.prototype.push,
typeofFunctionApply: typeof Function.prototype.apply,
typeofPreloadExecuteJavaScriptProperty: typeof window.preloadExecuteJavaScriptProperty
},
pageContext: event.data
})
})