|
@@ -36,24 +36,6 @@ 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')
|
|
|
- })
|
|
|
-
|
|
|
describe('src attribute', function () {
|
|
|
it('specifies the page to load', function (done) {
|
|
|
webview.addEventListener('console-message', function (e) {
|
|
@@ -64,6 +46,38 @@ describe('<webview> tag', function () {
|
|
|
document.body.appendChild(webview)
|
|
|
})
|
|
|
|
|
|
+ it('disables node integration when disabled on the parent BrowserWindow', function (done) {
|
|
|
+ ipcMain.once('answer', function (event, typeofProcess) {
|
|
|
+ try {
|
|
|
+ assert.equal(typeofProcess, 'undefined')
|
|
|
+ done()
|
|
|
+ } finally {
|
|
|
+ b.close()
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ var windowUrl = require('url').format({
|
|
|
+ pathname: `${fixtures}/pages/webview-no-node-integration-on-window.html`,
|
|
|
+ protocol: 'file',
|
|
|
+ query: {
|
|
|
+ p: `${fixtures}/pages/web-view-log-process.html`
|
|
|
+ },
|
|
|
+ slashes: true
|
|
|
+ })
|
|
|
+ var preload = path.join(fixtures, 'module', 'answer.js')
|
|
|
+
|
|
|
+ var b = new BrowserWindow({
|
|
|
+ height: 400,
|
|
|
+ width: 400,
|
|
|
+ show: false,
|
|
|
+ webPreferences: {
|
|
|
+ preload: preload,
|
|
|
+ nodeIntegration: false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ b.loadURL(windowUrl)
|
|
|
+ })
|
|
|
+
|
|
|
it('navigates to new page when changed', function (done) {
|
|
|
var listener = function () {
|
|
|
webview.src = 'file://' + fixtures + '/pages/b.html'
|