зеркало из https://github.com/mozilla/gecko-dev.git
Bug 684727 - Don't call into JNI from ExtensionsView.init [r=mbrubeck]
This commit is contained in:
Родитель
8be62ad5ae
Коммит
a1bc4b2fab
|
@ -221,17 +221,6 @@ var ExtensionsView = {
|
|||
let os = Services.obs;
|
||||
os.addObserver(this, "addon-update-started", false);
|
||||
os.addObserver(this, "addon-update-ended", false);
|
||||
|
||||
if (!Services.prefs.getBoolPref("extensions.hideUpdateButton"))
|
||||
document.getElementById("addons-update-all").hidden = false;
|
||||
|
||||
#ifdef ANDROID
|
||||
// Hide the notification
|
||||
let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener);
|
||||
if (progressListener)
|
||||
progressListener.onCancel(ADDONS_NOTIFICATION_NAME);
|
||||
#endif
|
||||
},
|
||||
|
||||
delayedInit: function ev__delayedInit() {
|
||||
|
@ -259,6 +248,9 @@ var ExtensionsView = {
|
|||
this._strings["addonType.locale"] = strings.GetStringFromName("addonType.8");
|
||||
this._strings["addonType.search"] = strings.GetStringFromName("addonType.1024");
|
||||
|
||||
if (!Services.prefs.getBoolPref("extensions.hideUpdateButton"))
|
||||
document.getElementById("addons-update-all").hidden = false;
|
||||
|
||||
let self = this;
|
||||
setTimeout(function() {
|
||||
self.getAddonsFromLocal();
|
||||
|
@ -272,6 +264,8 @@ var ExtensionsView = {
|
|||
os.removeObserver(this, "addon-update-ended");
|
||||
|
||||
AddonManager.removeInstallListener(this._dloadmgr);
|
||||
|
||||
this.hideAlerts();
|
||||
},
|
||||
|
||||
hideOnSelect: function ev_handleEvent(aEvent) {
|
||||
|
@ -840,6 +834,10 @@ var ExtensionsView = {
|
|||
let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
alerts.showAlertNotification(URI_GENERIC_ICON_XPINSTALL, strings.GetStringFromName("alertAddons"),
|
||||
aMessage, true, "", observer, ADDONS_NOTIFICATION_NAME);
|
||||
|
||||
// Use a preference to help us cleanup this notification in case we don't shutdown correctly
|
||||
Services.prefs.setBoolPref("browser.notifications.pending.addons", true);
|
||||
Services.prefs.savePrefFile(null);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -848,8 +846,12 @@ var ExtensionsView = {
|
|||
#ifdef ANDROID
|
||||
let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener);
|
||||
progressListener.onCancel(ADDONS_NOTIFICATION_NAME);
|
||||
if (progressListener)
|
||||
progressListener.onCancel(ADDONS_NOTIFICATION_NAME);
|
||||
#endif
|
||||
|
||||
// Keep our preference in sync
|
||||
Services.prefs.clearUserPref("browser.notifications.pending.addons");
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -999,8 +1001,10 @@ AddonInstallListener.prototype = {
|
|||
#ifdef ANDROID
|
||||
let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener);
|
||||
progressListener.onProgress(ADDONS_NOTIFICATION_NAME, aInstall.progress, aInstall.maxProgress);
|
||||
if (progressListener)
|
||||
progressListener.onProgress(ADDONS_NOTIFICATION_NAME, aInstall.progress, aInstall.maxProgress);
|
||||
#endif
|
||||
|
||||
if (!element)
|
||||
return;
|
||||
|
||||
|
|
|
@ -38,6 +38,9 @@ const Ci = Components.interfaces;
|
|||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const ADDONS_NOTIFICATION_NAME = "addons";
|
||||
|
||||
// Custom factory object to ensure that we're a singleton
|
||||
const BrowserStartupServiceFactory = {
|
||||
|
@ -55,19 +58,18 @@ function BrowserStartup() {
|
|||
|
||||
BrowserStartup.prototype = {
|
||||
// for XPCOM
|
||||
classID: Components.ID("{1d542abc-c88b-4636-a4ef-075b49806317}"),
|
||||
classID: Components.ID("{1d542abc-c88b-4636-a4ef-075b49806317}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
_xpcom_factory: BrowserStartupServiceFactory,
|
||||
|
||||
_init: function () {
|
||||
this._observerService = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
this._observerService.addObserver(this, "places-init-complete", false);
|
||||
_init: function() {
|
||||
Services.obs.addObserver(this, "places-init-complete", false);
|
||||
Services.obs.addObserver(this, "final-ui-startup", false);
|
||||
},
|
||||
|
||||
_initDefaultBookmarks: function () {
|
||||
_initDefaultBookmarks: function() {
|
||||
// We must instantiate the history service since it will tell us if we
|
||||
// need to import or restore bookmarks due to first-run, corruption or
|
||||
// forced migration (due to a major schema change).
|
||||
|
@ -128,12 +130,31 @@ BrowserStartup.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_startupActions: function() {
|
||||
#ifdef ANDROID
|
||||
// Hide the notification if we had any pending operations
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("browser.notifications.pending.addons")) {
|
||||
Services.prefs.clearUserPref("browser.notifications.pending.addons")
|
||||
let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener);
|
||||
if (progressListener)
|
||||
progressListener.onCancel(ADDONS_NOTIFICATION_NAME);
|
||||
}
|
||||
} catch (e) {}
|
||||
#endif
|
||||
},
|
||||
|
||||
// nsIObserver
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "places-init-complete":
|
||||
Services.obs.removeObserver(this, "places-init-complete");
|
||||
this._initDefaultBookmarks();
|
||||
this._observerService.removeObserver(this, "places-init-complete");
|
||||
break;
|
||||
case "final-ui-startup":
|
||||
Services.obs.removeObserver(this, "final-ui-startup");
|
||||
this._startupActions();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ EXTRA_PP_COMPONENTS = \
|
|||
MobileComponents.manifest \
|
||||
AboutRedirector.js \
|
||||
BrowserCLH.js \
|
||||
BrowserStartup.js \
|
||||
DirectoryProvider.js\
|
||||
HelperAppDialog.js \
|
||||
Sidebar.js \
|
||||
|
@ -64,7 +65,6 @@ EXTRA_PP_COMPONENTS = \
|
|||
|
||||
EXTRA_COMPONENTS = \
|
||||
AlertsService.js \
|
||||
BrowserStartup.js \
|
||||
ContentPermissionPrompt.js \
|
||||
XPIDialogService.js \
|
||||
DownloadManagerUI.js \
|
||||
|
|
Загрузка…
Ссылка в новой задаче