-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: segfault when moving WebContentsView between BrowserWindows (#44614
) * fix: segfault when moving WebContentsView between BrowserWindows Co-authored-by: John Kleinschmidt <[email protected]> * chore: actually enable fix Co-authored-by: John Kleinschmidt <[email protected]> * fixup segfault when moving WebContentsView between BrowserWindows Co-authored-by: John Kleinschmidt <[email protected]> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <[email protected]>
- Loading branch information
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
spec/fixtures/crash-cases/webview-move-between-windows/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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(); | ||
}); |