diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index 8df5e675ec6..475d2ea4c50 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -1122,6 +1122,28 @@ describe('BrowserWindow module', function () { }) }) + describe('nativeWindowOpen + contextIsolation options', () => { + beforeEach(() => { + w.destroy() + w = new BrowserWindow({ + show: false, + webPreferences: { + nativeWindowOpen: true, + contextIsolation: true, + preload: path.join(fixtures, 'api', 'native-window-open-isolated-preload.js') + } + }) + }) + + it('opens window with cross-scripting enabled from isolated context', (done) => { + ipcMain.once('answer', (event, content) => { + assert.equal(content, 'Hello') + done() + }) + w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open-isolated.html')) + }) + }) + describe('beforeunload handler', function () { it('returning undefined would not prevent close', function (done) { w.once('closed', function () { diff --git a/spec/fixtures/api/native-window-open-isolated-preload.js b/spec/fixtures/api/native-window-open-isolated-preload.js new file mode 100644 index 00000000000..aa214166021 --- /dev/null +++ b/spec/fixtures/api/native-window-open-isolated-preload.js @@ -0,0 +1,5 @@ +const {ipcRenderer} = require('electron') + +window.addEventListener('message', (event) => { + ipcRenderer.send('answer', event.data) +}) diff --git a/spec/fixtures/api/native-window-open-isolated.html b/spec/fixtures/api/native-window-open-isolated.html new file mode 100644 index 00000000000..41cce8e82ef --- /dev/null +++ b/spec/fixtures/api/native-window-open-isolated.html @@ -0,0 +1,10 @@ + +
+ + +