mirror of
https://github.com/electron/electron.git
synced 2026-02-06 13:15:05 -05:00
fix: crash when navigating from a page with webview that has inherited zoom level (#24757)
* fix: cleanup webview zoom level observers on navigation * add spec * webview should be on same partition * wait for webview to finish loading
This commit is contained in:
@@ -315,6 +315,25 @@ describe('<webview> tag', function () {
|
||||
const [, zoomLevel] = await emittedOnce(ipcMain, 'webview-origin-zoom-level');
|
||||
expect(zoomLevel).to.equal(2.0);
|
||||
});
|
||||
|
||||
it('does not crash when navigating with zoom level inherited from parent', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
webviewTag: true,
|
||||
nodeIntegration: true,
|
||||
zoomFactor: 1.2,
|
||||
session: webviewSession
|
||||
}
|
||||
});
|
||||
const attachPromise = emittedOnce(w.webContents, 'did-attach-webview');
|
||||
const readyPromise = emittedOnce(ipcMain, 'dom-ready');
|
||||
w.loadFile(path.join(fixtures, 'pages', 'webview-zoom-inherited.html'));
|
||||
const [, webview] = await attachPromise;
|
||||
await readyPromise;
|
||||
expect(webview.getZoomFactor()).to.equal(1.2);
|
||||
await w.loadURL(`${zoomScheme}://host1`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('nativeWindowOpen option', () => {
|
||||
|
||||
Reference in New Issue
Block a user