-
-
Save codebytere/d21eb8a039ab31faa910384a4ba3200c to your computer and use it in GitHub Desktop.
browserview-crash
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
const { app, BrowserWindow, BrowserView } = require('electron') | |
function createWindow() { | |
const win = new BrowserWindow({ width: 800, height: 600 }); | |
win.webContents.loadURL('https://www.electronjs.org'); | |
return win; | |
} | |
async function wait(ms) { | |
return new Promise( (resolve) => { | |
setTimeout( () => { | |
resolve(); | |
}, ms); | |
}); | |
} | |
async function startTest() { | |
const view = new BrowserView(); | |
view.setBounds({x: 0, y: 0, width: 300, height: 300}); | |
await view.webContents.loadURL('https://www.google.com'); | |
let win = createWindow(); | |
win.addBrowserView(view); | |
await wait(2500); | |
win.close(); | |
win = createWindow(); | |
win.addBrowserView(view); | |
} | |
app.on('ready', startTest); |
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
{ | |
"name": "volatile-courage-indicate-bgghl", | |
"productName": "volatile-courage-indicate-bgghl", | |
"description": "My Electron application description", | |
"keywords": [], | |
"main": "./main.js", | |
"version": "1.0.0", | |
"author": "codebytere", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"electron": "9999999999.9.9" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment