mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
contextIsolation didn't work while sandbox is on. The fix is contextIsolation picked up while sandbox on
33 lines
979 B
JavaScript
33 lines
979 B
JavaScript
// Ensure fetch works from isolated world origin
|
|
fetch('http://localhost:1234')
|
|
fetch('https://localhost:1234')
|
|
|
|
const {ipcRenderer, webFrame} = require('electron')
|
|
|
|
window.foo = 3
|
|
|
|
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
|
|
},
|
|
pageContext: event.data
|
|
})
|
|
ipcRenderer.send('isolated-sandbox-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
|
|
},
|
|
pageContext: event.data
|
|
})
|
|
})
|