diff options
Diffstat (limited to 'toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm')
-rw-r--r-- | toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm index 0dfb7cd109..c5a6ea545b 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm @@ -15,6 +15,9 @@ const Cu = Components.utils; this.EXPORTED_SYMBOLS = [ "AddonUpdateChecker" ]; +Components.utils.import("resource://gre/modules/Services.jsm"); +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + const TIMEOUT = 60 * 1000; const PREFIX_NS_RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#"; @@ -24,14 +27,13 @@ const PREFIX_THEME = "urn:mozilla:theme:"; const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; const TOOLKIT_ID = "toolkit@mozilla.org"; -const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; -const FIREFOX_APPCOMPATVERSION = "56.9" +const APPCOMPATID = Services.prefs.getCharPref("extensions.guid.appCompatId"); +const APPCOMPATVERSION = Services.prefs.getCharPref("extensions.guid.appCompatVersion"); const PREF_UPDATE_REQUIREBUILTINCERTS = "extensions.update.requireBuiltInCerts"; const PREF_EM_MIN_COMPAT_APP_VERSION = "extensions.minCompatibleAppVersion"; -Components.utils.import("resource://gre/modules/Services.jsm"); -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm"); @@ -523,13 +525,13 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) { maxVersion: getRequiredProperty(app, "max_version", "string"), } } -#ifdef MOZ_PHOENIX_EXTENSIONS - else if (FIREFOX_ID in applications) { +#ifdef UXP_APPCOMPAT_GUID + else if (APPCOMPATID in applications) { logger.debug("update.json: Dual-GUID targetApplication"); - app = getProperty(applications, FIREFOX_ID, "object"); + app = getProperty(applications, APPCOMPATID, "object"); appEntry = { - id: FIREFOX_ID, + id: APPCOMPATID, minVersion: getRequiredProperty(app, "min_version", "string"), maxVersion: getRequiredProperty(app, "max_version", "string"), } @@ -551,15 +553,15 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) { appEntry = { #ifdef MOZ_PHOENIX - id: FIREFOX_ID, + id: APPCOMPATID, minVersion: getProperty(app, "strict_min_version", "string", Services.prefs.getCharPref(PREF_EM_MIN_COMPAT_APP_VERSION)), #else id: TOOLKIT_ID, minVersion: platformVersion, #endif -#if defined(MOZ_PHOENIX) && defined(MOZ_PHOENIX_EXTENSIONS) - maxVersion: FIREFOX_APPCOMPATVERSION, +#if defined(MOZ_PHOENIX) && defined(UXP_APPCOMPAT_GUID) + maxVersion: APPCOMPATVERSION, #else maxVersion: '*', #endif @@ -825,8 +827,8 @@ function matchesVersions(aUpdate, aAppVersion, aPlatformVersion, return (Services.vc.compare(aAppVersion, app.minVersion) >= 0) && (aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0)); } -#ifdef MOZ_PHOENIX_EXTENSIONS - if (app.id == FIREFOX_ID) { +#ifdef UXP_APPCOMPAT_GUID + if (app.id == APPCOMPATID) { return (Services.vc.compare(aAppVersion, app.minVersion) >= 0) && (aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0)); } @@ -888,8 +890,8 @@ this.AddonUpdateChecker = { if (aIgnoreCompatibility) { for (let targetApp of update.targetApplications) { let id = targetApp.id; -#ifdef MOZ_PHOENIX_EXTENSIONS - if (id == Services.appinfo.ID || id == FIREFOX_ID || +#ifdef UXP_APPCOMPAT_GUID + if (id == Services.appinfo.ID || id == APPCOMPATID || id == TOOLKIT_ID) #else if (id == Services.appinfo.ID || id == TOOLKIT_ID) |