summaryrefslogtreecommitdiffstats
path: root/mobile/android/modules/geckoview
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/modules/geckoview')
-rw-r--r--mobile/android/modules/geckoview/GeckoViewAutocomplete.sys.mjs2
-rw-r--r--mobile/android/modules/geckoview/GeckoViewContent.sys.mjs48
-rw-r--r--mobile/android/modules/geckoview/GeckoViewNavigation.sys.mjs7
-rw-r--r--mobile/android/modules/geckoview/GeckoViewWebExtension.sys.mjs55
4 files changed, 103 insertions, 9 deletions
diff --git a/mobile/android/modules/geckoview/GeckoViewAutocomplete.sys.mjs b/mobile/android/modules/geckoview/GeckoViewAutocomplete.sys.mjs
index 2bac20281e..3ef6a89935 100644
--- a/mobile/android/modules/geckoview/GeckoViewAutocomplete.sys.mjs
+++ b/mobile/android/modules/geckoview/GeckoViewAutocomplete.sys.mjs
@@ -609,7 +609,7 @@ export const GeckoViewAutocomplete = {
);
break;
}
- case "autofill-profile": {
+ case "autofill": {
const comment = JSON.parse(option.comment);
debug`delegateSelection ${comment}`;
const creditCard = CreditCard.fromGecko(comment);
diff --git a/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs b/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs
index 240aea0cbe..35ffb76d90 100644
--- a/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs
+++ b/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs
@@ -193,14 +193,48 @@ export class GeckoViewContent extends GeckoViewModule {
}
break;
}
- case "GeckoView:ZoomToInput":
- // For ZoomToInput we just need to send the message to the current focused one.
- const actor =
- Services.focus.focusedContentBrowsingContext.currentWindowGlobal.getActor(
- "GeckoViewContent"
- );
- actor.sendAsyncMessage(aEvent, aData);
+ case "GeckoView:ZoomToInput": {
+ const sendZoomToFocusedInputMessage = function () {
+ // For ZoomToInput we just need to send the message to the current focused one.
+ const actor =
+ Services.focus.focusedContentBrowsingContext.currentWindowGlobal.getActor(
+ "GeckoViewContent"
+ );
+
+ actor.sendAsyncMessage(aEvent, aData);
+ };
+
+ const { force } = aData;
+ let gotResize = false;
+ const onResize = function () {
+ gotResize = true;
+ if (this.window.windowUtils.isMozAfterPaintPending) {
+ this.window.addEventListener(
+ "MozAfterPaint",
+ () => sendZoomToFocusedInputMessage(),
+ { capture: true, once: true }
+ );
+ } else {
+ sendZoomToFocusedInputMessage();
+ }
+ };
+
+ this.window.addEventListener("resize", onResize, { capture: true });
+
+ // When the keyboard is displayed, we can get one resize event,
+ // multiple resize events, or none at all. Try to handle all these
+ // cases by allowing resizing within a set interval, and still zoom to
+ // input if there is no resize event at the end of the interval.
+ this.window.setTimeout(() => {
+ this.window.removeEventListener("resize", onResize, {
+ capture: true,
+ });
+ if (!gotResize && force) {
+ onResize();
+ }
+ }, 500);
break;
+ }
case "GeckoView:ScrollBy":
// Unclear if that actually works with oop iframes?
this.sendToAllChildren(aEvent, aData);
diff --git a/mobile/android/modules/geckoview/GeckoViewNavigation.sys.mjs b/mobile/android/modules/geckoview/GeckoViewNavigation.sys.mjs
index bc098f0413..483f0b01f2 100644
--- a/mobile/android/modules/geckoview/GeckoViewNavigation.sys.mjs
+++ b/mobile/android/modules/geckoview/GeckoViewNavigation.sys.mjs
@@ -189,13 +189,18 @@ export class GeckoViewNavigation extends GeckoViewModule {
triggeringPrincipal = referrerWindow.browser.contentPrincipal;
csp = referrerWindow.browser.csp;
+ const { contentPrincipal } = this.browser;
+ const isNormal = contentPrincipal.privateBrowsingId == 0;
+ const referrerIsPrivate = triggeringPrincipal.privateBrowsingId != 0;
+
const referrerPolicy = referrerWindow.browser.referrerInfo
? referrerWindow.browser.referrerInfo.referrerPolicy
: Ci.nsIReferrerInfo.EMPTY;
referrerInfo = new lazy.ReferrerInfo(
referrerPolicy,
- true,
+ // Don't `sendReferrer` if the private session (current) is opened by a normal session (referrer)
+ isNormal || referrerIsPrivate,
referrerWindow.browser.documentURI
);
} else if (referrerUri) {
diff --git a/mobile/android/modules/geckoview/GeckoViewWebExtension.sys.mjs b/mobile/android/modules/geckoview/GeckoViewWebExtension.sys.mjs
index 97538fd6bb..749f753626 100644
--- a/mobile/android/modules/geckoview/GeckoViewWebExtension.sys.mjs
+++ b/mobile/android/modules/geckoview/GeckoViewWebExtension.sys.mjs
@@ -1222,6 +1222,61 @@ export var GeckoViewWebExtension = {
break;
}
+ case "GeckoView:WebExtension:AddOptionalPermissions": {
+ const { extensionId, permissions, origins } = aData;
+ try {
+ const addon = await this.extensionById(extensionId);
+ const normalized = lazy.ExtensionPermissions.normalizeOptional(
+ {
+ permissions,
+ origins,
+ },
+ addon.optionalPermissions
+ );
+ const policy = WebExtensionPolicy.getByID(addon.id);
+ await lazy.ExtensionPermissions.add(
+ extensionId,
+ normalized,
+ policy?.extension
+ );
+ const extension = await exportExtension(
+ addon,
+ addon.userPermissions,
+ /* aSourceURI */ null
+ );
+ aCallback.onSuccess({ extension });
+ } catch (ex) {
+ aCallback.onError(`Unexpected error: ${ex}`);
+ }
+ break;
+ }
+
+ case "GeckoView:WebExtension:RemoveOptionalPermissions": {
+ const { extensionId, permissions, origins } = aData;
+ try {
+ const addon = await this.extensionById(extensionId);
+ const normalized = lazy.ExtensionPermissions.normalizeOptional(
+ { permissions, origins },
+ addon.optionalPermissions
+ );
+ const policy = WebExtensionPolicy.getByID(addon.id);
+ await lazy.ExtensionPermissions.remove(
+ addon.id,
+ normalized,
+ policy?.extension
+ );
+ const extension = await exportExtension(
+ addon,
+ addon.userPermissions,
+ /* aSourceURI */ null
+ );
+ aCallback.onSuccess({ extension });
+ } catch (ex) {
+ aCallback.onError(`Unexpected error: ${ex}`);
+ }
+ break;
+ }
+
case "GeckoView:WebExtension:Install": {
const { locationUri, installId, installMethod } = aData;
let uri;