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:
Robo
2020-07-28 13:00:44 -07:00
committed by GitHub
parent 38fafe4986
commit b6321cc22d
5 changed files with 41 additions and 0 deletions

View File

@@ -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', () => {