Bug 382711 - on migration or db upgrade of a profile with livemarks, we start up the livemark service' update timer (r=sspitzer)

This commit is contained in:
dietrich@mozilla.com 2008-01-17 22:58:52 -08:00
Родитель fcc16e97d6
Коммит 77783a1c0f
3 изменённых файлов: 29 добавлений и 3 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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() {