Closed
Bug 420230
Opened 16 years ago
Closed 16 years ago
unable to save data urls to disk
Categories
(Toolkit :: Downloads API, defect, P2)
Tracking
()
VERIFIED
FIXED
mozilla1.9beta5
People
(Reporter: sspitzer, Assigned: jimm)
References
()
Details
Attachments
(2 files, 4 obsolete files)
465 bytes,
text/html
|
Details | |
14.94 KB,
patch
|
Mardak
:
review+
|
Details | Diff | Splinter Review |
unable to save data urls to disk steps to reproduce 1) load the data url above 2) attempt to save to disk I get the download manager, but the file is never saved. first spotted this with dolske's APNG Editor addon Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b4pre) Gecko/2008022704 Minefield/3.0b4pre
Comment 1•16 years ago
|
||
Hmm, with APNG edit's "Save Animation" and a current nightly on OS X (Gecko/2008022804), these both WFM. Windows-specific bug?
Reporter | ||
Comment 2•16 years ago
|
||
I updated to make sure it wasn't fixed recently, and Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b4pre) Gecko/2008022806 Minefield/3.0b4pre has the same problem.
Comment 3•16 years ago
|
||
ugh - edward - didn't we fix this once already?
Component: General → Download Manager
QA Contact: general → download.manager
Comment 4•16 years ago
|
||
Works for me with the provided data uri and data:text/html,Hello World!
Reporter | ||
Comment 5•16 years ago
|
||
the hello world data url from edward works for me, but the png data url does not. edward, when you save that data url to disk, what do you see in the download manager? I'm attempting to save it as "test.png", so I see test.png 2.2 KB - data resource
Reporter | ||
Comment 6•16 years ago
|
||
an interesting data point: entries for the files that I'm saving are showing up in "My Recent Documents" under the Start menu (on Windows XP), which makes me think that I am saving them, but then they are getting deleted?
Comment 7•16 years ago
|
||
So you /do/ see the file show up as image.png <time> 2.2 KB - data resource ? If you double click the row from the download manager, does it open?
Reporter | ||
Comment 8•16 years ago
|
||
> If you double click the row from the download manager, does it open?
"Open" is disabled, and "Open In Containing Folder" gives me the windows explorer alert that the file does not exist or is not a directory.
Comment 9•16 years ago
|
||
I noticed this when trying to save the data uri from bug 163971. If I have a previously saved file with the same name (using a branch build), then that file is being deleted, but the new file is not saved. It seems as if the download manager is trying to create a directory, instead of a file or something and when that doesn't work, it bails out completely.
Comment 10•16 years ago
|
||
This seems to be windows only. I wonder if it's related to bug 416683. Because when I toggle browser.download.manager.scanWhenDone to false, I can save okay on windows.
Depends on: 416683
Assignee | ||
Updated•16 years ago
|
Assignee: nobody → jmathies
Assignee | ||
Comment 12•16 years ago
|
||
bug 422920 was marked as blocking / P2.
Flags: blocking-firefox3?
Priority: -- → P2
Assignee | ||
Comment 13•16 years ago
|
||
Updated•16 years ago
|
Flags: blocking-firefox3? → blocking-firefox3+
Assignee | ||
Comment 14•16 years ago
|
||
This patch skips off providing the source uri in cases where the source is a data scheme. Scanning though will still take place on the resulting local file.
Assignee | ||
Updated•16 years ago
|
Attachment #311103 -
Flags: review?(tellrob)
Comment 15•16 years ago
|
||
Comment on attachment 311103 [details] [diff] [review] download scanner patch v.1 Looks pretty straightforward to me. No threading issues.
Attachment #311103 -
Flags: review?(tellrob) → review+
Updated•16 years ago
|
Flags: in-testsuite?
Flags: in-litmus?
Assignee | ||
Updated•16 years ago
|
Attachment #311103 -
Flags: superreview?(sdwilsh)
Assignee | ||
Comment 16•16 years ago
|
||
I'll add a test for this as well.
Comment 17•16 years ago
|
||
I can do the test.
Comment 18•16 years ago
|
||
Well, depends on what kind of test you want ;) Shawn might want an xpcshell one :p I was just doing to take one of the mochitests that adds a download and hits space to retry the download. You can continue. :p
Assignee | ||
Comment 19•16 years ago
|
||
actuall I'd kinda like to do it myself. :) working on one now based on your suggested approach. I'll post a new patch here in a bit.
Assignee | ||
Comment 20•16 years ago
|
||
added mochitest test case. I made it a platform independent test since this seems like a good general test to have.
Attachment #311103 -
Attachment is obsolete: true
Attachment #311103 -
Flags: superreview?(sdwilsh)
Assignee | ||
Updated•16 years ago
|
Attachment #311162 -
Flags: superreview?(benjamin)
Attachment #311162 -
Flags: review?(edilee)
Comment 21•16 years ago
|
||
I'm not complaining since more eye's looking at the code is a good thing, but toolkit doesn't require superreview. Edward - can you make sure this testcase follows the form you've been going along with (minimizes dependency on setTimeout). Thanks!
Comment 22•16 years ago
|
||
Comment on attachment 311162 [details] [diff] [review] download scanner patch v.3 >+++ toolkit/mozapps/downloads/tests/browser/browser_bug_420230.js >+ window.setTimeout(finishUp, 500); Could you base the testcase on either browser_bug_406857 or browser_bug_412360. They start downloads by creating a download in the canceled state and simulating an enter to restart the download.. So we don't need to explicitly set up our own nsIWBP object and all. Also, those tests don't use a setTimeout(.., 500) which is frowned upon. Additionally, you want to check if the file exists. Not just that it got to the finished state. Because currently, downloads _are_ finishing but the file disappears.
Attachment #311162 -
Flags: review?(edilee) → review-
Assignee | ||
Comment 23•16 years ago
|
||
> I'm not complaining since more eye's looking at the code is a good thing, but > toolkit doesn't require superreview. Isn't it going to need sr+ if I'm planning on asking for approval1.9b5? > Could you base the testcase on either browser_bug_406857... I think that's the one I started with, but took most of that stuff out. :/ Will get it cleaned up and repost.
Comment 24•16 years ago
|
||
(In reply to comment #23) > Isn't it going to need sr+ if I'm planning on asking for approval1.9b5? Nope, normal rules apply. Drivers look for proper review, and really like to see tests ;)
Assignee | ||
Comment 25•16 years ago
|
||
Attachment #311162 -
Attachment is obsolete: true
Attachment #311184 -
Flags: review?(edilee)
Attachment #311162 -
Flags: superreview?(benjamin)
Assignee | ||
Updated•16 years ago
|
Attachment #311184 -
Flags: approval1.9b5?
Comment 26•16 years ago
|
||
Comment on attachment 311184 [details] [diff] [review] download scanner patch v.4 Typically you request approval after reviews are done. r=Mardak >+++ toolkit/mozapps/downloads/tests/browser/browser_bug_420230.js >+ case dm.DOWNLOAD_FINISHED: >+ ok(true, "data: scheme uri successfully downloaded"); >+ if (!aDownload.targetFile.exists()) >+ ok(false, "data: scheme uri target does not exist"); >+ else >+ ok(true, "data: scheme uri target file exists"); No need for the if/else. Just do.. ok(aDownload.targetFile.exists(), "data: uri target file exists"); And just checking, you were able to pass this test on a windows box only after applying the rest of the patch?
Attachment #311184 -
Flags: review?(edilee) → review+
Assignee | ||
Comment 27•16 years ago
|
||
> Typically you request approval after reviews are done. sorry, jumpd the gun. > And just checking, you were able to pass this test on a windows box only after > applying the rest of the patch? Hmm, good question, I didn't check that. Will test that now.
Assignee | ||
Comment 28•16 years ago
|
||
Yes it fails. I get a timeout though, I wonder if I've not finished up right - chrome://mochikit/content/browser/../browser/toolkit/mozapps/downloads/tests/browser/browser_bug_420230.js PASS - data: uri successfully downloaded FAIL - data: uri target file exists - chrome://mochikit/content/browser/../browser/toolkit/mozapps/downloads/tests/browser/browser_bug_420230.js FAIL - Timed out - chrome://mochikit/content/browser/../browser/toolkit/mozapps/downloads/tests/browser/browser_bug_420230.js here's the new code: case dm.DOWNLOAD_FINISHED: ok(true, "data: uri successfully downloaded"); ok(aDownload.targetFile.exists(), "data: uri target file exists"); aDownload.targetFile.remove(false); dm.removeListener(listener); finish(); break;
Comment 29•16 years ago
|
||
Comment on attachment 311184 [details] [diff] [review] download scanner patch v.4 a1.9b5=beltzner, I can see the merit in having this for beta, also: tests, yay!
Attachment #311184 -
Flags: approval1.9b5?
Attachment #311184 -
Flags: approval1.9b5+
Attachment #311184 -
Flags: approval1.9+
Assignee | ||
Comment 30•16 years ago
|
||
updated
Attachment #311184 -
Attachment is obsolete: true
Attachment #311413 -
Flags: approval1.9b5?
Assignee | ||
Updated•16 years ago
|
Attachment #311413 -
Flags: approval1.9b5?
Comment 31•16 years ago
|
||
Comment on attachment 311413 [details] [diff] [review] download scanner patch v.5 >+ case dm.DOWNLOAD_FINISHED: >+ ok(true, "data: uri successfully downloaded"); >+ ok(aDownload.targetFile.exists(), "data: uri target file exists"); >+ aDownload.targetFile.remove(false); Ah. You'll need a try/catch around the remove because it'll throw if it can't delete the file. Shawn, that's an issue on windows, yeah? But in any case, with the patch, the test wouldn't hit the timeout anyway.
Comment 33•16 years ago
|
||
Hold on, do you have your patch from the dependent bug 416683 applied as well? The data uri should be hitting the BLOCKED_POLICY case -- not the FINISHED case with bug 416683 applied. no?
Comment 34•16 years ago
|
||
Just to clarify: without bug 416683, without bug 420230: data uri -> finished but deleted with bug 416683, without bug 420230: data uri -> blocked and deleted with bug 416683, with bug 420230: data uri -> finished and not deleted
Assignee | ||
Comment 35•16 years ago
|
||
yeah I'm looking at it....
Assignee | ||
Comment 36•16 years ago
|
||
ahh, we start off in state cancelled, skipping the use of AddDownload which is where the check takes place. This should be ok. new try/catch patch forthcoming..
Assignee | ||
Comment 37•16 years ago
|
||
actually, I _should_ be using AddDownload to test this!
Comment 38•16 years ago
|
||
Yeah you should be testing with AddDownload. Sorry about leading you to RetryDownload. (Should we be checking policy on retry?) Instead of adding a canceled download then retrying, do something similar to the first test which adds the download. 1) add a listener 2) add the download 3) check for state changes with the listener you don't actually need the download UI for this either. Shawn, should this be an xpcshell test or is that a SoC thing converting mochi tests to litmus tests if possible! ;)
Comment 39•16 years ago
|
||
argh. mochi -> xpcshell not litmus :p
Assignee | ||
Comment 40•16 years ago
|
||
> Yeah you should be testing with AddDownload. Sorry about leading you to
> RetryDownload. (Should we be checking policy on retry?)
Hmm, searching LXR, it looks like we always inject downloads via Add. Retry looks to be tied to the UI only.
Comment 41•16 years ago
|
||
we should use xpcshell whenever it's possible.
Assignee | ||
Comment 42•16 years ago
|
||
Ok, converted the whole thing over to a unit test, and confirmed failure on trunk, success with this patch applied.
Attachment #311413 -
Attachment is obsolete: true
Assignee | ||
Updated•16 years ago
|
Attachment #311474 -
Flags: review?(edilee)
Updated•16 years ago
|
Attachment #311474 -
Flags: review?(edilee) → review+
Comment 43•16 years ago
|
||
Comment on attachment 311474 [details] [diff] [review] download scanner patch v.6 let works in xpcshell now? sweeet. drivers: this fixes a nasty little regression on windows. patch has tests - yay! This also got a for 1.9 and for 1.9b5 already, but some reworking was done.
Attachment #311474 -
Flags: approval1.9b5?
Attachment #311474 -
Flags: approval1.9?
Updated•16 years ago
|
Whiteboard: [has patch][has review][needs approval]
Assignee | ||
Comment 44•16 years ago
|
||
(Note the changes were to the test and not the patch, which remains unchange.)
Comment 45•16 years ago
|
||
Comment on attachment 311474 [details] [diff] [review] download scanner patch v.6 No need to get approval again. I'll land this shortly.
Attachment #311474 -
Flags: approval1.9b5?
Attachment #311474 -
Flags: approval1.9?
Updated•16 years ago
|
Keywords: checkin-needed
Comment 46•16 years ago
|
||
Checking in toolkit/components/downloads/src/nsDownloadManager.cpp; /cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp,v <-- nsDownloadManager.cpp new revision: 1.178; previous revision: 1.177 done Checking in toolkit/components/downloads/src/nsDownloadScanner.cpp; /cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadScanner.cpp,v <-- nsDownloadScanner.cpp new revision: 1.17; previous revision: 1.16 done Checking in toolkit/components/downloads/src/nsDownloadScanner.h; /cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadScanner.h,v <-- nsDownloadScanner.h new revision: 1.10; previous revision: 1.9 done RCS file: /cvsroot/mozilla/toolkit/components/downloads/test/unit/test_bug_420230.js,v done Checking in toolkit/components/downloads/test/unit/test_bug_420230.js; /cvsroot/mozilla/toolkit/components/downloads/test/unit/test_bug_420230.js,v <-- test_bug_420230.js initial revision: 1.1 done
Status: NEW → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [has patch][has review][needs approval]
Target Milestone: --- → Firefox 3 beta5
Comment 47•16 years ago
|
||
There were two |case dm.DOWNLOAD_FAILED:| lines pointing at the same failure code in the test here. I checked in a fix, rs=gavin for that just now. Checking in toolkit/components/downloads/test/unit/test_bug_420230.js; /cvsroot/mozilla/toolkit/components/downloads/test/unit/test_bug_420230.js,v <-- test_bug_420230.js new revision: 1.2; previous revision: 1.1
Assignee | ||
Comment 48•16 years ago
|
||
Oops. Thanks Justin.
Comment 49•16 years ago
|
||
verified fixed using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5pre) Gecko/2008032505 Minefield/3.0b5pre and Win Vista nightly as well. I verified using the data URL and the testcase in the bug.
Status: RESOLVED → VERIFIED
Updated•16 years ago
|
Product: Firefox → Toolkit
Comment 51•14 years ago
|
||
(In reply to comment #0) > unable to save data urls to disk > > steps to reproduce > > 1) load the data url above > 2) attempt to save to disk > > I get the download manager, but the file is never saved. > > first spotted this with dolske's APNG Editor addon > > Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b4pre) Gecko/2008022704 > Minefield/3.0b4pre You can only download the image,because there is only an image.An web page does not exist.
You need to log in
before you can comment on or make changes to this bug.
Description
•