diff --git a/mozilla/browser/base/content/browser.js b/mozilla/browser/base/content/browser.js index e0a4ebd72a7..58d098ff0d4 100644 --- a/mozilla/browser/base/content/browser.js +++ b/mozilla/browser/base/content/browser.js @@ -1049,6 +1049,13 @@ function delayedStartup() // themselves. gBrowser.addEventListener("command", BrowserOnCommand, false); + // Delayed initialization of the livemarks update timer. + // Livemark updates don't need to start until after bookmark UI + // such as the toolbar has initialized. Starting 5 seconds after + // delayedStartup in order to stagger this before the download + // manager starts (see below). + setTimeout(function() PlacesUtils.livemarks.start(), 5000); + // 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. diff --git a/mozilla/toolkit/components/places/public/nsILivemarkService.idl b/mozilla/toolkit/components/places/public/nsILivemarkService.idl index fbee1496f7e..09375a0264c 100644 --- a/mozilla/toolkit/components/places/public/nsILivemarkService.idl +++ b/mozilla/toolkit/components/places/public/nsILivemarkService.idl @@ -42,9 +42,16 @@ interface nsIURI; interface nsINavBookmarksService; -[scriptable, uuid(602e3a71-2d10-4d8f-80c2-6db302b5c89d)] +[scriptable, uuid(7879747e-8871-4a7b-9032-5c4fff1d6017)] interface nsILivemarkService : nsISupports { + /** + * Starts the livemark refresh timer. + * Being able to manually control this allows activity such + * as bookmarks import to occur without kicking off HTTP traffic. + */ + void start(); + /** * Creates a new livemark * @param folder The id of the parent folder diff --git a/mozilla/toolkit/components/places/src/nsLivemarkService.js b/mozilla/toolkit/components/places/src/nsLivemarkService.js index 33b861502f0..ece6c50e252 100644 --- a/mozilla/toolkit/components/places/src/nsLivemarkService.js +++ b/mozilla/toolkit/components/places/src/nsLivemarkService.js @@ -147,8 +147,6 @@ function LivemarkService() { new G_ObserverServiceObserver('xpcom-shutdown', BindToObject(this._shutdown, this), true /*only once*/); - new G_Alarm(BindToObject(this._fireTimer, this), LIVEMARK_TIMEOUT, - true /* repeat */); if (IS_CONTRACTID in Cc) this._idleService = Cc[IS_CONTRACTID].getService(Ci.nsIIdleService); @@ -183,6 +181,14 @@ LivemarkService.prototype = { return this.__history; }, + _updateTimer: null, + start: function LS_start() { + if (this._updateTimer) + return; + this._updateTimer = new G_Alarm(BindToObject(this._fireTimer, this), + LIVEMARK_TIMEOUT, true /* repeat */); + }, + // returns new length of _livemarks _pushLivemark: function LS__pushLivemark(folderId, feedURI) { return this._livemarks.push({folderId: folderId, feedURI: feedURI}); @@ -204,6 +210,12 @@ LivemarkService.prototype = { if (livemark.loadGroup) livemark.loadGroup.cancel(NS_BINDING_ABORTED); } + + // kill timer + if (this._updateTimer) { + this._updateTimer.cancel(); + this._updateTimer = null; + } }, _fireTimer: function LS__fireTimer() {