Set page variable using webFrame.executeJavaScript
This commit is contained in:
parent
ea2273dde5
commit
b348cdeae8
3 changed files with 6 additions and 2 deletions
|
@ -1856,6 +1856,7 @@ describe('BrowserWindow module', function () {
|
||||||
typeofProcess: 'undefined',
|
typeofProcess: 'undefined',
|
||||||
typeofArrayPush: 'number',
|
typeofArrayPush: 'number',
|
||||||
typeofFunctionApply: 'boolean',
|
typeofFunctionApply: 'boolean',
|
||||||
|
typeofPreloadExecuteJavaScriptProperty: 'number'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
done()
|
done()
|
||||||
|
|
4
spec/fixtures/api/isolated-preload.js
vendored
4
spec/fixtures/api/isolated-preload.js
vendored
|
@ -1,7 +1,9 @@
|
||||||
const {ipcRenderer} = require('electron')
|
const {ipcRenderer, webFrame} = require('electron')
|
||||||
|
|
||||||
window.foo = 3
|
window.foo = 3
|
||||||
|
|
||||||
|
webFrame.executeJavaScript('window.preloadExecuteJavaScriptProperty = 1234;')
|
||||||
|
|
||||||
window.addEventListener('message', (event) => {
|
window.addEventListener('message', (event) => {
|
||||||
ipcRenderer.send('isolated-world', {
|
ipcRenderer.send('isolated-world', {
|
||||||
preloadContext: {
|
preloadContext: {
|
||||||
|
|
3
spec/fixtures/api/isolated.html
vendored
3
spec/fixtures/api/isolated.html
vendored
|
@ -13,7 +13,8 @@
|
||||||
typeofRequire: typeof require,
|
typeofRequire: typeof require,
|
||||||
typeofProcess: typeof process,
|
typeofProcess: typeof process,
|
||||||
typeofArrayPush: typeof Array.prototype.push,
|
typeofArrayPush: typeof Array.prototype.push,
|
||||||
typeofFunctionApply: typeof Function.prototype.apply
|
typeofFunctionApply: typeof Function.prototype.apply,
|
||||||
|
typeofPreloadExecuteJavaScriptProperty: typeof window.preloadExecuteJavaScriptProperty
|
||||||
}, '*')
|
}, '*')
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in a new issue