Backed out changeset a6ec3acd5daf (bug 1543720) for causing failures at dlharness.window.html. CLOSED TREE

This commit is contained in:
Butkovits Atila 2021-06-12 05:16:57 +03:00
parent ef0a88c6f2
commit 2d737038f6
9 changed files with 10 additions and 74 deletions

View File

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

View File

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

View File

@ -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;
}

View File

@ -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 {}
/**

View File

@ -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));

View File

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

View File

@ -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);
}

View File

@ -6,7 +6,6 @@
<string name="password">Password</string>
<string name="clear_field">Clear</string>
<string name="request_storage">Allow access to device storage for "%1$s"?</string>
<string name="request_storage_access">Allow third parties to access first party storage for "%1$s"?</string>
<string name="request_geolocation">Share location with "%1$s"?</string>
<string name="request_notification">Allow notifications for "%1$s"?</string>
<string name="request_video">Share video with "%1$s"</string>

View File

@ -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
);