Add option to override webview security
This commit is contained in:
parent
b4a8ed01f1
commit
94d054cf11
7 changed files with 64 additions and 2 deletions
|
@ -8,7 +8,7 @@ const {closeWindow} = require('./window-helpers')
|
|||
|
||||
const isCI = remote.getGlobal('isCi')
|
||||
|
||||
describe('<webview> tag', function () {
|
||||
describe.only('<webview> tag', function () {
|
||||
this.timeout(3 * 60 * 1000)
|
||||
|
||||
var fixtures = path.join(__dirname, 'fixtures')
|
||||
|
@ -36,6 +36,43 @@ describe('<webview> tag', function () {
|
|||
w.loadURL('file://' + fixtures + '/pages/webview-no-script.html')
|
||||
})
|
||||
|
||||
it('is disabled when nodeIntegration is disabled', function (done) {
|
||||
w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
preload: path.join(fixtures, 'module', 'preload-webview.js')
|
||||
}
|
||||
})
|
||||
ipcMain.once('webview', function (event, type) {
|
||||
if (type === 'undefined') {
|
||||
done()
|
||||
} else {
|
||||
done('WebView still exists')
|
||||
}
|
||||
})
|
||||
w.loadURL('file://' + fixtures + '/pages/webview-no-script.html')
|
||||
})
|
||||
|
||||
it('is enabled when override is set', function (done) {
|
||||
w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
preload: path.join(fixtures, 'module', 'preload-webview.js'),
|
||||
enableWebViewOverride: true
|
||||
}
|
||||
})
|
||||
ipcMain.once('webview', function (event, type) {
|
||||
if (type !== 'undefined') {
|
||||
done()
|
||||
} else {
|
||||
done('WebView is not created')
|
||||
}
|
||||
})
|
||||
w.loadURL('file://' + fixtures + '/pages/webview-no-script.html')
|
||||
})
|
||||
|
||||
describe('src attribute', function () {
|
||||
it('specifies the page to load', function (done) {
|
||||
webview.addEventListener('console-message', function (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue