mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
feat: add webContents.setWindowOpenHandler API (#24517)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
This commit is contained in:
7
spec/fixtures/api/new-window-preload.js
vendored
7
spec/fixtures/api/new-window-preload.js
vendored
@@ -1,4 +1,7 @@
|
||||
const { ipcRenderer } = require('electron');
|
||||
const { ipcRenderer, webFrame } = require('electron');
|
||||
|
||||
ipcRenderer.send('answer', process.argv);
|
||||
ipcRenderer.send('answer', {
|
||||
nativeWindowOpen: webFrame.getWebPreference('nativeWindowOpen'),
|
||||
argv: process.argv
|
||||
});
|
||||
window.close();
|
||||
|
||||
10
spec/fixtures/api/window-open-preload.js
vendored
10
spec/fixtures/api/window-open-preload.js
vendored
@@ -1,9 +1,15 @@
|
||||
const { ipcRenderer } = require('electron');
|
||||
const { ipcRenderer, webFrame } = require('electron');
|
||||
|
||||
setImmediate(function () {
|
||||
if (window.location.toString() === 'bar://page/') {
|
||||
const windowOpenerIsNull = window.opener == null;
|
||||
ipcRenderer.send('answer', process.argv, typeof global.process, windowOpenerIsNull);
|
||||
ipcRenderer.send('answer', {
|
||||
nativeWindowOpen: webFrame.getWebPreference('nativeWindowOpen'),
|
||||
nodeIntegration: webFrame.getWebPreference('nodeIntegration'),
|
||||
sandbox: webFrame.getWebPreference('sandbox'),
|
||||
typeofProcess: typeof global.process,
|
||||
windowOpenerIsNull
|
||||
});
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user