"browser.close" has to close all top-level browsing contexts by discarding any "beforeunload" handlers
Categories
(Remote Protocol :: WebDriver BiDi, defect, P2)
Tracking
(firefox129 fixed)
Tracking | Status | |
---|---|---|
firefox129 | --- | fixed |
People
(Reporter: alexrudenko, Assigned: whimboo)
References
Details
(Whiteboard: [webdriver:m11][webdriver:relnote])
Attachments
(2 files)
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."
Assignee | ||
Comment 1•9 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.
Assignee | ||
Updated•9 months ago
|
Assignee | ||
Updated•9 months ago
|
Comment 2•9 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.
Assignee | ||
Updated•9 months ago
|
Updated•7 months ago
|
Assignee | ||
Updated•4 months ago
|
Assignee | ||
Updated•4 months ago
|
Assignee | ||
Comment 3•4 months ago
|
||
Assignee | ||
Comment 4•4 months ago
|
||
https://hg.mozilla.org/mozilla-central/rev/065a840047f6
https://hg.mozilla.org/mozilla-central/rev/94263d5ebf02
Assignee | ||
Updated•2 months ago
|
Description
•