Bug 1921333 - Part 2: Switch some AppConstants.platform checks to MOZ_GECKOVIEW, r=glandium,extension-reviewers,robwu

Depends on D217135

Differential Revision: https://phabricator.services.mozilla.com/D217136
This commit is contained in:
Nika Layzell 2024-11-01 21:19:20 +00:00
parent 24f8a0432b
commit 3b8c25560d
7 changed files with 11 additions and 11 deletions

View File

@ -1217,14 +1217,14 @@ export class SpecialPowersParent extends JSWindowActorParent {
case "SPLoadExtension": {
let id = aMessage.data.id;
let ext = aMessage.data.ext;
if (AppConstants.platform === "android") {
if (AppConstants.MOZ_GECKOVIEW) {
// Some extension APIs are partially implemented in Java, and the
// interface between the JS and Java side (GeckoViewWebExtension)
// expects extensions to be registered with the AddonManager.
//
// For simplicity, default to using an Addon Manager (if not null).
if (ext.useAddonManager === undefined) {
ext.useAddonManager = "android-only";
ext.useAddonManager = "geckoview-only";
}
}
// delayedStartup is only supported in xpcshell

View File

@ -722,7 +722,7 @@ export var ExtensionTestCommon = class ExtensionTestCommon {
* @returns {Partial<Extension>}
*/
static generate(data) {
if (data.useAddonManager === "android-only") {
if (data.useAddonManager === "geckoview-only") {
// Some extension APIs are partially implemented in Java, and the
// interface between the JS and Java side (GeckoViewWebExtension)
// expects extensions to be registered with the AddonManager.
@ -736,7 +736,7 @@ export var ExtensionTestCommon = class ExtensionTestCommon {
// cannot unconditionally be enabled.
// In mochitests, tests are run in an actual browser, so the AddonManager
// is always enabled and hence useAddonManager is always set by default.
if (AppConstants.platform === "android") {
if (AppConstants.MOZ_GECKOVIEW) {
// Many MV3 tests set temporarilyInstalled for granted_host_permissions.
// The granted_host_permissions flag is only effective for temporarily
// installed extensions, so make sure to use "temporary" in this case.
@ -749,7 +749,7 @@ export var ExtensionTestCommon = class ExtensionTestCommon {
// The AddonManager requires an ID in the manifest for unsigned XPIs.
this.setExtensionID(data);
} else {
// On non-Android, default to not using the AddonManager.
// On non-GeckoView, default to not using the AddonManager.
data.useAddonManager = null;
}
}

View File

@ -231,7 +231,7 @@ class ExtensionWrapper {
await this.extension.shutdown();
}
if (AppConstants.platform === "android") {
if (AppConstants.MOZ_GECKOVIEW) {
// We need a way to notify the embedding layer that an extension has been
// uninstalled, so that the java layer can be updated too.
Services.obs.notifyObservers(
@ -428,7 +428,7 @@ class AOMExtensionWrapper extends ExtensionWrapper {
let [extension] = args;
if (extension.id === this.id) {
this.state = "running";
if (AppConstants.platform === "android") {
if (AppConstants.MOZ_GECKOVIEW) {
// We need a way to notify the embedding layer that a new extension
// has been installed, so that the java layer can be updated too.
Services.obs.notifyObservers(

View File

@ -25,7 +25,7 @@ let extensionData = {
permissions: ["activeTab"]
},
useAddonManager: "android-only",
useAddonManager: "geckoview-only",
};
add_task(async function setup() {

View File

@ -25,7 +25,7 @@ let extensionData = {
permissions: ["activeTab"]
},
useAddonManager: "android-only",
useAddonManager: "geckoview-only",
};
add_task(async function setup() {

View File

@ -26,7 +26,7 @@ let extensionData = {
permissions: ["activeTab"]
},
useAddonManager: "android-only",
useAddonManager: "geckoview-only",
};
add_task(async function setup() {

View File

@ -24,7 +24,7 @@ let extensionData = {
}
},
useAddonManager: "android-only",
useAddonManager: "geckoview-only",
};
add_task(async function test_browserAction_openPopup_without_pref() {