Closed Bug 24765 Opened 25 years ago Closed 24 years ago

use cache manager for downloaded jar files

Categories

(Core :: Networking: Cache, defect, P2)

All
Other
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: warrensomebody, Assigned: security-bugs)

References

()

Details

(Whiteboard: [nsbeta3+][PDTP2])

Attachments

(8 files)

Currently downloaded jar files end up in a subdirectory under the current process directory. We need to use the facilities in the cache manager to save jar files to that proper space accounting and cleanup is done.
Blocks: 12579
No longer blocks: 12579
Target Milestone: M14
Blocks: 12579
Warren, I suggest you mark this bug a duplicate of 21250.
I'd say this one depends on 21250. Once we have stream-as-file, we need to hook up the jar protocol to use it. Let's keep both of these.
Depends on: 21250
Keywords: beta1
PDT+
Whiteboard: [PDT+]
I'm not sure why this was marked PDT+. I think it's perfectly fine if the cache doesn't manage downloaded jar files right now. Yes, they'll pile up and won't get flushed, but that seems ok for beta. Removing PDT+ designation from whiteboard in hopes that they'll read this and reaccess. Probably was just a mistake that I put beta1 in the keywords.
Whiteboard: [PDT+]
We should adjust 21250 based on the status of this bug. Bug 21250 is currently not a beta1 candidate.
Whiteboard: [PDT-]
Moving to M15.
Target Milestone: M14 → M15
Marking beta2.
Keywords: beta2
M16
Target Milestone: M15 → M16
Moving to M17 which is now considered part of beta2.
Target Milestone: M16 → M17
Keywords: beta1
Whiteboard: [PDT-] → 1d
Keywords: nsbeta2
Putting on [nsbeta2-] radar. Not critical to beta2. Spoke with warren, he is cool with this.
Whiteboard: 1d → [nsbeta2-]1d
A must for nsbeta3. We're currently eating up the user's disk space and never freeing it. We all know how this was a customer escalation in 3.x.
Keywords: nsbeta2nsbeta3
Whiteboard: [nsbeta2-]1d → [nsbeta3+]
*** Bug 48536 has been marked as a duplicate of this bug. ***
Blocks: 27009
Reassigning to me.
Assignee: warren → mstoltz
Status: NEW → ASSIGNED
Target Milestone: M17 → M18
I'm attaching a patch plus three new files which should be installed as netwerk/base/public/nsIDownloader.idl, base/src/nsDownloader.h, and base/src/nsDownloader.cpp. I've tested this for several remote JAR URLs and some jar:file URLs as well, it seems to work in both cases. All of my testcases called AsyncRead() on the JARChannel; I can't find a case which tests OpenInputStream() so I'm not sure if this works. Do you know how to trigger this case, Warren? Subsequent reloads of the same page seem to be hitting the cache, not the network. I can't really tell how good it is about updating when the remote file changes, but it seems to do roughly as well as ordinary http pages. jar:ftp: does not work since ftp does not support stream-as-file caching, but that's not a high priority. I've also made signature verification lazy and added some code to nsJARURI so that GetHost() and similar calls will work for JAR URLs.
Blocks: 48319
I tried the patch and it doesn't work. Nothing comes up at all. Sorry, but I don't have time to trace through it before I leave. I'll enclose my updated diffs though.
BTW, Mitch, the changes you made to nsJARURI aren't right (I noticed them in my revised patch). Jar URLs don't have any concept of a host/port/username/password/prehost or path. Those methods need to fail. I suspect you implemented them because you found that they were called and caused something else to fail. Let's find the place that's trying to access them and see what it's trying to do.
Blocks: 49288
Upping priority since the jar protocol and signed scripts are of limited usefulness without this.
Priority: P3 → P1
PDT thinks this is P2.
Priority: P1 → P2
Whiteboard: [nsbeta3+] → [nsbeta3+][PDTP2]
diff -u format please, I am not going to review diff -c with bogus indentation. There appear to be tab and indentation problems and variations (the in boolean synchronous parameter to init in nsIDownLoader.idl, the mixing of four-space with two-space indentation in nsDownLoader.cpp, etc.). For example, ! if (mObserver && (NS_FAILED(rv) || localFile)) ! { There is an else-after-return non-sequitur, two-space rather than four-space equivalent indentation, and more brace-style conflict with the prevailing style used in the rest of the file on the subsequent lines: ! if (aSynchronous) ! return mObserver->OnDownloadComplete(this, mContext, rv, localFile); ! else ! { ! // If the open failed or the file is local, call the observer. ! // don't callback synchronously as it puts the caller ! // in a recursive situation and breaks the asynchronous ! // semantics of nsIDownloader ! nsresult rv2 = NS_OK; ! NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager, ! kProxyObjectManagerCID, &rv); ! if (NS_FAILED(rv2)) return rv2; ! nsCOMPtr<nsIDownloadObserver> pObserver; We just indented four spaces for no reason -- hard tabs in file? ! rv2 = pIProxyObjectManager->GetProxyForObject(NS_CURRENT_EVENTQ, ! NS_GET_IID(nsIDownloadObserver), mObserver, ! PROXY_ASYNC | PROXY_ALWAYS, getter_AddRefs(pObserver)); ! if (NS_FAILED(rv2)) return rv2; ! return pObserver->OnDownloadComplete(this, mContext, rv, localFile); ! } It's not good manners to go against the prevailing style used in netwerk code, but if you own this file (it looks like you checked in the first revision) and want to assert your own style, please make it self-consistent style throughout. /be
By Jove, I think we've got it. Fix checked in, finally. We should no longer be creating a bin/components/jarCache directory, and files loaded via the jar protocol from an http source should stay up to date according to the standard file cache policy.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: