Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No way to close a browserView #37378

Closed
3 tasks done
t57ser opened this issue Feb 22, 2023 · 1 comment · Fixed by #37420
Closed
3 tasks done

[Bug]: No way to close a browserView #37378

t57ser opened this issue Feb 22, 2023 · 1 comment · Fixed by #37420
Assignees
Labels
bug 🪲 bug/regression ↩️ A new version of Electron broke something component/BrowserView has-repro-comment Issue has repro in comments status/confirmed A maintainer reproduced the bug or agreed with the feature

Comments

@t57ser
Copy link
Contributor

t57ser commented Feb 22, 2023

Preflight Checklist

Electron Version

23.1.0

What operating system are you using?

Windows

Operating System Version

10.0.19042

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

There should be a way to close a browserView.

Actual Behavior

Neither window.close() nor webContents.close() has any effect.
You can play a video on youtube and hear the sound continue after .removeBrowserView is called. So that does not change the behavior either. Also calling window.close() in the devtools has no effect.

const electron = require( "electron" )

electron.app.whenReady().then(()=>{
	let main = new electron.BrowserWindow({
		"height" : 700,
		"width" : 800,
		show: true,
	});

	let view = new electron.BrowserView({});
	view.webContents.loadURL("https://www.youtube.com");
	main.addBrowserView(view);
	view.setBounds({x: 0, y: 0, width: 800, height: 700})
	view.webContents.openDevTools({ mode: "detach" });

	setTimeout(() => {
		console.log("calling webContents.close()")
		//main.removeBrowserView(view);
		//view.webContents.close();
		view.webContents.executeJavaScript("window.close()");
	}, 5000);
})

Testcase Gist URL

No response

Additional Information

No response

@dsanders11 dsanders11 added bug/regression ↩️ A new version of Electron broke something component/BrowserView status/confirmed A maintainer reproduced the bug or agreed with the feature has-repro-comment Issue has repro in comments labels Feb 23, 2023
@dsanders11
Copy link
Member

Can confirm that YouTube video continues to play after view.webContents.close(). It looks like this regressed in v23.1.0, likely due to #37205.

cc @codebytere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 bug/regression ↩️ A new version of Electron broke something component/BrowserView has-repro-comment Issue has repro in comments status/confirmed A maintainer reproduced the bug or agreed with the feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants