electron/spec/fixtures/api/isolated-preload.js

25 lines
711 B
JavaScript
Raw Normal View History

// Ensure fetch works from isolated world origin
fetch('http://localhost:1234')
fetch('https://localhost:1234')
fetch(`file://${__filename}`)
const {ipcRenderer, webFrame} = require('electron')
2016-12-13 19:47:54 +00:00
window.foo = 3
webFrame.executeJavaScript('window.preloadExecuteJavaScriptProperty = 1234;')
2016-12-13 19:47:54 +00:00
window.addEventListener('message', (event) => {
ipcRenderer.send('isolated-world', {
preloadContext: {
preloadProperty: typeof window.foo,
pageProperty: typeof window.hello,
typeofRequire: typeof require,
2016-12-15 23:23:45 +00:00
typeofProcess: typeof process,
typeofArrayPush: typeof Array.prototype.push,
typeofFunctionApply: typeof Function.prototype.apply
2016-12-13 19:47:54 +00:00
},
pageContext: event.data
})
})