Bug 1624410 - Add WebExtension.MetaData.temporary. r=esawin,snorp

This allows embedders to know when an extension is installed temporarily so
that they can allow it even if they would normally do it (e.g. for extensions
installed with web-ext).

Differential Revision: https://phabricator.services.mozilla.com/D91071
This commit is contained in:
Agi Sferro 2020-09-23 18:35:05 +00:00
Родитель fad9e1690b
Коммит b48d6cf03e
4 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -1684,6 +1684,7 @@ package org.mozilla.geckoview {
field @NonNull public final String[] origins;
field @NonNull public final String[] permissions;
field public final int signedState;
field public final boolean temporary;
field @NonNull public final String version;
}

Просмотреть файл

@ -1658,6 +1658,12 @@ public class WebExtension {
*/
public final boolean enabled;
/**
* Whether this extension is temporary or not. Temporary extensions are not retained
* and will be uninstalled when the browser exits.
*/
public final boolean temporary;
/** Override for testing. */
protected MetaData() {
icon = null;
@ -1676,6 +1682,7 @@ public class WebExtension {
signedState = SignedStateFlags.UNKNOWN;
disabledFlags = 0;
enabled = true;
temporary = false;
baseUrl = null;
allowedInPrivateBrowsing = false;
}
@ -1695,6 +1702,7 @@ public class WebExtension {
isRecommended = bundle.getBoolean("isRecommended");
blocklistState = bundle.getInt("blocklistState", BlocklistStateFlags.NOT_BLOCKED);
enabled = bundle.getBoolean("enabled", false);
temporary = bundle.getBoolean("temporary", false);
baseUrl = bundle.getString("baseURL");
allowedInPrivateBrowsing = bundle.getBoolean("privateBrowsingAllowed", false);

Просмотреть файл

@ -14,6 +14,11 @@ exclude: true
⚠️ breaking change and deprecation notices
## v83
- Added [`WebExtension.MetaData.temporary`][83.1] which exposes whether an extension
has been installed temporarily, e.g. when using web-ext.
([bug 1624410]({{bugzilla}}1624410))
[83.1]: {{javadoc_uri}}/WebExtension.MetaData.html#temporary
## v82
- ⚠️ [`WebNotification.source`][79.2] is now `@Nullable` to account for
@ -803,4 +808,4 @@ to allow adding gecko profiler markers.
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
[65.25]: {{javadoc_uri}}/GeckoResult.html
[api-version]: e62341ace2541ae9fbd4f08f7c2d03ba28bf416a
[api-version]: 8a8ae9a25f36172359421f78ec83bb8613621541

Просмотреть файл

@ -282,6 +282,7 @@ async function exportExtension(aAddon, aPermissions, aSourceURI) {
blocklistState,
userDisabled,
embedderDisabled,
temporarilyInstalled,
isActive,
isBuiltin,
id,
@ -319,6 +320,7 @@ async function exportExtension(aAddon, aPermissions, aSourceURI) {
promptPermissions,
description,
enabled: isActive,
temporary: temporarilyInstalled,
disabledFlags,
version,
creatorName,