"browser.close" has to close all top-level browsing contexts by discarding any "beforeunload" handlers
Categories
(Remote Protocol :: WebDriver BiDi, defect, P2)
Tracking
(Not tracked)
People
(Reporter: alexrudenko, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
(Whiteboard: [webdriver:m11])
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Steps to reproduce:
Run the following script
import puppeteer from "puppeteer";
const browser = await puppeteer.launch({
product: 'firefox',
protocol: 'webDriverBiDi',
});
const page = await browser.newPage();
await page.goto('http://127.0.0.1:8080/test/assets/beforeunload.html');
await page.click('body');
await browser.connection.send('browser.close', {});
The content of beforeunload.html is
<div>beforeunload demo.</div>
<script>
window.addEventListener('beforeunload', event => {
// Chrome way.
event.returnValue = 'Leave?';
// Firefox way.
event.preventDefault();
});
</script>
Adjust the page URL according to the path on your server.
Actual results:
The browser is not closed. The page shows the dialog to confirm unload.
Expected results:
According to https://w3c.github.io/webdriver-bidi/#command-browser-close the implementation should "Close any top-level browsing contexts without prompting to unload."
Comment 1•5 months ago
|
||
Right now we do not support beforeunload
events and completely turn those off via the preference dom.disable_beforeunload
. So maybe Puppeteer needs to set it on its own for the Firefox preferences for now.
Also before we can close top-level browsing contexts without prompting we need bug 1862380 fixed.
Updated•5 months ago
|
Updated•4 months ago
|
Comment 2•4 months ago
|
||
The severity field is not set for this bug.
:whimboo, could you have a look please?
For more information, please visit BugBot documentation.
Updated•4 months ago
|
Updated•2 months ago
|
Description
•