Bug 1388145 - Move the Downloads progress code initialization to an idle callback. r=paolo
MozReview-Commit-ID: 5cgvfKq5Mj4
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1623,32 +1623,17 @@ var gBrowserInit = {
Cu.import("resource:///modules/UpdateTopLevelContentWindowIDHelper.jsm", {})
.trackBrowserWindow(window);
PlacesToolbarHelper.init();
ctrlTab.readPref();
gPrefService.addObserver(ctrlTab.prefName, ctrlTab);
- // Initialize the download manager some time after the app starts so that
- // auto-resume downloads begin (such as after crashing or quitting with
- // active downloads) and speeds up the first-load of the download manager UI.
- // If the user manually opens the download manager before the timeout, the
- // downloads will start right away, and initializing again won't hurt.
- setTimeout(function() {
- try {
- DownloadsCommon.initializeAllDataLinks();
- Cu.import("resource:///modules/DownloadsTaskbar.jsm", {})
- .DownloadsTaskbar.registerIndicator(window);
- } catch (ex) {
- Cu.reportError(ex);
- }
- }, 10000);
-
- // The object handling the downloads indicator is also initialized here in the
+ // The object handling the downloads indicator is initialized here in the
// delayed startup function, but the actual indicator element is not loaded
// unless there are downloads to be displayed.
DownloadsButton.initializeIndicator();
if (AppConstants.platform != "macosx") {
updateEditUIVisibility();
let placesContext = document.getElementById("placesContext");
placesContext.addEventListener("popupshowing", updateEditUIVisibility);
@@ -1769,16 +1754,31 @@ var gBrowserInit = {
// setup history swipe animation
gHistorySwipeAnimation.init();
});
scheduleIdleTask(() => {
gBrowserThumbnails.init();
});
+
+ scheduleIdleTask(() => {
+ // Initialize the download manager some time after the app starts so that
+ // auto-resume downloads begin (such as after crashing or quitting with
+ // active downloads) and speeds up the first-load of the download manager UI.
+ // If the user manually opens the download manager before the timeout, the
+ // downloads will start right away, and initializing again won't hurt.
+ try {
+ DownloadsCommon.initializeAllDataLinks();
+ Cu.import("resource:///modules/DownloadsTaskbar.jsm", {})
+ .DownloadsTaskbar.registerIndicator(window);
+ } catch (ex) {
+ Cu.reportError(ex);
+ }
+ }, {timeout: 10000});
},
// Returns the URI(s) to load at startup.
_getUriToLoad() {
// window.arguments[0]: URI to load (string), or an nsIArray of
// nsISupportsStrings to load, or a xul:tab of
// a tabbrowser, which will be replaced by this
// window (for this case, all other arguments are