diff --git a/mobile/android/app/geckoview-prefs.js b/mobile/android/app/geckoview-prefs.js index 7af32200e0e2..d16b3e75169e 100644 --- a/mobile/android/app/geckoview-prefs.js +++ b/mobile/android/app/geckoview-prefs.js @@ -45,9 +45,6 @@ pref("dom.push.enabled", true); // enable external storage API pref("dom.storageManager.enabled", true); -// enable storage access API -pref("dom.storage_access.enabled", true); - // enable LocalStorage NextGen (LSNG) for all GeckoView channels. (LSNG is // enabled for all of Gecko on nightly and early beta, but the rollout to // release has been slow because of legacy profile breakage issues that are not diff --git a/mobile/android/components/geckoview/GeckoViewPermission.jsm b/mobile/android/components/geckoview/GeckoViewPermission.jsm index 3dc072fbeb26..41da4792b2a5 100644 --- a/mobile/android/components/geckoview/GeckoViewPermission.jsm +++ b/mobile/android/components/geckoview/GeckoViewPermission.jsm @@ -242,20 +242,16 @@ class GeckoViewPermission { const dispatcher = GeckoViewUtils.getDispatcherForWindow( aRequest.window ? aRequest.window : aRequest.element.ownerGlobal ); - const principal = - perm.type == "storage-access" - ? aRequest.principal - : aRequest.topLevelPrincipal; dispatcher .sendRequestForResult({ type: "GeckoView:ContentPermission", - uri: principal.URI.displaySpec, - thirdPartyOrigin: aRequest.principal.origin, - principal: E10SUtils.serializePrincipal(principal), + uri: aRequest.principal.URI.displaySpec, + principal: E10SUtils.serializePrincipal(aRequest.principal), perm: perm.type, value: perm.capability, - contextId: principal.originAttributes.geckoViewSessionContextId ?? null, - privateMode: principal.privateBrowsingId != 0, + contextId: + aRequest.principal.originAttributes.geckoViewSessionContextId ?? null, + privateMode: aRequest.principal.privateBrowsingId != 0, }) .then(value => { if (value == Services.perms.ALLOW_ACTION) { @@ -273,22 +269,11 @@ class GeckoViewPermission { return /* value */ Services.perms.DENY_ACTION; }) .then(value => { - // The storage access code adds itself to the perm manager; no need for us to do it. - if (perm.type == "storage-access") { - if (value == Services.perms.ALLOW_ACTION) { - aRequest.allow({ "storage-access": "allow" }); - } else { - aRequest.cancel(); - } - aRequest = undefined; - return; - } - (value == Services.perms.ALLOW_ACTION ? aRequest.allow : aRequest.cancel)(); Services.perms.addFromPrincipal( - principal, + aRequest.principal, perm.type, value, Services.perms.EXPIRE_NEVER diff --git a/mobile/android/geckoview/api.txt b/mobile/android/geckoview/api.txt index ef0f8295eead..a57dd7ecd759 100644 --- a/mobile/android/geckoview/api.txt +++ b/mobile/android/geckoview/api.txt @@ -1026,7 +1026,6 @@ package org.mozilla.geckoview { field public static final int PERMISSION_GEOLOCATION = 0; field public static final int PERMISSION_MEDIA_KEY_SYSTEM_ACCESS = 6; field public static final int PERMISSION_PERSISTENT_STORAGE = 2; - field public static final int PERMISSION_STORAGE_ACCESS = 8; field public static final int PERMISSION_TRACKING = 7; field public static final int PERMISSION_XR = 3; } @@ -1046,7 +1045,6 @@ package org.mozilla.geckoview { field @Nullable public final String contextId; field public final int permission; field public final boolean privateMode; - field @Nullable public final String thirdPartyOrigin; field @NonNull public final String uri; field public final int value; } 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 7fbfb20c4cc3..b0dd776e7330 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 @@ -5539,12 +5539,6 @@ public class GeckoSession { */ int PERMISSION_TRACKING = 7; - /** - * Permission for third party frames to access first party cookies and storage. May be - * granted heuristically in some cases. - */ - int PERMISSION_STORAGE_ACCESS = 8; - /** * Represents a content permission -- including the type of permission, * the present value of the permission, the URL the permission pertains to, @@ -5575,12 +5569,6 @@ public class GeckoSession { */ final public @NonNull String uri; - /** - * The third party origin associated with the request; currently only used - * for storage access permission. - */ - final public @Nullable String thirdPartyOrigin; - /** * A boolean indicating whether this content permission is associated with * private browsing. @@ -5607,7 +5595,6 @@ public class GeckoSession { protected ContentPermission() { this.uri = ""; - this.thirdPartyOrigin = null; this.privateMode = false; this.permission = PERMISSION_GEOLOCATION; this.value = VALUE_ALLOW; @@ -5622,13 +5609,6 @@ public class GeckoSession { final String permission = bundle.getString("perm"); this.permission = convertType(permission); - if (permission.startsWith("3rdPartyStorage^")) { - // Storage access permissions are stored with the key "3rdPartyStorage^https://foo.com" - // where the third party origin is "https://foo.com". - this.thirdPartyOrigin = permission.substring(16); - } else { - this.thirdPartyOrigin = bundle.getString("thirdPartyOrigin"); - } this.value = bundle.getInt("value"); this.contextId = StorageController.retrieveUnsafeSessionContextId(bundle.getString("contextId")); @@ -5685,8 +5665,6 @@ public class GeckoSession { return PERMISSION_MEDIA_KEY_SYSTEM_ACCESS; } else if ("trackingprotection".equals(type) || "trackingprotection-pb".equals(type)) { return PERMISSION_TRACKING; - } else if ("storage-access".equals(type) || type.startsWith("3rdPartyStorage^")) { - return PERMISSION_STORAGE_ACCESS; } else { return -1; } @@ -5711,8 +5689,6 @@ public class GeckoSession { return "media-key-system-access"; case PERMISSION_TRACKING: return privateMode ? "trackingprotection-pb" : "trackingprotection"; - case PERMISSION_STORAGE_ACCESS: - return "storage-access"; default: return ""; } @@ -5735,9 +5711,8 @@ public class GeckoSession { } /* package */ @NonNull GeckoBundle toGeckoBundle() { - final GeckoBundle res = new GeckoBundle(7); + final GeckoBundle res = new GeckoBundle(5); res.putString("uri", uri); - res.putString("thirdPartyOrigin", thirdPartyOrigin); res.putString("principal", mPrincipal); res.putBoolean("privateMode", privateMode); res.putString("perm", convertType(permission, privateMode)); @@ -5997,9 +5972,7 @@ public class GeckoSession { PermissionDelegate.PERMISSION_XR, PermissionDelegate.PERMISSION_AUTOPLAY_INAUDIBLE, PermissionDelegate.PERMISSION_AUTOPLAY_AUDIBLE, - PermissionDelegate.PERMISSION_MEDIA_KEY_SYSTEM_ACCESS, - PermissionDelegate.PERMISSION_TRACKING, - PermissionDelegate.PERMISSION_STORAGE_ACCESS}) + PermissionDelegate.PERMISSION_MEDIA_KEY_SYSTEM_ACCESS}) /* package */ @interface Permission {} /** diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/StorageController.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/StorageController.java index c3e11a1df7bb..42a4562de9be 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/StorageController.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/StorageController.java @@ -299,10 +299,6 @@ public final class StorageController { Log.w(LOGTAG, "Cannot set a tracking permission to VALUE_PROMPT, aborting."); return; } - if (type == GeckoSession.PermissionDelegate.PERMISSION_STORAGE_ACCESS) { - Log.w(LOGTAG, "Cannot set storage access permission via String API."); - return; - } final GeckoBundle msg = new GeckoBundle(5); msg.putString("uri", uri); msg.putString("contextId", createSafeSessionContextId(contextId)); 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 96c022c9db7b..84e665b9e106 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 @@ -16,11 +16,6 @@ exclude: true ## v91 - Extended [`Autocomplete`][78.7] API to support addresses. ([bug 1699794]({{bugzilla}}1699794)). -- Added [`GeckoSession.PermissionDelegate.PERMISSION_STORAGE_ACCESS`][91.1] to - control the allowing of third-party frames to access first-party cookies and - storage. ([bug 1543720]({{bugzilla}}1543720)) - -[91.1]: {{javadoc_uri}}/GeckoSession.PermissionDelegate.html#PERMISSION_STORAGE_ACCESS ## v90 - Added [`WebNotification.silent`][90.1] and [`WebNotification.vibrate`][90.2] @@ -1019,4 +1014,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]: 5ba065dc9813ab2446e3b64896f85726c3016941 +[api-version]: 47d9ee299e7ba7be24963762712b0a1ecee29a68 diff --git a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java index c4e8e3d26850..a48ab2496c79 100644 --- a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java +++ b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java @@ -1804,9 +1804,6 @@ public class GeckoViewActivity case PERMISSION_MEDIA_KEY_SYSTEM_ACCESS: resId = R.string.request_media_key_system_access; break; - case PERMISSION_STORAGE_ACCESS: - resId = R.string.request_storage_access; - break; default: return GeckoResult.fromValue(ContentPermission.VALUE_DENY); } diff --git a/mobile/android/geckoview_example/src/main/res/values/strings.xml b/mobile/android/geckoview_example/src/main/res/values/strings.xml index 126f6b084c20..26d92947cc85 100644 --- a/mobile/android/geckoview_example/src/main/res/values/strings.xml +++ b/mobile/android/geckoview_example/src/main/res/values/strings.xml @@ -6,7 +6,6 @@ Password Clear Allow access to device storage for "%1$s"? - Allow third parties to access first party storage for "%1$s"? Share location with "%1$s"? Allow notifications for "%1$s"? Share video with "%1$s" diff --git a/mobile/android/modules/geckoview/GeckoViewStorageController.jsm b/mobile/android/modules/geckoview/GeckoViewStorageController.jsm index 97e036695266..8e177e908e35 100644 --- a/mobile/android/modules/geckoview/GeckoViewStorageController.jsm +++ b/mobile/android/modules/geckoview/GeckoViewStorageController.jsm @@ -146,13 +146,9 @@ const GeckoViewStorageController = { } case "GeckoView:SetPermission": { const principal = E10SUtils.deserializePrincipal(aData.principal); - let key = aData.perm; - if (key == "storage-access") { - key = "3rdPartyStorage^" + aData.thirdPartyOrigin; - } Services.perms.addFromPrincipal( principal, - key, + aData.perm, aData.newValue, Ci.nsIPermissionManager.EXPIRE_NEVER );