Closed Bug 218817 Opened 21 years ago Closed 21 years ago

Split nsIHelperAppLauncher::GetDownloadInfo

Categories

(Core Graveyard :: File Handling, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.6alpha

People

(Reporter: Biesinger, Assigned: Biesinger)

Details

Attachments

(1 file, 1 obsolete file)

120   nsIFile getDownloadInfo(out nsIURI aSourceUrl, out long long
aTimeDownloadStarted);

this is a really ugly function, three things were mixed in here that don't
really belong together.
There is not one caller that requires all three pieces of information - see
http://lxr.mozilla.org/seamonkey/search?string=getdownloadinfo, all callers pass
some "dummy" or "garbage" variables into this function.

Also, |aSourceUrl| is alraedy available on the interface: 
 94   // the source url
 95   readonly attribute nsIURI source;

So this function should be split into two new attributes:
readonly attribute long long timeDownloadStarted;
readonly attribute nsIFile targetFile;
looking at this more closely, I realized that _nobody_ uses the timestamp:
http://lxr.mozilla.org/mozilla/search?string=getdownloadinfo
Attached patch patch (obsolete) — Splinter Review
Attachment #132059 - Flags: review?(bzbarsky)
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.6alpha
Comment on attachment 132059 [details] [diff] [review]
patch

>Index: embedding/components/ui/helperAppDlg/nsHelperAppDlg.js

>             // Need to get temporary file and check for executable-ness.
>             var ignore1 = new Object;
>             var ignore2 = new Object;
>-            var tmpFile = this.mLauncher.getDownloadInfo( ignore1, ignore2 );
>+            var tmpFile = this.mLauncher.targetFile;

We don't need ignore1 and ignore2 anymore.

>Index: uriloader/exthandler/nsIExternalHelperAppService.idl

I would leave a way to get the download start time on this interface for now.
Comment on attachment 132059 [details] [diff] [review]
patch

r=me with those changes
Attachment #132059 - Flags: review?(bzbarsky) → review+
Attached patch patch v2Splinter Review
Attachment #132059 - Attachment is obsolete: true
Comment on attachment 132086 [details] [diff] [review]
patch v2

changes made.
Attachment #132086 - Flags: superreview?(darin)
Attachment #132086 - Flags: review?(bzbarsky)
Comment on attachment 132086 [details] [diff] [review]
patch v2

>   if (mFinalFileDestination)
>   {
>     *aTarget = mFinalFileDestination;
>   }
>   else
>     *aTarget = mTempFile;

nit: fixup brackets to be consistent.  either always or never
use brackets when not needed.


>Index: uriloader/exthandler/nsIExternalHelperAppService.idl

>+  /** The file we are saving to */
>+  readonly attribute nsIFile targetFile;
>+  /** Time when the download started */
>+  readonly attribute PRTime timeDownloadStarted;

nit: would be nice to clean up all the comments in this file.
Attachment #132086 - Flags: superreview?(darin) → superreview+
Comment on attachment 132086 [details] [diff] [review]
patch v2

r=bzbarsky
Attachment #132086 - Flags: review?(bzbarsky) → review+
Checked in; I removed the braces on that if, and changed all comments in that
file to use the 
/**
 * description
 */
syntax
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: