summaryrefslogtreecommitdiff
path: root/components/addons/src/XPIProvider.jsm
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-02-09 01:08:38 -0600
committerMatt A. Tobin <email@mattatobin.com>2022-02-09 01:08:38 -0600
commit6231b9e2ed5cc27fbbc5854c32c7af7f3ec1b279 (patch)
tree6be724e6209558dc22727f41fab884f003406a88 /components/addons/src/XPIProvider.jsm
parenta2c6d634e83d1138c39ba2a93b21c37c3cd1a3c4 (diff)
downloadaura-central-6231b9e2ed5cc27fbbc5854c32c7af7f3ec1b279.tar.gz
[fxguid] Part 3 - Add reverse-dual-guid hack for Pale Moon
Diffstat (limited to 'components/addons/src/XPIProvider.jsm')
-rw-r--r--components/addons/src/XPIProvider.jsm40
1 files changed, 35 insertions, 5 deletions
diff --git a/components/addons/src/XPIProvider.jsm b/components/addons/src/XPIProvider.jsm
index d3948e8aa..b97edfcdb 100644
--- a/components/addons/src/XPIProvider.jsm
+++ b/components/addons/src/XPIProvider.jsm
@@ -135,6 +135,10 @@ const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
const TOOLKIT_ID = "toolkit@mozilla.org";
+#ifdef MC_APP_ID
+#expand const ALT_APP_ID = "__MC_APP_ID__";
+#endif
+
// The value for this is in Makefile.in
#expand const DB_SCHEMA = __MOZ_EXTENSIONS_DB_SCHEMA__;
XPCOMUtils.defineConstant(this, "DB_SCHEMA", DB_SCHEMA);
@@ -6403,7 +6407,11 @@ AddonInternal.prototype = {
aPlatformVersion = Services.appinfo.greVersion;
let version;
+#ifdef MC_APP_ID
+ if (app.id == ALT_APP_ID || app.id == Services.appinfo.ID) {
+#else
if (app.id == Services.appinfo.ID) {
+#endif
version = aAppVersion;
}
else if (app.id == TOOLKIT_ID) {
@@ -6429,7 +6437,11 @@ AddonInternal.prototype = {
// Extremely old extensions should not be compatible by default.
let minCompatVersion;
- if (app.id == Services.appinfo.ID)
+#ifdef MC_APP_ID
+ if (app.id == ALT_APP_ID || app.id == Services.appinfo.ID)
+#else
+ if (app.id == Services.appinfo.ID)
+#endif
minCompatVersion = XPIProvider.minCompatibleAppVersion;
else if (app.id == TOOLKIT_ID)
minCompatVersion = XPIProvider.minCompatiblePlatformVersion;
@@ -6445,15 +6457,33 @@ AddonInternal.prototype = {
(Services.vc.compare(version, app.maxVersion) <= 0)
},
- get matchingTargetApplication() {
+ get matchingTargetApplication() {
let app = null;
+
+#ifdef MC_APP_ID
+ // We want to prefer the Pale Moon application ID
+ // over any other for the duration of this hack.
+ for (let targetApp of this.targetApplications) {
+ if (targetApp.id == ALT_APP_ID) {
+ logger.warn("getMatchingTargetApplication: Add-on " + this.defaultLocale.name +
+ " matches because Alternate Application ID " + ALT_APP_ID +
+ " is currently preferred over the Application or Toolkit's ID.");
+
+ return targetApp;
+ }
+ }
+#endif
+
for (let targetApp of this.targetApplications) {
- if (targetApp.id == Services.appinfo.ID)
+ if (targetApp.id == Services.appinfo.ID) {
return targetApp;
- if (targetApp.id == TOOLKIT_ID)
+ }
+
+ if (targetApp.id == TOOLKIT_ID) {
app = targetApp;
+ }
}
- // Return toolkit ID if toolkit.
+
return app;
},