Enable webview in sandbox renderer Security: Inherit embedder prefs onto webview

This commit is contained in:
Hari Juturu 2018-06-25 15:08:00 -07:00 committed by Electron Bot
parent 8585372e11
commit 32e40cb4c3
4 changed files with 50 additions and 1 deletions

View file

@ -8,7 +8,7 @@ const os = require('os')
const qs = require('querystring')
const http = require('http')
const {closeWindow} = require('./window-helpers')
const {emittedOnce} = require('./events-helpers')
const {ipcRenderer, remote, screen} = require('electron')
const {app, ipcMain, BrowserWindow, BrowserView, protocol, session, webContents} = remote
@ -1573,6 +1573,23 @@ describe('BrowserWindow module', () => {
})
w.loadURL('file://' + path.join(fixtures, 'api', 'preload.html'))
})
it('webview in sandbox renderer', async () => {
w.destroy()
w = new BrowserWindow({
show: false,
webPreferences: {
sandbox: true,
preload: preload,
webviewTag: true
}
})
w.loadURL(`file://${fixtures}/pages/webview-did-attach-event.html`)
const [, webContents] = await emittedOnce(w.webContents, 'did-attach-webview')
const [, id] = await emittedOnce(ipcMain, 'webview-dom-ready')
expect(webContents.id).to.equal(id)
})
})
describe('nativeWindowOpen option', () => {