add webFrame to sandboxed renderer
This commit is contained in:
parent
bf07c5aebd
commit
eca7ff986c
4 changed files with 9 additions and 2 deletions
|
@ -166,7 +166,7 @@ Currently the `require` function provided in the preload scope exposes the
|
||||||
following modules:
|
following modules:
|
||||||
|
|
||||||
- `child_process`
|
- `child_process`
|
||||||
- `electron` (crashReporter, remote and ipcRenderer)
|
- `electron` (crashReporter, remote, ipcRenderer, and webFrame)
|
||||||
- `fs`
|
- `fs`
|
||||||
- `os`
|
- `os`
|
||||||
- `timers`
|
- `timers`
|
||||||
|
|
|
@ -11,6 +11,12 @@ Object.defineProperties(exports, {
|
||||||
return require('../../../renderer/api/remote')
|
return require('../../../renderer/api/remote')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
webFrame: {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return require('../../../renderer/api/web-frame')
|
||||||
|
}
|
||||||
|
},
|
||||||
crashReporter: {
|
crashReporter: {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () {
|
get: function () {
|
||||||
|
|
2
spec/fixtures/api/isolated-preload.js
vendored
2
spec/fixtures/api/isolated-preload.js
vendored
|
@ -6,6 +6,8 @@ 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: {
|
||||||
|
|
1
spec/fixtures/api/isolated.html
vendored
1
spec/fixtures/api/isolated.html
vendored
|
@ -7,7 +7,6 @@
|
||||||
window.hello = 'world'
|
window.hello = 'world'
|
||||||
Array.prototype.push = 3
|
Array.prototype.push = 3
|
||||||
Function.prototype.apply = true
|
Function.prototype.apply = true
|
||||||
window.preloadExecuteJavaScriptProperty = 1234;
|
|
||||||
|
|
||||||
const opened = window.open()
|
const opened = window.open()
|
||||||
opened.close()
|
opened.close()
|
||||||
|
|
Loading…
Reference in a new issue