Closed Bug 818559 Opened 12 years ago Closed 12 years ago

Link with download attribute triggers onbeforeunload

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: evilpies, Assigned: Benjamin)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

Bug 676619 made this more obvious, but even before clicking on a link that opens a file download triggers the onbeforeunload event.
Depends on: 676619
A stacktrace would be nice here.
> even before clicking on a link that opens a file download triggers the onbeforeunload > event. onbeforeunload fires before we start the GET to the server in that case (has to, per spec, iirc). We don't know we're going to end up with a download at that point. But for @download, I agree we know it up front and shouldn't fire beforeunload.
Summary: File download triggers onbeforeunload → Link with download attribute triggers onbeforeunload
Attachment #689083 - Flags: review?(bugs)
Comment on attachment 689083 [details] [diff] [review] don't ask to unload the document when we know it's a download I'm mostly offline today (independence day). Will look at this hopefully tomorrow.
Attachment #689083 - Flags: feedback?(evilpies)
Comment on attachment 689083 [details] [diff] [review] don't ask to unload the document when we know it's a download mTiming->NotifyBeforeUnload() is then a bit wrong. If we don't do unload, we shouldn't change beforeunload.
Attachment #689083 - Flags: review?(bugs)
Attachment #689083 - Flags: review-
Attachment #689083 - Flags: feedback?(evilpies)
(In reply to Olli Pettay [:smaug] from comment #6) > Comment on attachment 689083 [details] [diff] [review] > don't ask to unload the document when we know it's a download > > mTiming->NotifyBeforeUnload() is then a bit wrong. > If we don't do unload, we shouldn't change beforeunload. It seems this is a preexisting problem with javascript urls, though?
Sure, but downloading js urls isn't common (since it isn't supported in all the browsers). The patch would make the problem significantly worse - and fixing the problem should be almost trivial.
Attached patch don't invoke timing (obsolete) — Splinter Review
Attachment #689083 - Attachment is obsolete: true
Attachment #689755 - Flags: review?(bugs)
Tweak.
Attachment #689755 - Attachment is obsolete: true
Attachment #689755 - Flags: review?(bugs)
Attachment #689819 - Flags: review?(bugs)
Comment on attachment 689819 [details] [diff] [review] don't invoke timing for downloads Could you file a followup to add tests for performance timing in case download happens.
Attachment #689819 - Flags: review?(bugs) → review+
Blocks: 819605
Assignee: nobody → benjamin
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Depends on: 820067
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: