Closed
Bug 818559
Opened 12 years ago
Closed 12 years ago
Link with download attribute triggers onbeforeunload
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla20
People
(Reporter: evilpies, Assigned: Benjamin)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
5.27 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
Bug 676619 made this more obvious, but even before clicking on a link that opens a file download triggers the onbeforeunload event.
Comment 1•12 years ago
|
||
A stacktrace would be nice here.
Comment 2•12 years ago
|
||
> 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.
Assignee | ||
Comment 3•12 years ago
|
||
Per http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigating-across-documents beforeonload has to be fired before any network requests.
Summary: File download triggers onbeforeunload → Link with download attribute triggers onbeforeunload
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #689083 -
Flags: review?(bugs)
Comment 5•12 years ago
|
||
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 6•12 years ago
|
||
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)
Assignee | ||
Comment 7•12 years ago
|
||
(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?
Comment 8•12 years ago
|
||
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.
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #689083 -
Attachment is obsolete: true
Attachment #689755 -
Flags: review?(bugs)
Assignee | ||
Comment 10•12 years ago
|
||
Tweak.
Attachment #689755 -
Attachment is obsolete: true
Attachment #689755 -
Flags: review?(bugs)
Attachment #689819 -
Flags: review?(bugs)
Comment 11•12 years ago
|
||
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+
Assignee | ||
Comment 12•12 years ago
|
||
Assignee | ||
Comment 13•12 years ago
|
||
See bug 819605.
Comment 14•12 years ago
|
||
Assignee: nobody → benjamin
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Comment 15•12 years ago
|
||
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 16•12 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•