Closed Bug 405107 Opened 17 years ago Closed 17 years ago

File->Save Page As... download often reports 0 bytes as saved

Categories

(Toolkit :: Downloads API, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9beta3

People

(Reporter: martijn.martijn, Assigned: Mardak)

References

()

Details

Attachments

(1 file, 3 obsolete files)

To reproduce: - Visit http://www.google.nl/firefox (although it seems to happen on every page) - Do "File->Save Page As..." Expected result: - Page should be saved, reported amount of bytes saved should at least be > 0 bytes. Actual result: 0 bytes saved as reported by the download manager. It seems to happen when I first have visited the page. I can look for a regression range, if wanted.
Flags: blocking-firefox3?
A regression range would be awesome if you could get it. Edward - any thoughts on this off the top of your head?
Sorry, this isn't a real regression, this started happening as soon as bug 223895 was fixed. Fyi, when I do a replace of the old saved file, you can't see the bug, e.g. the correct size is being reported.
Flags: blocking-firefox3? → blocking-firefox3+
Priority: -- → P2
Whiteboard: [needs patch][needs assignee]
Target Milestone: --- → Firefox 3 M11
The issue here is that webbrowserpersist actually gives us multiple start/stops for each thing it's downloading from the page. So probably an image is getting saved before the actual html page that we're looking for the file size of.
Keywords: regression
OS: Windows XP → All
Hardware: PC → All
So, what our our options here to deal with the issue of the webbrowserpersist giving us multiple start/stops?
Whiteboard: [needs patch][needs assignee] → [needs assignee]
use totalprogress instead of selfprogress?
(In reply to comment #5) > use totalprogress instead of selfprogress? We do use totalprogress for all I can tell. However, the code that could be causing this is this maybe? http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp&rev=1.153#2061
Strange... can anybody reproduce this? I tried on several pages on windows and mac and they're all reporting a file size now.....
Hm, but that shouldn't cause 0 bytes reported, right?
Attached patch v1 (obsolete) — Splinter Review
(In reply to comment #8) > Hm, but that shouldn't cause 0 bytes reported, right? Was there something recently that caused webbrowserpersist files to be saved/created in a different order? This bug came up probably because in the "STOP" code, we try getting the file size from disk, but that might be 0 because the html file was just created -- another file finished (perhaps an image) and triggered the STOP code. The reason why I ask if the download order changed is because some reason the file /doesn't/ exist, so it's falling back on the max transfer size (the else case): http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp&rev=1.156&mark=2105-2107#2087 This fix doesn't completely solve the issue of multiple-file downloads from WBP. It should work for saving pages because those files are transferring from cache. I still can't reproduce the bug anymore, but this patch will help make sure it doesn't show up as 0.
Assignee: nobody → edilee
Status: NEW → ASSIGNED
Attachment #299469 - Flags: review?(sdwilsh)
Attached patch v1 (obsolete) — Splinter Review
Whoops. diff didn't pick up .h
Attachment #299469 - Attachment is obsolete: true
Attachment #299470 - Flags: review?(sdwilsh)
Attachment #299469 - Flags: review?(sdwilsh)
This won't work completely if ProgressChange64 never gets called..
Comment on attachment 299470 [details] [diff] [review] v1 sure, this should help if something strange happens - but I'm with you that I cannot get it to reproduce :/ r=sdwilsh
Attachment #299470 - Flags: review?(sdwilsh)
Attachment #299470 - Flags: review+
Attachment #299470 - Flags: approval1.9?
Attached patch v1.1 (obsolete) — Splinter Review
Now with more network action! I haven't tested this yet, but it sounds like it should work according to nsWebBrowserPersist.cpp code. The NETWORK bit is only set if it's totally completed. I can get this to reproduce if I don't browse to any other pages after opening the app. Open app, cmd-s, save, open DM, 0 bytes.... sometimes. Checking if 2 flags (out of more than 2 flags) are set.. (flags & FLAG1) && (flags & FLAG2) or.. flags & (FLAG1 | FLAG2) == (FLAG1 | FLAG2) or.. !(~flags & (FLAG1 | FLAG2))
Attachment #299470 - Attachment is obsolete: true
Attachment #299487 - Flags: review?(sdwilsh)
Attachment #299470 - Flags: approval1.9?
Comment on attachment 299487 [details] [diff] [review] v1.1 >- } else if ((aStateFlags & STATE_STOP) && IsFinishable()) { >+ } else if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_NETWORK) && >+ IsFinishable()) { eh, a comment about this please r=sdwilsh
Attachment #299487 - Flags: review?(sdwilsh) → review+
If we can trigger a "save page as" dialog and save it with a mochitest... ooh. Checking in toolkit/components/downloads/src/nsDownloadManager.cpp; /cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp,v <-- nsDownloadManager.cpp new revision: 1.157; previous revision: 1.156 done Checking in toolkit/components/downloads/src/nsDownloadManager.h; /cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.h,v <-- nsDownloadManager.h new revision: 1.62; previous revision: 1.61 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Flags: in-litmus?
Resolution: --- → FIXED
Whiteboard: [needs assignee]
Attached patch v1.2Splinter Review
As checked in with more comments on the NETWORK stuff. Thanks for trying out the trybuilds.
Attachment #299487 - Attachment is obsolete: true
Looks like this regressed download manager, it always shows as downloading even after download is finished, this is on Linux, latest CVS.
The first part of this fix got webbrowserpersist downloads working. The second part of this fix was landed in bug 414306 for exthandler downloads.
Verified FIXED using: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b3pre) Gecko/2008012804 Minefield/3.0b3pre Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9b3pre) Gecko/2008012804 Minefield/3.0b3pre -and- Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b3pre) Gecko/2008012804 Minefield/3.0b3pre
Status: RESOLVED → VERIFIED
Depends on: 416342
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: