summaryrefslogtreecommitdiffstats
path: root/mobile/android/geckoview/src/main/java
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /mobile/android/geckoview/src/main/java
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/geckoview/src/main/java')
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java6
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java6
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java26
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java4
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionSettings.java18
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java10
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/RuntimeTelemetry.java171
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ScreenLength.java4
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionFinder.java4
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TranslationsController.java38
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtension.java2
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtensionController.java26
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md13
13 files changed, 111 insertions, 217 deletions
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java
index 1fc34cb8bb..e0c16d66cc 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java
@@ -453,13 +453,15 @@ public class GeckoDisplay {
* <p>This function must be called on the UI thread.
*
* @return A {@link GeckoResult} that completes with a {@link Bitmap} containing the pixels and
- * size information of the requested portion of the visible web page.
+ * size information of the requested portion of the visible web page, or returns a failure
+ * {@link GeckoResult} including the reason why in an {@link Exception}
*/
@UiThread
public @NonNull GeckoResult<Bitmap> capture() {
ThreadUtils.assertOnUiThread();
if (!mSession.isCompositorReady()) {
- throw new IllegalStateException("Compositor must be ready before pixels can be captured");
+ return GeckoResult.fromException(
+ new IllegalStateException("Compositor must be ready before pixels can be captured"));
}
final GeckoResult<Bitmap> result = new GeckoResult<>();
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java
index 8750f344a8..ccd513f6bd 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java
@@ -1893,7 +1893,7 @@ import org.mozilla.geckoview.SessionTextInput.EditableListener.IMEState;
outAttrs.imeOptions = EditorInfo.IME_ACTION_GO;
} else if (actionHint.equals("done")) {
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
- } else if (actionHint.equals("next") || actionHint.equals("maybenext")) {
+ } else if (actionHint.equals("next")) {
outAttrs.imeOptions = EditorInfo.IME_ACTION_NEXT;
} else if (actionHint.equals("previous")) {
outAttrs.imeOptions = EditorInfo.IME_ACTION_PREVIOUS;
@@ -1901,6 +1901,9 @@ import org.mozilla.geckoview.SessionTextInput.EditableListener.IMEState;
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEARCH;
} else if (actionHint.equals("send")) {
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEND;
+ } else if (actionHint.equals("maybenext")) {
+ // this should be low priority as "maybenext" is internal type
+ outAttrs.imeOptions = EditorInfo.IME_ACTION_NEXT;
} else if (actionHint.length() > 0) {
if (DEBUG) Log.w(LOGTAG, "Unexpected actionHint=\"" + actionHint + "\"");
outAttrs.actionLabel = actionHint;
@@ -2568,6 +2571,7 @@ import org.mozilla.geckoview.SessionTextInput.EditableListener.IMEState;
switch (keyCode) {
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_BACK:
+ case KeyEvent.KEYCODE_FORWARD:
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_SEARCH:
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
index 0a80b02b04..482fa32f39 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
@@ -457,21 +457,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
}
/**
- * Add a {@link RuntimeTelemetry.Delegate} instance to this GeckoRuntime. This delegate can be
- * used by the app to receive streaming telemetry data from GeckoView.
- *
- * @param delegate the delegate that will handle telemetry
- * @return The builder instance.
- */
- @Deprecated
- @DeprecationSchedule(id = "geckoview-gvst", version = 127)
- public @NonNull Builder telemetryDelegate(final @NonNull RuntimeTelemetry.Delegate delegate) {
- getSettings().mTelemetryProxy = new RuntimeTelemetry.Proxy(delegate);
- getSettings().mTelemetryEnabled.set(true);
- return this;
- }
-
- /**
* Set the {@link ExperimentDelegate} instance on this runtime, if any. This delegate is used to
* send and receive experiment information from Nimbus.
*
@@ -663,7 +648,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
/* package */ int mScreenHeightOverride;
/* package */ Class<? extends Service> mCrashHandler;
/* package */ String[] mRequestedLocales;
- /* package */ RuntimeTelemetry.Proxy mTelemetryProxy;
/* package */ ExperimentDelegate mExperimentDelegate;
/**
@@ -674,10 +658,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
/* package */ void attachTo(final @NonNull GeckoRuntime runtime) {
mRuntime = runtime;
commit();
-
- if (mTelemetryProxy != null) {
- mTelemetryProxy.attach();
- }
}
@Override // RuntimeSettings
@@ -719,7 +699,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
mCrashHandler = settings.mCrashHandler;
mRequestedLocales = settings.mRequestedLocales;
mConfigFilePath = settings.mConfigFilePath;
- mTelemetryProxy = settings.mTelemetryProxy;
mExperimentDelegate = settings.mExperimentDelegate;
}
@@ -1368,11 +1347,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
return this;
}
- @SuppressWarnings("checkstyle:javadocmethod")
- public @Nullable RuntimeTelemetry.Delegate getTelemetryDelegate() {
- return mTelemetryProxy.getDelegate();
- }
-
/**
* Get the {@link ExperimentDelegate} instance set on this runtime, if any,
*
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
index 85b3abf9a9..ccf1e8520e 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -2448,6 +2448,7 @@ public class GeckoSession {
@IntDef(
flag = true,
value = {
+ FINDER_FIND_FORWARD,
FINDER_FIND_BACKWARDS,
FINDER_FIND_LINKS_ONLY,
FINDER_FIND_MATCH_CASE,
@@ -2455,6 +2456,9 @@ public class GeckoSession {
})
public @interface FinderFindFlags {}
+ /** Go forward when finding the next match. */
+ public static final int FINDER_FIND_FORWARD = 0;
+
/** Go backwards when finding the next match. */
public static final int FINDER_FIND_BACKWARDS = 1;
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionSettings.java
index 14f6b14c47..4dc23bc519 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionSettings.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionSettings.java
@@ -331,11 +331,11 @@ public final class GeckoSessionSettings implements Parcelable {
new Key<Boolean>("fullAccessibilityTree", /* initOnly */ false, /* values */ null);
/**
- * Key to specify if this GeckoSession is a Popup or not. Popup sessions can paint over other
- * sessions and are not exposed to the tabs WebExtension API.
+ * Key to specify if this GeckoSession is a Extension Popup or not. Popup sessions can paint over
+ * other sessions and are not exposed to the tabs WebExtension API.
*/
- private static final Key<Boolean> IS_POPUP =
- new Key<Boolean>("isPopup", /* initOnly */ false, /* values */ null);
+ private static final Key<Boolean> IS_EXTENSION_POPUP =
+ new Key<Boolean>("isExtensionPopup", /* initOnly */ false, /* values */ null);
/** Internal Gecko key to specify the session context ID. Derived from `UNSAFE_CONTEXT_ID`. */
private static final Key<String> CONTEXT_ID =
@@ -375,7 +375,7 @@ public final class GeckoSessionSettings implements Parcelable {
mBundle.putBoolean(SUSPEND_MEDIA_WHEN_INACTIVE.name, false);
mBundle.putBoolean(ALLOW_JAVASCRIPT.name, true);
mBundle.putBoolean(FULL_ACCESSIBILITY_TREE.name, false);
- mBundle.putBoolean(IS_POPUP.name, false);
+ mBundle.putBoolean(IS_EXTENSION_POPUP.name, false);
mBundle.putInt(USER_AGENT_MODE.name, USER_AGENT_MODE_MOBILE);
mBundle.putString(USER_AGENT_OVERRIDE.name, null);
mBundle.putInt(VIEWPORT_MODE.name, VIEWPORT_MODE_MOBILE);
@@ -430,8 +430,8 @@ public final class GeckoSessionSettings implements Parcelable {
setBoolean(FULL_ACCESSIBILITY_TREE, value);
}
- /* package */ void setIsPopup(final boolean value) {
- setBoolean(IS_POPUP, value);
+ /* package */ void setIsExtensionPopup(final boolean value) {
+ setBoolean(IS_EXTENSION_POPUP, value);
}
private void setBoolean(final Key<Boolean> key, final boolean value) {
@@ -498,8 +498,8 @@ public final class GeckoSessionSettings implements Parcelable {
return getBoolean(FULL_ACCESSIBILITY_TREE);
}
- /* package */ boolean getIsPopup() {
- return getBoolean(IS_POPUP);
+ /* package */ boolean getIsExtensionPopup() {
+ return getBoolean(IS_EXTENSION_POPUP);
}
private boolean getBoolean(final Key<Boolean> key) {
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
index 2271ff71f7..8b31862524 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
@@ -22,6 +22,8 @@ import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.os.Handler;
import android.print.PrintDocumentAdapter;
@@ -269,6 +271,14 @@ public class GeckoView extends FrameLayout implements GeckoDisplay.NewSurfacePro
// descendants to affect the way LayerView retains its focus.
setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
+ // When GeckoView.requestFocus() is called with hardware keyboard, the focused state color
+ // might be applied on this view. But we don't want to apply it as default.
+ final StateListDrawable drawable = new StateListDrawable();
+ drawable.addState(
+ new int[] {android.R.attr.state_focused, -android.R.attr.state_focused},
+ new ColorDrawable(Color.WHITE));
+ setBackground(drawable);
+
// This will stop PropertyAnimator from creating a drawing cache (i.e. a
// bitmap) from a SurfaceView, which is just not possible (the bitmap will be
// transparent).
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/RuntimeTelemetry.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/RuntimeTelemetry.java
deleted file mode 100644
index 1fad0cb17e..0000000000
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/RuntimeTelemetry.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * vim: ts=4 sw=4 expandtab:
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.geckoview;
-
-import androidx.annotation.AnyThread;
-import androidx.annotation.NonNull;
-import org.mozilla.gecko.GeckoThread;
-import org.mozilla.gecko.annotation.WrapForJNI;
-import org.mozilla.gecko.mozglue.JNIObject;
-
-/** The telemetry API gives access to telemetry data of the Gecko runtime. */
-public final class RuntimeTelemetry {
- protected RuntimeTelemetry() {}
-
- /**
- * The runtime telemetry metric object.
- *
- * @param <T> type of the underlying metric sample
- */
- public static class Metric<T> {
- /** The runtime metric name. */
- public final @NonNull String name;
-
- /** The metric values. */
- public final @NonNull T value;
-
- /* package */ Metric(final String name, final T value) {
- this.name = name;
- this.value = value;
- }
-
- @Override
- public String toString() {
- return "name: " + name + ", value: " + value;
- }
-
- // For testing
- protected Metric() {
- name = null;
- value = null;
- }
- }
-
- /** The Histogram telemetry metric object. */
- public static class Histogram extends Metric<long[]> {
- /** Whether or not this is a Categorical Histogram. */
- public final boolean isCategorical;
-
- /* package */ Histogram(final boolean isCategorical, final String name, final long[] value) {
- super(name, value);
- this.isCategorical = isCategorical;
- }
-
- // For testing
- protected Histogram() {
- super(null, null);
- isCategorical = false;
- }
- }
-
- /**
- * The runtime telemetry delegate. Implement this if you want to receive runtime (Gecko) telemetry
- * and attach it via {@link GeckoRuntimeSettings.Builder#telemetryDelegate}.
- */
- public interface Delegate {
- /**
- * A runtime telemetry histogram metric has been received.
- *
- * @param metric The runtime metric details.
- */
- @AnyThread
- default void onHistogram(final @NonNull Histogram metric) {}
-
- /**
- * A runtime telemetry boolean scalar has been received.
- *
- * @param metric The runtime metric details.
- */
- @AnyThread
- default void onBooleanScalar(final @NonNull Metric<Boolean> metric) {}
-
- /**
- * A runtime telemetry long scalar has been received.
- *
- * @param metric The runtime metric details.
- */
- @AnyThread
- default void onLongScalar(final @NonNull Metric<Long> metric) {}
-
- /**
- * A runtime telemetry string scalar has been received.
- *
- * @param metric The runtime metric details.
- */
- @AnyThread
- default void onStringScalar(final @NonNull Metric<String> metric) {}
- }
-
- // The proxy connects to telemetry core and forwards telemetry events
- // to the attached delegate.
- /* package */ static final class Proxy extends JNIObject {
- private final Delegate mDelegate;
-
- public Proxy(final @NonNull Delegate delegate) {
- mDelegate = delegate;
- }
-
- // Attach to current runtime.
- // We might have different mechanics of attaching to specific runtimes
- // in future, for which case we should split the delegate assignment in
- // the setup phase from the attaching.
- public void attach() {
- if (GeckoThread.isRunning()) {
- registerDelegateProxy(this);
- } else {
- GeckoThread.queueNativeCall(Proxy.class, "registerDelegateProxy", Proxy.class, this);
- }
- }
-
- public @NonNull Delegate getDelegate() {
- return mDelegate;
- }
-
- @WrapForJNI(dispatchTo = "gecko")
- private static native void registerDelegateProxy(Proxy proxy);
-
- @WrapForJNI(calledFrom = "gecko")
- /* package */ void dispatchHistogram(
- final boolean isCategorical, final String name, final long[] values) {
- if (mDelegate == null) {
- // TODO throw?
- return;
- }
- mDelegate.onHistogram(new Histogram(isCategorical, name, values));
- }
-
- @WrapForJNI(calledFrom = "gecko")
- /* package */ void dispatchStringScalar(final String name, final String value) {
- if (mDelegate == null) {
- return;
- }
- mDelegate.onStringScalar(new Metric<>(name, value));
- }
-
- @WrapForJNI(calledFrom = "gecko")
- /* package */ void dispatchBooleanScalar(final String name, final boolean value) {
- if (mDelegate == null) {
- return;
- }
- mDelegate.onBooleanScalar(new Metric<>(name, value));
- }
-
- @WrapForJNI(calledFrom = "gecko")
- /* package */ void dispatchLongScalar(final String name, final long value) {
- if (mDelegate == null) {
- return;
- }
- mDelegate.onLongScalar(new Metric<>(name, value));
- }
-
- @Override // JNIObject
- protected void disposeNative() {
- // We don't hold native references.
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ScreenLength.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ScreenLength.java
index 1ce4b41659..e88976a447 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ScreenLength.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ScreenLength.java
@@ -1,4 +1,6 @@
-/* License, v. 2.0. If a copy of the MPL was not distributed with this
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.geckoview;
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionFinder.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionFinder.java
index 2ed0b1a6c3..b245a39f1e 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionFinder.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionFinder.java
@@ -27,6 +27,7 @@ public final class SessionFinder {
private static final List<Pair<Integer, String>> sFlagNames =
Arrays.asList(
+ new Pair<>(GeckoSession.FINDER_FIND_FORWARD, "forward"),
new Pair<>(GeckoSession.FINDER_FIND_BACKWARDS, "backwards"),
new Pair<>(GeckoSession.FINDER_FIND_LINKS_ONLY, "linksOnly"),
new Pair<>(GeckoSession.FINDER_FIND_MATCH_CASE, "matchCase"),
@@ -70,7 +71,8 @@ public final class SessionFinder {
* previous search string.
*
* @param searchString String to search, or null to find again using the previous string.
- * @param flags Flags for performing the search; either 0 or a combination of {@link
+ * @param flags Flags for performing the search; either FINDER_FIND_FORWARD {@link
+ * GeckoSession#FINDER_FIND_FORWARD} or a combination of {@link
* GeckoSession#FINDER_FIND_BACKWARDS FINDER_FIND_*} constants.
* @return Result of the search operation as a {@link GeckoResult} object.
* @see #clear
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TranslationsController.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TranslationsController.java
index 37e5e7139a..256877532b 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TranslationsController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TranslationsController.java
@@ -1081,14 +1081,20 @@ public class TranslationsController {
/** If the translation engine is ready for use or will need to be loaded. */
public final @NonNull Boolean isEngineReady;
+ /** If the DOM has began visibly changing to the translated text. */
+ public final @NonNull Boolean hasVisibleChange;
+
/**
- * Translation State constructor.
+ * This constructor is deprecated, please use the [TranslationState] with [hasVisibleChange]
+ * parameter. This constructor will be removed in bug 1895275. Translation State constructor.
*
* @param requestedTranslationPair the language pair to translate
* @param error if an error occurred
* @param detectedLanguages detected language
* @param isEngineReady if the engine is ready for translations
*/
+ @Deprecated
+ @DeprecationSchedule(version = 130, id = "translation-state-deprecated-constructor")
public TranslationState(
final @Nullable TranslationPair requestedTranslationPair,
final @Nullable String error,
@@ -1098,6 +1104,29 @@ public class TranslationsController {
this.error = error;
this.detectedLanguages = detectedLanguages;
this.isEngineReady = isEngineReady;
+ this.hasVisibleChange = false;
+ }
+
+ /**
+ * Translation State constructor.
+ *
+ * @param requestedTranslationPair the language pair to translate
+ * @param error if an error occurred
+ * @param detectedLanguages detected language
+ * @param isEngineReady if the engine is ready for translations
+ * @param hasVisibleChange if the DOM has began to visibly change to translated text
+ */
+ public TranslationState(
+ final @Nullable TranslationPair requestedTranslationPair,
+ final @Nullable String error,
+ final @Nullable DetectedLanguages detectedLanguages,
+ final @NonNull Boolean isEngineReady,
+ final @NonNull Boolean hasVisibleChange) {
+ this.requestedTranslationPair = requestedTranslationPair;
+ this.error = error;
+ this.detectedLanguages = detectedLanguages;
+ this.isEngineReady = isEngineReady;
+ this.hasVisibleChange = hasVisibleChange;
}
@Override
@@ -1112,6 +1141,8 @@ public class TranslationsController {
+ detectedLanguages
+ ", isEngineReady="
+ isEngineReady
+ + ", hasVisibleChange="
+ + hasVisibleChange
+ '}';
}
@@ -1130,7 +1161,8 @@ public class TranslationsController {
TranslationPair.fromBundle(bundle.getBundle("requestedTranslationPair")),
bundle.getString("error"),
DetectedLanguages.fromBundle(bundle.getBundle("detectedLanguages")),
- bundle.getBoolean("isEngineReady", false));
+ bundle.getBoolean("isEngineReady", false),
+ bundle.getBoolean("hasVisibleChange", false));
}
}
@@ -1168,7 +1200,7 @@ public class TranslationsController {
final GeckoBundle data = message.getBundle("data");
final TranslationState translationState = TranslationState.fromBundle(data);
if (DEBUG) {
- Log.d(LOGTAG, "received translation state: " + translationState);
+ Log.d(LOGTAG, "Received translation state: " + translationState);
}
delegate.onTranslationStateChange(mSession, translationState);
if (translationState != null
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtension.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtension.java
index bf5d431cf1..53d57b126a 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtension.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtension.java
@@ -1442,7 +1442,7 @@ public class WebExtension {
return;
}
- session.getSettings().setIsPopup(true);
+ session.getSettings().setIsExtensionPopup(true);
session.loadUri(popupUri);
});
}
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtensionController.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtensionController.java
index 07e848b079..889cd91895 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtensionController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebExtensionController.java
@@ -336,6 +336,14 @@ public class WebExtensionController {
default void onDisabling(@NonNull WebExtension extension) {}
/**
+ * Called whenever optional permissions of an extension have changed.
+ *
+ * @param extension The {@link WebExtension} that has optional permissions changed.
+ */
+ @UiThread
+ default void onOptionalPermissionsChanged(@NonNull WebExtension extension) {}
+
+ /**
* Called whenever an extension has been disabled.
*
* @param extension The {@link WebExtension} that is being disabled.
@@ -489,6 +497,7 @@ public class WebExtensionController {
EventDispatcher.getInstance()
.unregisterUiThreadListener(
mInternals,
+ "GeckoView:WebExtension:OnOptionalPermissionsChanged",
"GeckoView:WebExtension:OnDisabling",
"GeckoView:WebExtension:OnDisabled",
"GeckoView:WebExtension:OnEnabling",
@@ -503,6 +512,7 @@ public class WebExtensionController {
EventDispatcher.getInstance()
.registerUiThreadListener(
mInternals,
+ "GeckoView:WebExtension:OnOptionalPermissionsChanged",
"GeckoView:WebExtension:OnDisabling",
"GeckoView:WebExtension:OnDisabled",
"GeckoView:WebExtension:OnEnabling",
@@ -1021,6 +1031,9 @@ public class WebExtensionController {
} else if ("GeckoView:WebExtension:OnDisabling".equals(event)) {
onDisabling(bundle);
return;
+ } else if ("GeckoView:WebExtension:OnOptionalPermissionsChanged".equals(event)) {
+ onOptionalPermissionsChanged(bundle);
+ return;
} else if ("GeckoView:WebExtension:OnDisabled".equals(event)) {
onDisabled(bundle);
return;
@@ -1265,6 +1278,17 @@ public class WebExtensionController {
mAddonManagerDelegate.onDisabling(extension);
}
+ private void onOptionalPermissionsChanged(final GeckoBundle bundle) {
+ if (mAddonManagerDelegate == null) {
+ Log.e(LOGTAG, "no AddonManager delegate registered");
+ return;
+ }
+
+ final GeckoBundle extensionBundle = bundle.getBundle("extension");
+ final WebExtension extension = new WebExtension(mDelegateControllerProvider, extensionBundle);
+ mAddonManagerDelegate.onOptionalPermissionsChanged(extension);
+ }
+
private void onDisabled(final GeckoBundle bundle) {
if (mAddonManagerDelegate == null) {
Log.e(LOGTAG, "no AddonManager delegate registered");
@@ -1525,7 +1549,7 @@ public class WebExtensionController {
if (delegate != null) {
result = delegate.onCloseTab(extension, message.session);
} else {
- result = GeckoResult.fromValue(AllowOrDeny.DENY);
+ result = GeckoResult.deny();
}
message.callback.resolveTo(
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
index e2df6df21b..a2d30d25ef 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
@@ -13,6 +13,17 @@ exclude: true
⚠️ breaking change and deprecation notices
+## v127
+- ⚠️ Removed deprecated [`RuntimeTelemetry`][125.5], [`GeckoRuntimeSettings.getTelemetryDelegate`][125.6] and [`GeckoRuntimeSettings.telemetryDelegate`][125.7].
+- Added [FINDER_FIND_FORWARD][127.1]
+- Added [`WebExtensionController.AddonManagerDelegate.onOptionalPermissionsChanged`][127.2] ([bug 1892302]({{bugzilla}}1892302).
+- Added a new [`TranslationState`][127.3] constructor to add `hasVisibleChange` and deprecated the prior [`TranslationsState`][127.4] constructor to be removed in v130.
+
+[127.1]: {{javadoc_uri}}/GeckoSession.html#FINDER_FIND_FORWARD
+[127.2]: {{javadoc_uri}}/WebExtensionController.AddonManagerDelegate.html#onOptionalPermissionsChanged
+[127.3]: {{javadoc_uri}}/TranslationsController.SessionTranslation.TranslationState.html#%3Cinit%3E(org.mozilla.geckoview.TranslationsController.SessionTranslation.TranslationPair,java.lang.String,org.mozilla.geckoview.TranslationsController.SessionTranslation.DetectedLanguages,java.lang.Boolean,java.lang.Boolean)
+[127.4]: {{javadoc_uri}}/TranslationsController.SessionTranslation.TranslationState.html#<init>(org.mozilla.geckoview.TranslationsController.SessionTranslation.TranslationPair,java.lang.String,org.mozilla.geckoview.TranslationsController.SessionTranslation.DetectedLanguages,java.lang.Boolean)
+
## v125
- ⚠️ Deprecated [`GeckoSession.NavigationDelegate.onLocationChange`][125.1], to be removed in v127.
([bug 1837601]({{bugzilla}}1837601))
@@ -1547,4 +1558,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]: 2c319e9f18adb4178ce09d71088a173b56d1a694
+[api-version]: 0b9d0f241805fab7e71d3d745170a237f6ac113d