Open Bug 1131187 Opened 9 years ago Updated 2 years ago

Disable onbeforeunload dialog for frames

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

REOPENED

People

(Reporter: jruderman, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed, site-compat)

Attachments

(2 files, 4 obsolete files)

(Split from bug 1125285)
Attached file 1131187.html (obsolete) —
Test page for this bug.
Attached file 1131187-frame.html (obsolete) —
I couldn't find a way to reproduce this bug on Nightly 60.

It looks like we may not allow any of (alert,confirm,prompt) from a beforeunload event either in a frame or on a top-level page.
Jesse, can you provide more info on what this bug is about or provide a testcase?
Flags: needinfo?(jruderman)
Attached file 1131187.html (obsolete) —
Working test case using the "blur" event like in bug 1125285.
Attachment #8946955 - Attachment is obsolete: true
Flags: needinfo?(jruderman)
Attached file 1131187-frame.html (obsolete) —
Attachment #8946956 - Attachment is obsolete: true
While there is an infinite series of dialogs, the "Prevent this page from creating additional dialogs" checkbox and allows users to end the dialogs and close the tab.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
I don't think this is WFM, the testcases don't test what this bug is about.

The problem here is basically:

1. parent page
2. loads iframe page, which registers a beforeunload handler which returns a string / calls preventdefault on the event
3. parent page navigates child page, which triggers the beforeunload handler, which creates a beforeunload prompt.

The contention of this bug is that we shouldn't show beforeunload dialogs for frames at all.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Attached file 1131187.html
Thanks for this Gijs. I was finally able to create a test case for this bug.
Attachment #8948856 - Attachment is obsolete: true
Attached file 1131187-frame.html
Attachment #8948857 - Attachment is obsolete: true
As noted in bug 1125285, this now only fires if you interact with the page (e.g. by clicking the button). It's no longer possible for the document to spam you via a subframe without clicks/keypresses , because of bug 636905 (though see bug 1345830).

We have bug 578828 to disable beforeunload dialogs entirely. I'm not convinced either that or this bug would be web-compatible.

One other thing we could do is making beforeunload prompts subject to the 'prevent this page from opening more dialogs' permission (and include a checkbox for it by default in beforeunload dialogs). However, that won't work cross-site when the tab navigates frames, so will probably only offer limited help to people affected by this. That said, the interaction flag will get reset when the page navigates, so then hopefully that will help prevent dialogs on new domains.
Priority: -- → P3
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: