Closed
Bug 263127
Opened 21 years ago
Closed 18 years ago
nsDownloader keeps tempfile open too long
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jruderman, Assigned: jwkbugzilla)
References
Details
Attachments
(3 files, 4 obsolete files)
|
2.80 KB,
text/html
|
Details | |
|
1.63 KB,
patch
|
Biesinger
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
|
1.74 KB,
patch
|
jwkbugzilla
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
When I give nsDownloader a temp file to download to, I run into two problems:
1. onDownloadComplete sometimes happens before the file is fully written. So
when the program tries to open the file, it sees an empty (?) file.
2. Firefox usually keeps the file open too long, so I can't delete the file
manually. Also, some programs get a sharing violation when they try to open the
file, perhaps because they open the file read/write instead of read.
These two problems might have the same root cause. That is, it might be that
whatever keeps the file open too long also prevents it from being flushed when
it should be.
| Reporter | ||
Comment 1•21 years ago
|
||
This testcase requires chrome privs. One way to test it is to install
http://ted.mielczarek.org/code/mozilla/extensiondev/ and paste this testcase
into a chrome Real-Time HTML Editor.
Comment 2•21 years ago
|
||
clarifying summary, the object keeps the file open, not its init function.
onstopr should probably call mSink->Flush() and then release it (in the case
where it wrote to the file itself)
Summary: nsDownloader::init(observer, tempfile) keeps tempfile open too long → nsDownloader keeps tempfile open too long
Updated•19 years ago
|
Assignee: darin → nobody
QA Contact: benc → networking
Version: 1.7 Branch → Trunk
Comment 3•18 years ago
|
||
Appears as problem for TomTom, can't delete temp files. We need to either fix it or stop using the class.
Comment 4•18 years ago
|
||
Null out the sink in |OnStopRequest| if we have one.
Comment 5•18 years ago
|
||
Also works if we only have a sink but |status| did not indicate success, and flus()es first.
Attachment #268288 -
Attachment is obsolete: true
Comment 6•18 years ago
|
||
biesi says: instead of Flush(), do Close() and the null out.
| Assignee | ||
Comment 7•18 years ago
|
||
Replaced Flush() by Close(), made destructor do the same as OnStopRequest() and adjusted style slightly.
Attachment #268419 -
Attachment is obsolete: true
Attachment #268487 -
Flags: superreview?
Attachment #268487 -
Flags: review?
| Assignee | ||
Updated•18 years ago
|
Attachment #268487 -
Flags: superreview?(darin.moz)
Attachment #268487 -
Flags: superreview?
Attachment #268487 -
Flags: review?(cbiesinger)
Attachment #268487 -
Flags: review?
Comment 8•18 years ago
|
||
Comment on attachment 268487 [details] [diff] [review]
Patch v1.1
please write a unit test before checking this in
Attachment #268487 -
Flags: review?(cbiesinger) → review+
| Assignee | ||
Comment 9•18 years ago
|
||
Assignee: nobody → trev.moz
Status: NEW → ASSIGNED
Attachment #268804 -
Flags: superreview?(darin.moz)
Attachment #268804 -
Flags: review?(cbiesinger)
| Assignee | ||
Comment 10•18 years ago
|
||
Sorry, used wrong bug number in the testcase.
Attachment #268804 -
Attachment is obsolete: true
Attachment #268805 -
Flags: superreview?(darin.moz)
Attachment #268805 -
Flags: review?(cbiesinger)
Attachment #268804 -
Flags: superreview?(darin.moz)
Attachment #268804 -
Flags: review?(cbiesinger)
Comment 11•18 years ago
|
||
Comment on attachment 268805 [details] [diff] [review]
xpcshell testcase
I'd have used an existing path instead of writing a new request handler, but sure...
also, you have to stop the server in onDownloadComplete, or you'll get xpconnect assertions
Attachment #268805 -
Flags: review?(cbiesinger) → review+
| Assignee | ||
Comment 12•18 years ago
|
||
Attachment #268805 -
Attachment is obsolete: true
Attachment #268913 -
Flags: superreview?(darin.moz)
Attachment #268913 -
Flags: review+
Attachment #268805 -
Flags: superreview?(darin.moz)
| Assignee | ||
Updated•18 years ago
|
Attachment #268913 -
Attachment description: Testcase with biesi → Testcase with biesi's corrections
Updated•18 years ago
|
Attachment #268487 -
Flags: superreview?(darin.moz) → superreview+
Updated•18 years ago
|
Attachment #268913 -
Flags: superreview?(darin.moz) → superreview+
| Assignee | ||
Updated•18 years ago
|
Keywords: checkin-needed
Comment 14•18 years ago
|
||
Checking in netwerk/base/src/nsDownloader.cpp;
/cvsroot/mozilla/netwerk/base/src/nsDownloader.cpp,v <-- nsDownloader.cpp
new revision: 1.19; previous revision: 1.18
done
RCS file: /cvsroot/mozilla/netwerk/test/unit/test_bug263127.js,v
done
Checking in netwerk/test/unit/test_bug263127.js;
/cvsroot/mozilla/netwerk/test/unit/test_bug263127.js,v <-- test_bug263127.js
initial revision: 1.1
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Keywords: checkin-needed
Updated•18 years ago
|
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•