Merge pull request #13539 from trop-bot/3-0-x-bp-enable-webview-in-sandbox-renderer-1530547750986

Backport (3-0-x) - Enable webview in sandbox renderer
This commit is contained in:
John Kleinschmidt 2018-07-17 10:01:40 -04:00 committed by GitHub
commit 8f8d198c5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 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
@ -1581,6 +1581,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', () => {