Closed Bug 494550 Opened 15 years ago Closed 15 years ago

Get nsIDownloadManager initialization out of startup path

Categories

(Firefox for Android Graveyard :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mfinkle, Assigned: mfinkle)

References

Details

Attachments

(1 file)

Bug 489686 landed some fixes to reduce a Ts regression. The result seemed to have no affect on Ts. This might be due to the initialization of the nsIDownloadManager in the DownloadsView.init() method. We add a listener so we can display popup alerts when a file is downloaded.

We should try to use the observer notification fired by the nsIDownloadManager ("download-started") to display the initial popup alert and then attach the listener so we get the download complete trigger too. This should keep the download manager out of the startup path.
tracking-fennec: --- → ?
Assignee: nobody → mark.finkle
Attached patch patchSplinter Review
This patch gets the DM out of our explicit startup patch. There might be other ways the DM is being intialized, but we can track those down as we find them.

This patch uses the ObserverService to listen for notifications sent by the DM when a file download starts/ends. The patch removes the download progress listener we were using to monitor downloads for alerts.

The patch adds nsISupportsWeakReference to downloads and extensions for the ObserverService.

The patch adjusts the alert XUL so long text breaks correctly and doesn't just cause the alert to get wider.
Attachment #379681 - Flags: review?(gavin.sharp)
Blocks: 491479
Attachment #379681 - Flags: review?(gavin.sharp) → review+
Comment on attachment 379681 [details] [diff] [review]
patch

>diff --git a/chrome/content/downloads.js b/chrome/content/downloads.js

>   init: function dv_init() {

>+    var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
>+    os.addObserver(this, "dl-start", true);
>+    os.addObserver(this, "dl-failed", true);
>+    os.addObserver(this, "dl-done", true);

what about dl-blocked/dl-dirty/dl-cancel? I guess blocked/dirty can't currently happen since we don't have a backend for scanning, and cancel can't happen outside of our UI? Probably wouldn't hurt to listen for these anyways, though...
Added the other dl-* notifications. Pushed:
http://hg.mozilla.org/mobile-browser/rev/5bbb4c203890
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
tracking-fennec: ? → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: