feat: enable nativeWindowOpen by default (#28552)
* feat: enable nativeWindowOpen by default * set nativeWindowOpen: false on spec/ main window * update snapshots * fix tests * fix test * fix webview test missing allowpopups * fix other test * update default
This commit is contained in:
parent
dba4df9326
commit
f8bdef5349
9 changed files with 90 additions and 95 deletions
|
@ -744,7 +744,9 @@ describe('chromium features', () => {
|
|||
}
|
||||
|
||||
it('disables node integration when it is disabled on the parent window for chrome devtools URLs', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } });
|
||||
// NB. webSecurity is disabled because native window.open() is not
|
||||
// allowed to load devtools:// URLs.
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, webSecurity: false } });
|
||||
w.loadURL('about:blank');
|
||||
w.webContents.executeJavaScript(`
|
||||
{ b = window.open('devtools://devtools/bundled/inspector.html', '', 'nodeIntegration=no,show=no'); null }
|
||||
|
@ -755,8 +757,8 @@ describe('chromium features', () => {
|
|||
});
|
||||
|
||||
it('disables JavaScript when it is disabled on the parent window', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } });
|
||||
w.webContents.loadURL('about:blank');
|
||||
const w = new BrowserWindow({ show: true, webPreferences: { nodeIntegration: true } });
|
||||
w.webContents.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
|
||||
const windowUrl = require('url').format({
|
||||
pathname: `${fixturesPath}/pages/window-no-javascript.html`,
|
||||
protocol: 'file',
|
||||
|
@ -783,7 +785,7 @@ describe('chromium features', () => {
|
|||
targetURL = `file://${fixturesPath}/pages/base-page.html`;
|
||||
}
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadURL('about:blank');
|
||||
w.webContents.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
|
||||
w.webContents.executeJavaScript(`{ b = window.open(${JSON.stringify(targetURL)}); null }`);
|
||||
const [, window] = await emittedOnce(app, 'browser-window-created');
|
||||
await emittedOnce(window.webContents, 'did-finish-load');
|
||||
|
@ -792,7 +794,7 @@ describe('chromium features', () => {
|
|||
|
||||
it('defines a window.location setter', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadURL('about:blank');
|
||||
w.webContents.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
|
||||
w.webContents.executeJavaScript('{ b = window.open("about:blank"); null }');
|
||||
const [, { webContents }] = await emittedOnce(app, 'browser-window-created');
|
||||
await emittedOnce(webContents, 'did-finish-load');
|
||||
|
@ -803,7 +805,7 @@ describe('chromium features', () => {
|
|||
|
||||
it('defines a window.location.href setter', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadURL('about:blank');
|
||||
w.webContents.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
|
||||
w.webContents.executeJavaScript('{ b = window.open("about:blank"); null }');
|
||||
const [, { webContents }] = await emittedOnce(app, 'browser-window-created');
|
||||
await emittedOnce(webContents, 'did-finish-load');
|
||||
|
@ -1035,7 +1037,7 @@ describe('chromium features', () => {
|
|||
// We are testing whether context (3) can access context (2) under various conditions.
|
||||
|
||||
// This is context (1), the base window for the test.
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, webviewTag: true, contextIsolation: false } });
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, webviewTag: true, contextIsolation: false, nativeWindowOpen: false } });
|
||||
await w.loadURL('about:blank');
|
||||
|
||||
const parentCode = `new Promise((resolve) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue