зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1221270 - Schedule and perform GMP updates in AddonUpdateService; r=snorp
This patch moves the GMP update process from browser.js startup to AddonUpdateService. It also uses the Gecko:ScheduleRun event in GeckoService to schedule headless runs in order to perform updates periodically.
This commit is contained in:
Родитель
3f2aedd313
Коммит
0b336e064b
|
@ -116,9 +116,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "SharedPreferences",
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "Notifications",
|
||||
"resource://gre/modules/Notifications.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "GMPInstallManager",
|
||||
"resource://gre/modules/GMPInstallManager.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
|
||||
|
@ -617,11 +614,6 @@ var BrowserApp = {
|
|||
InitLater(() => Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager));
|
||||
InitLater(() => LoginManagerParent.init(), window, "LoginManagerParent");
|
||||
|
||||
InitLater(() => {
|
||||
BrowserApp.gmpInstallManager = new GMPInstallManager();
|
||||
BrowserApp.gmpInstallManager.simpleCheckAndInstall().then(null, () => {});
|
||||
}, BrowserApp, "gmpInstallManager");
|
||||
|
||||
}, false);
|
||||
},
|
||||
|
||||
|
@ -1390,10 +1382,6 @@ var BrowserApp = {
|
|||
},
|
||||
|
||||
quit: function quit(aClear = { sanitize: {}, dontSaveSession: false }) {
|
||||
if (this.gmpInstallManager) {
|
||||
this.gmpInstallManager.uninit();
|
||||
}
|
||||
|
||||
// Notify all windows that an application quit has been requested.
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
|
||||
|
|
|
@ -15,6 +15,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonManagerPrivate",
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
|
||||
"resource://gre/modules/addons/AddonRepository.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "GMPInstallManager",
|
||||
"resource://gre/modules/GMPInstallManager.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Messaging",
|
||||
"resource://gre/modules/Messaging.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
|
||||
function getPref(func, preference, defaultValue) {
|
||||
|
@ -30,6 +36,7 @@ function getPref(func, preference, defaultValue) {
|
|||
// -----------------------------------------------------------------------
|
||||
|
||||
const PREF_ADDON_UPDATE_ENABLED = "extensions.autoupdate.enabled";
|
||||
const PREF_ADDON_UPDATE_INTERVAL = "extensions.autoupdate.interval";
|
||||
|
||||
var gNeedsRestart = false;
|
||||
|
||||
|
@ -50,6 +57,17 @@ AddonUpdateService.prototype = {
|
|||
return;
|
||||
|
||||
AddonManagerPrivate.backgroundUpdateCheck();
|
||||
|
||||
let gmp = new GMPInstallManager();
|
||||
gmp.simpleCheckAndInstall().then(null, () => {});
|
||||
|
||||
let interval = 1000 * getPref("getIntPref", PREF_ADDON_UPDATE_INTERVAL, 86400);
|
||||
Messaging.sendRequest({
|
||||
type: "Gecko:ScheduleRun",
|
||||
action: "update-addons",
|
||||
trigger: interval,
|
||||
interval: interval,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче