electron/spec/fixtures/api/window-open-preload.js
loc 0b85fdf26c
feat: add webContents.setWindowOpenHandler API (#24517)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-11-10 09:06:03 -08:00

15 lines
522 B
JavaScript

const { ipcRenderer, webFrame } = require('electron');
setImmediate(function () {
if (window.location.toString() === 'bar://page/') {
const windowOpenerIsNull = window.opener == null;
ipcRenderer.send('answer', {
nativeWindowOpen: webFrame.getWebPreference('nativeWindowOpen'),
nodeIntegration: webFrame.getWebPreference('nodeIntegration'),
sandbox: webFrame.getWebPreference('sandbox'),
typeofProcess: typeof global.process,
windowOpenerIsNull
});
window.close();
}
});