Bug 964511 - Delay Snippets.js initialization until after startup r=mfinkle

--HG--
extra : histedit_source : 4fba71c58717aad098c60bc767090741ef8f4883
This commit is contained in:
James Willcox 2014-07-11 16:15:39 -05:00
Родитель 7b2e2048f8
Коммит 475ffcfdc8
3 изменённых файлов: 6 добавлений и 4 удалений

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

@ -110,7 +110,7 @@ contract @mozilla.org/tab-source-service;1 {5850c76e-b916-4218-b99a-31f004e0a7e7
# Snippets.js
component {a78d7e59-b558-4321-a3d6-dffe2f1e76dd} Snippets.js
contract @mozilla.org/snippets;1 {a78d7e59-b558-4321-a3d6-dffe2f1e76dd}
category profile-after-change Snippets @mozilla.org/snippets;1
category browser-delayed-startup-finished Snippets @mozilla.org/snippets;1
category update-timer Snippets @mozilla.org/snippets;1,getService,snippets-update-timer,browser.snippets.updateInterval,86400
# WebappsUpdateTimer.js

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

@ -385,9 +385,6 @@ Snippets.prototype = {
observe: function(subject, topic, data) {
switch(topic) {
case "profile-after-change":
Services.obs.addObserver(this, "browser-delayed-startup-finished", false);
break;
case "browser-delayed-startup-finished":
Services.obs.removeObserver(this, "browser-delayed-startup-finished", false);
if (Services.prefs.getBoolPref("browser.snippets.syncPromo.enabled")) {

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

@ -24,6 +24,7 @@
#include "nsIDOMWakeLockListener.h"
#include "nsIPowerManagerService.h"
#include "nsINetworkLinkService.h"
#include "nsCategoryManagerUtils.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
@ -182,6 +183,7 @@ nsAppShell::Init()
mozilla::services::GetObserverService();
if (obsServ) {
obsServ->AddObserver(this, "xpcom-shutdown", false);
obsServ->AddObserver(this, "browser-delayed-startup-finished", false);
}
if (sPowerManagerService)
@ -207,6 +209,9 @@ nsAppShell::Observe(nsISupports* aSubject,
nsDependentString(aData).Equals(NS_LITERAL_STRING(PREFNAME_COALESCE_TOUCHES))) {
mAllowCoalescingTouches = Preferences::GetBool(PREFNAME_COALESCE_TOUCHES, true);
return NS_OK;
} else if (!strcmp(aTopic, "browser-delayed-startup-finished")) {
NS_CreateServicesFromCategory("browser-delayed-startup-finished", nullptr,
"browser-delayed-startup-finished");
}
return NS_OK;
}