electron/spec/fixtures/crash-cases/webview-move-between-windows/index.js
trop[bot] f06f6d565e
fix: segfault when moving WebContentsView between BrowserWindows (#44615)
* fix: segfault when moving WebContentsView between BrowserWindows

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: actually enable fix

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* fixup segfault when moving WebContentsView between BrowserWindows

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-11-12 11:42:42 -05:00

31 lines
770 B
JavaScript

const { app, BrowserWindow, WebContentsView } = require('electron');
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow();
const secondaryWindow = new BrowserWindow();
const contentsView = new WebContentsView();
mainWindow.contentView.addChildView(contentsView);
mainWindow.webContents.setDevToolsWebContents(contentsView.webContents);
mainWindow.openDevTools();
contentsView.setBounds({
x: 400,
y: 0,
width: 400,
height: 600
});
setTimeout(() => {
secondaryWindow.contentView.addChildView(contentsView);
setTimeout(() => {
mainWindow.contentView.addChildView(contentsView);
app.quit();
}, 1000);
}, 1000);
}
app.whenReady().then(() => {
createWindow();
});