You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is building on top of w3c/permissions#390 to integrate SAA with permissions. It's deleting a lot of old manual state management but doesn't get rid of the (global) storage access map altogether, since that is done in #141.
Co-authored-by: Anne van Kesteren <[email protected]>
text: current browsing context; url: dfn-current-browsing-context
@@ -148,8 +150,6 @@ A <dfn>storage access flag set</dfn> is a set of zero or more of the following f
148
150
149
151
: The <dfn for="storage access flag set" id=has-storage-access-flag>has storage access flag</dfn>
150
152
:: When set, this flag indicates |embedded origin| has access to its [=unpartitioned data=] when it's loaded in a [=third party context=] on |top-level site|.
151
-
: The <dfn for="storage access flag set" id=was-expressly-denied-storage-access-flag>was expressly denied storage access flag</dfn>
152
-
:: When set, this flag indicates that the user expressly denied |embedded origin| access to its [=unpartitioned data=] when it's loaded in a [=third party context=] on |top-level site|.
153
153
154
154
To <dfn type="abstract-op">obtain a storage access flag set</dfn> for a [=partitioned storage key=] |key| from a [=/storage access map=] |map|, run the following steps:
155
155
@@ -158,10 +158,6 @@ To <dfn type="abstract-op">obtain a storage access flag set</dfn> for a [=partit
158
158
1. [=map/Set=] |map|[|key|] to |flags|.
159
159
1. Return |map|[|key|].
160
160
161
-
To <dfn type="abstract-op">save the storage access flag set</dfn> for a [=partitioned storage key=] |key| in a [=/storage access map=] |map|, run the following steps:
162
-
163
-
1. [=map/Set=][=global storage access map=][|key|] to |map|[|key|].
164
-
165
161
<h3 id="the-document-object">Changes to {{Document}}</h3>
166
162
167
163
<pre class="idl">
@@ -187,14 +183,8 @@ When invoked on {{Document}} |doc|, the <dfn export method for=Document><code>ha
187
183
1. If |doc|'s [=Document/origin=] is [=same origin=] with the [=top-level origin=] of |doc|'s [=relevant settings object=], [=/resolve=] |p| with true and return |p|.
188
184
1. Let |key| be the result of [=generate a partitioned storage key|generating a partitioned storage key=] from |doc|.
189
185
1. If |key| is failure, [=resolve=] |p| with false and return |p|.
190
-
1. Run these steps [=in parallel=]:
191
-
1. Let |map| be the result of [=obtain the storage access map|obtaining the storage access map=] for |doc|.
192
-
1. Let |flag set| be the result of [=obtain a storage access flag set|obtaining the storage access flag set=] with |key| from |map|.
193
-
1. If |flag set|'s [=was expressly denied storage access flag=] is set, [=queue a global task=] on the [=permission task source=] given |global| to [=/resolve=] |p| with false, and abort these steps.
194
-
1. If |flag set|'s [=has storage access flag=] is set, [=queue a global task=] on the [=permission task source=] given |global| to [=/resolve=] |p| with true, and abort these steps.
195
-
1. Let |hasAccess| be [=a new promise=].
196
-
1. [=Determine the storage access policy=] with |key|, |doc| and |hasAccess|.
197
-
1. [=Queue a global task=] on the [=permission task source=] given |global| to [=/resolve=] |p| with the result of |hasAccess|.
186
+
1. Let |hasAccess| be the result of running [=determine if a site has storage access=] with |key| and |doc|.
187
+
1. [=Queue a global task=] on the [=permissions task source=] given |global| to [=/resolve=] |p| with |hasAccess|.
198
188
1. Return |p|.
199
189
200
190
ISSUE: Shouldn't step 8 be [=same site=]?
@@ -220,17 +210,18 @@ When invoked on {{Document}} |doc|, the <dfn export method for=Document><code>re
220
210
1. If |key| is failure, [=reject=] |p| with a "{{NotAllowedError}}" {{DOMException}} and return |p|.
221
211
1. Let |map| be the result of [=obtain the storage access map|obtaining the storage access map=] for |doc|.
222
212
1. Let |flag set| be the result of [=obtain a storage access flag set|obtaining the storage access flag set=] with |key| from |map|.
223
-
1. If |flag set|'s [=was expressly denied storage access flag=] is set, [=reject=] |p| with a "{{NotAllowedError}}" {{DOMException}} and return |p|.
224
213
1. If |flag set|'s [=has storage access flag=] is set, [=/resolve=] and return |p|.
225
214
1. Otherwise, run these steps [=in parallel=]:
226
215
1. Let |hasAccess| be [=a new promise=].
227
216
1. [=Determine the storage access policy=] with |key|, |doc| and |hasAccess|.
228
-
1. [=Queue a global task=] on the [=permission task source=] given |global| to
217
+
1. [=Queue a global task=] on the [=permissions task source=] given |global| to
229
218
1. Set |flag set|'s [=has storage access flag=].
230
-
1. Resolve or reject |p| based on the result of |hasAccess|.
231
-
1. [=Save the storage access flag set=] for |key| in |map|.
219
+
1. If |hasAccess| is true, resolve |p|.
220
+
1. Reject |p| with a "{{NotAllowedError}}" {{DOMException}}.
232
221
1. Return |p|.
233
222
223
+
ISSUE(privacycg/storage-access#144): We shouldn't use the permissions task source here.
@@ -242,36 +233,21 @@ To <dfn type="abstract-op">determine if a site has storage access</dfn> with [=p
242
233
1. Let |map| be the result of [=obtain the storage access map|obtaining the storage access map=] for |doc|.
243
234
1. Let |flag set| be the result of [=obtain a storage access flag set|obtaining the storage access flag set=] with |key| from |map|.
244
235
1. If |flag set|'s [=has storage access flag=] is set, return true.
245
-
1. Let |has storage access| (a [=boolean=]) be the result of running an [=implementation-defined=] set of steps to determine if |key|'s [=partitioned storage key/embedded origin=] has access to its [=unpartitioned data=] on |key|'s [=partitioned storage key/top-level site=].
246
-
1. If |has storage access| is true, set |flag set|'s [=has storage access flag=].
247
-
1. [=Save the storage access flag set=] for |key| in |map|.
248
-
1. Return |has storage access|.
236
+
1. Return false.
249
237
250
238
To <dfn type="abstract-op">determine the storage access policy</dfn> for [=partitioned storage key=] |key| with {{Document}} |doc| and {{Promise}} |p|, run these steps:
251
239
252
240
1. Let |map| be the result of [=obtain the storage access map|obtaining the storage access map=] for |doc|.
253
241
1. Let |flag set| be the result of [=obtain a storage access flag set|obtaining the storage access flag set=] with |key| from |map|.
254
242
1. Let |implicitly granted| and |implicitly denied| (each a [=boolean=]) be the result of running an [=implementation-defined=] set of steps to determine if |key|'s [=partitioned storage key/embedded origin=]'s request for storage access on |key|'s [=partitioned storage key/top-level site=] should be granted or denied without prompting the user.
255
-
256
-
Note: These [=implementation-defined=] set of steps might result in |flag set|'s [=has storage access flag=] and [=was expressly denied storage access flag=] changing, since the User Agent could have relevant out-of-band information (e.g. a user preference that changed) that this specification is unaware of.
257
243
1. Let |global| be |doc|'s [=relevant global object=].
258
-
1. If |implicitly granted| is true, [=queue a global task=] on the [=permission task source=] given |global| to [=/resolve=] |p|, and return.
259
-
1. If |implicitly denied| is true, [=queue a global task=] on the [=permission task source=] given |global| to [=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}}, and return |p|.
260
-
1. Ask the user if they would like to grant |key|'s [=partitioned storage key/embedded origin=] access to its [=unpartitioned data=] when it's loaded in a [=third party context=] on |key|'s [=partitioned storage key/top-level site=], and wait for an answer. Let |expressly granted| and |expressly denied| (both [=booleans=]) be the result.
261
-
262
-
Note: While |expressly granted| and |expressly denied| cannot both be true, they could both be false in User Agents which allow users to dismiss the prompt without choosing to allow or deny the request. (Such a dismissal is interpreted in this algorithm as a denial.)
263
-
1. If |expressly granted| is true, run these steps:
1. [=Save the storage access flag set=] for |key| in |map|.
266
-
1. [=Queue a global task=] on the [=permission task source=] given |global| to [=/resolve=] |p|, and return.
244
+
1. If |implicitly granted| is true, [=queue a global task=] on the [=permissions task source=] given |global| to [=/resolve=] |p|, and return.
245
+
1. If |implicitly denied| is true, [=queue a global task=] on the [=permissions task source=] given |global| to [=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}}, and return.
246
+
1. Let |permissionState| be the result of [=requesting permission to use=] "<a permission><code>storage-access</code></a>".
247
+
1. If |permissionState| is "granted", [=queue a global task=] on the [=permissions task source=] given |global| to [=/resolve=] |p|, and return.
1. If |expressly denied| is true, run these steps:
269
-
1. If |doc|'s {{Window}} object has [=transient activation=], [=consume user activation=] with it.
270
-
1. Set |flag set|'s [=was expressly denied storage access flag=].
271
-
1. [=Save the storage access flag set=] for |key| in |map|.
272
-
1. [=Queue a global task=] on the [=permission task source=] given |global| to [=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}}.
273
-
274
-
ISSUE: [since this is UA-defined, does it make sense to follow-up separately with a user prompt?](https://github.com/privacycg/storage-access/pull/24#discussion_r408784492)
249
+
1. If |doc|'s {{Window}} object has [=transient activation=], [=consume user activation=] with it.
250
+
1. [=Queue a global task=] on the [=permissions task source=] given |global| to [=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}}.
275
251
276
252
<h3 id="navigation">Changes to navigation</h3>
277
253
@@ -283,7 +259,6 @@ Before changing the current entry of a session history, run the following steps:
283
259
1. If |key| is failure, abort these steps.
284
260
1. Let |flag set| be the result of [=obtain a storage access flag set|obtaining the storage access flag set=] with |key| from |map|.
The Storage Access API defines a [=powerful feature=] identified by the [=powerful feature/name=] "<dfn export permission><code>storage-access</code></dfn>". It defines the following permission-related algorithms:
To query the "<a permission><code>storage-access</code></a>" permission, given a {{PermissionDescriptor}} |permissionDesc| and a {{PermissionStatus}} |status|:
299
+
300
+
1. Set |status|'s {{PermissionStatus/state}} to |permissionDesc|'s [=permission state=].
301
+
1. If |status|'s {{PermissionStatus/state}} is [=permission/denied=], set |status|'s {{PermissionStatus/state}} to [=permission/prompt=].
302
+
303
+
Note: The "denied" permission state is not revealed to avoid exposing the user's decision to developers. This is done to prevent retaliation against the user and repeated prompting to the detriment of the user experience.
304
+
</dd>
305
+
<dt>[=powerful feature/permission key type=]</dt>
306
+
<dd>
307
+
A [=permission key=] of the "<a permission><code>storage-access</code></a>" feature is a [=tuple=] consisting of a [=site=]<dfn for="permission key">top-level</dfn> and an [=/origin=]<dfn for="permission key">requester</dfn>.
308
+
309
+
ISSUE(privacycg/storage-access#147): Note that this will likely change to a (site, site) keying.
To generate a new [=permission key=] for the "<a permission><code>storage-access</code></a>" feature, given an [=environment settings object=] |settings|, run the following steps:
314
+
315
+
1. Let |topLevelSite| be |settings|' [=top-level site=].
316
+
1. Let |embeddedOrigin| be |settings|' [=environment settings object/origin=].
0 commit comments