mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: will-attach-webview handler modifying params.instanceId does not break <webview> (#32386)
This commit is contained in:
@@ -138,6 +138,12 @@ ipcMain.on('prevent-next-will-attach-webview', (event) => {
|
||||
event.sender.once('will-attach-webview', event => event.preventDefault());
|
||||
});
|
||||
|
||||
ipcMain.on('break-next-will-attach-webview', (event, id) => {
|
||||
event.sender.once('will-attach-webview', (event, webPreferences, params) => {
|
||||
params.instanceId = null;
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.on('disable-node-on-next-will-attach-webview', (event, id) => {
|
||||
event.sender.once('will-attach-webview', (event, webPreferences, params) => {
|
||||
params.src = `file://${path.join(__dirname, '..', 'fixtures', 'pages', 'c.html')}`;
|
||||
|
||||
@@ -1163,6 +1163,14 @@ describe('<webview> tag', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('handler modifying params.instanceId does not break <webview>', async () => {
|
||||
ipcRenderer.send('break-next-will-attach-webview');
|
||||
|
||||
await startLoadingWebViewAndWaitForMessage(webview, {
|
||||
src: `file://${fixtures}/pages/a.html`
|
||||
});
|
||||
});
|
||||
|
||||
it('supports preventing a webview from being created', async () => {
|
||||
ipcRenderer.send('prevent-next-will-attach-webview');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user