diff options
Diffstat (limited to 'toolkit/mozapps/extensions/internal')
5 files changed, 40 insertions, 39 deletions
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm index 9750e99445..8b094850e9 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm +++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm @@ -39,8 +39,7 @@ const PREF_GETADDONS_BROWSERECOMMENDED = "extensions.getAddons.recommended.bro const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url"; const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL"; const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url"; -const PREF_GETADDONS_DB_SCHEMA = "extensions.getAddons.databaseSchema" - +const PREF_GETADDONS_DB_SCHEMA = "extensions.getAddons.databaseSchema"; const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdate"; const PREF_METADATA_UPDATETHRESHOLD_SEC = "extensions.getAddons.cache.updateThreshold"; const DEFAULT_METADATA_UPDATETHRESHOLD_SEC = 172800; // two days @@ -64,8 +63,8 @@ const BLANK_DB = function() { } const TOOLKIT_ID = "toolkit@mozilla.org"; -#ifdef MOZ_PHOENIX_EXTENSIONS -const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; +#ifdef UXP_APPCOMPAT_GUID +const APPCOMPATID = Services.prefs.getCharPref("extensions.guid.appCompatId"); #endif Cu.import("resource://gre/modules/Log.jsm"); const LOGGER_ID = "addons.repository"; @@ -1254,9 +1253,9 @@ this.AddonRepository = { let results = []; function isSameApplication(aAppNode) { -#ifdef MOZ_PHOENIX_EXTENSIONS +#ifdef UXP_APPCOMPAT_GUID if (self._getTextContent(aAppNode) == Services.appinfo.ID || - self._getTextContent(aAppNode) == FIREFOX_ID) { + self._getTextContent(aAppNode) == APPCOMPATID) { #else if (self._getTextContent(aAppNode) == Services.appinfo.ID) { #endif 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) diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index e12549094d..add3f3d727 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -134,9 +134,9 @@ const RDFURI_INSTALL_MANIFEST_ROOT = "urn:mozilla:install-manifest"; const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#"; const TOOLKIT_ID = "toolkit@mozilla.org"; -#ifdef MOZ_PHOENIX_EXTENSIONS -const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" -const FIREFOX_APPCOMPATVERSION = "56.9" +#ifdef UXP_APPCOMPAT_GUID +const APPCOMPATID = Services.prefs.getCharPref("extensions.guid.appCompatId"); +const APPCOMPATVERSION = Services.prefs.getCharPref("extensions.guid.appCompatVersion"); #endif // The value for this is in Makefile.in @@ -6403,25 +6403,25 @@ AddonInternal.prototype = { if (!aPlatformVersion) aPlatformVersion = Services.appinfo.platformVersion; -#ifdef MOZ_PHOENIX_EXTENSIONS +#ifdef UXP_APPCOMPAT_GUID this.native = false; #endif let version; if (app.id == Services.appinfo.ID) { version = aAppVersion; -#ifdef MOZ_PHOENIX_EXTENSIONS +#ifdef UXP_APPCOMPAT_GUID this.native = true; } - else if (app.id == FIREFOX_ID) { - version = FIREFOX_APPCOMPATVERSION; + else if (app.id == APPCOMPATID) { + version = APPCOMPATVERSION; if (this.type != "extension") - //Only allow extensions in Firefox compatibility mode + //Only allow extensions in AppCompat GUID compatibility mode return false; #endif } else if (app.id == TOOLKIT_ID) { -#ifdef MOZ_PHOENIX_EXTENSIONS +#ifdef UXP_APPCOMPAT_GUID this.native = true; #endif version = aPlatformVersion; @@ -6446,8 +6446,8 @@ AddonInternal.prototype = { // Extremely old extensions should not be compatible by default. let minCompatVersion; -#ifdef MOZ_PHOENIX_EXTENSIONS - if (app.id == Services.appinfo.ID || app.id == FIREFOX_ID) +#ifdef UXP_APPCOMPAT_GUID + if (app.id == Services.appinfo.ID || app.id == APPCOMPATID) #else if (app.id == Services.appinfo.ID) #endif @@ -6474,14 +6474,14 @@ AddonInternal.prototype = { if (targetApp.id == TOOLKIT_ID) app = targetApp; } -#ifdef MOZ_PHOENIX_EXTENSIONS - // Special case: check for Firefox TargetApps. this has to be done AFTER +#ifdef UXP_APPCOMPAT_GUID + // Special case: check for AppCompat GUID TargetApps. this has to be done AFTER // the initial check to make sure appinfo.ID is preferred, even if - // Firefox is listed before it in the install manifest. + // AppCompat GUID is listed before it in the install manifest. // Only do this for extensions. Other types should not be allowed. if (this.type == "extension") { for (let targetApp of this.targetApplications) { - if (targetApp.id == FIREFOX_ID) //Firefox GUID + if (targetApp.id == APPCOMPATID) // AppCompat GUID return targetApp; } } diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index 512479d762..c1a120b2bf 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -71,7 +71,7 @@ const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type", "softDisabled", "foreignInstall", "hasBinaryComponents", "strictCompatibility", "locales", "targetApplications", "targetPlatforms", "multiprocessCompatible", -#ifdef MOZ_PHOENIX_EXTENSIONS +#ifdef UXP_APPCOMPAT_GUID "native" #endif ]; diff --git a/toolkit/mozapps/extensions/internal/moz.build b/toolkit/mozapps/extensions/internal/moz.build index 3b967e0c6f..7183aa67aa 100644 --- a/toolkit/mozapps/extensions/internal/moz.build +++ b/toolkit/mozapps/extensions/internal/moz.build @@ -30,5 +30,5 @@ if CONFIG['MOZ_EM_DEBUG']: DEFINES['MOZ_EM_DEBUG'] = 1 # Apperently this needs to be defined because it isn't picked up automagically any more -if CONFIG['MOZ_PHOENIX_EXTENSIONS']: - DEFINES['MOZ_PHOENIX_EXTENSIONS'] = 1
\ No newline at end of file +if CONFIG['UXP_APPCOMPAT_GUID']: + DEFINES['UXP_APPCOMPAT_GUID'] = 1 |