feat: add webContents.setWindowOpenHandler API (#24517)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
This commit is contained in:
parent
6b222a2d8a
commit
0b85fdf26c
56 changed files with 2087 additions and 885 deletions
|
@ -225,16 +225,16 @@ describe('BrowserView module', () => {
|
|||
});
|
||||
|
||||
describe('window.open()', () => {
|
||||
it('works in BrowserView', async () => {
|
||||
it('works in BrowserView', (done) => {
|
||||
view = new BrowserView();
|
||||
w.setBrowserView(view);
|
||||
const newWindow = emittedOnce(view.webContents, 'new-window');
|
||||
view.webContents.once('new-window', event => event.preventDefault());
|
||||
view.webContents.setWindowOpenHandler(({ url, frameName }) => {
|
||||
expect(url).to.equal('http://host/');
|
||||
expect(frameName).to.equal('host');
|
||||
done();
|
||||
return { action: 'deny' };
|
||||
});
|
||||
view.webContents.loadFile(path.join(fixtures, 'pages', 'window-open.html'));
|
||||
const [, url, frameName,,, additionalFeatures] = await newWindow;
|
||||
expect(url).to.equal('http://host/');
|
||||
expect(frameName).to.equal('host');
|
||||
expect(additionalFeatures[0]).to.equal('this-is-not-a-standard-feature');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue