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 17:40:16 +00:00
Родитель 773b4af7bb
Коммит 416eb4c6d4
4 изменённых файлов: 16 добавлений и 1 удалений

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

@ -1683,6 +1683,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);

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

@ -18,8 +18,12 @@ exclude: true
Also, [`MediaSession.Delegate.onMetadata`][83.1] is no longer dispatched for
plain media elements.
([bug 1658937]({{bugzilla}}1658937))
- Added [`WebExtension.MetaData.temporary`][83.2] which exposes whether an extension
has been installed temporarily, e.g. when using web-ext.
([bug 1624410]({{bugzilla}}1624410))
[83.1]: {{javadoc_uri}}/MediaSession.Delegate.html#onMetadata-org.mozilla.geckoview.GeckoSession-org.mozilla.geckoview.MediaSession-org.mozilla.geckoview.MediaSession.Metadata-
[83.2]: {{javadoc_uri}}/WebExtension.MetaData.html#temporary
## v82
- ⚠️ [`WebNotification.source`][79.2] is now `@Nullable` to account for
@ -809,4 +813,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]: 8cbbe3b03d78c33888562ea18a4554cff90f531d
[api-version]: 01fdaf45cfe4dc5974de314cbdb79584781eb282

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

@ -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,