fix contextIsolation issue while webPreference sandbox is on

contextIsolation didn't work while sandbox is on. The fix is contextIsolation picked up while sandbox on
This commit is contained in:
sungpark 2017-07-27 17:08:24 -07:00
parent 485b9099f1
commit bf07c5aebd
8 changed files with 63 additions and 22 deletions

View file

@ -1,14 +1,11 @@
// Ensure fetch works from isolated world origin
fetch('http://localhost:1234')
fetch('https://localhost:1234')
fetch(`file://${__filename}`)
const {ipcRenderer, webFrame} = require('electron')
window.foo = 3
webFrame.executeJavaScript('window.preloadExecuteJavaScriptProperty = 1234;')
window.addEventListener('message', (event) => {
ipcRenderer.send('isolated-world', {
preloadContext: {
@ -21,4 +18,15 @@ window.addEventListener('message', (event) => {
},
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
})
})