Skip to content

Commit c7e3daa

Browse files
authored
Remove Shared Storage monkey patches (#160)
They have now been moved into the spec properly, see WICG/shared-storage#179. Also adds a non-normative section listing specs where Private Aggregation is exposed.
1 parent 8cd15f0 commit c7e3daa

File tree

1 file changed

+11
-263
lines changed

1 file changed

+11
-263
lines changed

spec.bs

+11-263
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,17 @@ Note: A later algorithm [=asserts=] that, for any [=contribution cache entry=]
292292
before the [=process contributions for a batching scope=] steps are
293293
performed given the entry's [=contribution cache entry/batching scope=].
294294

295+
APIs exposing Private Aggregation {#apis-exposing-private-aggregation}
296+
----------------------------------------------------------------------
297+
298+
<em>This section is non-normative.</em>
299+
300+
This API is currently exposed in global scopes defined in the specifications of
301+
two APIs:
302+
1. <a href="https://wicg.github.io/shared-storage/">Shared Storage</a> and
303+
1. <a href="https://wicg.github.io/turtledove/">Protected Audience</a> (via the
304+
<a href="#protected-audience-api-monkey-patches">monkey patches</a> below).
305+
295306
Structures {#structures}
296307
========================
297308

@@ -1185,269 +1196,6 @@ Note: Without this, [=aggregatable reports=] would be subject to delays, making
11851196

11861197
</div>
11871198

1188-
Shared Storage API monkey patches {#shared-storage-api-monkey-patches}
1189-
======================================================================
1190-
1191-
Issue(43): This should be moved to the Shared Storage spec.
1192-
1193-
Issue: Go through all monkey patches and ensure every definition (including)
1194-
structures that is needed is exported.
1195-
1196-
<xmp class="idl">
1197-
partial interface SharedStorageWorkletGlobalScope {
1198-
readonly attribute PrivateAggregation privateAggregation;
1199-
};
1200-
1201-
dictionary SharedStoragePrivateAggregationConfig {
1202-
USVString aggregationCoordinatorOrigin;
1203-
USVString contextId;
1204-
[EnforceRange] unsigned long long filteringIdMaxBytes;
1205-
};
1206-
1207-
partial dictionary SharedStorageRunOperationMethodOptions {
1208-
SharedStoragePrivateAggregationConfig privateAggregationConfig;
1209-
};
1210-
</xmp>
1211-
1212-
The {{SharedStorageWorkletGlobalScope/privateAggregation}} [=getter steps=] are
1213-
to [=get the privateAggregation=] given [=this=].
1214-
1215-
Add the following algorithm in the subsection
1216-
"<a href="https://wicg.github.io/shared-storage/#run-op-shared-storage">Run
1217-
Operation Methods on `SharedStorage`</a>":
1218-
1219-
<div algorithm>
1220-
To <dfn>obtain the aggregation coordinator</dfn> given a
1221-
{{SharedStorageRunOperationMethodOptions}} |options|, perform the following
1222-
steps. They return an [=aggregation coordinator=], null or a {{DOMException}}:
1223-
1224-
1. If
1225-
|options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"]
1226-
does not [=map/exist=], return null.
1227-
1. If
1228-
|options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"]["{{SharedStoragePrivateAggregationConfig/aggregationCoordinatorOrigin}}"]
1229-
does not [=map/exist=], return null.
1230-
1. Let |url| be the result of running the [=URL parser=] on
1231-
|options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"]["{{SharedStoragePrivateAggregationConfig/aggregationCoordinatorOrigin}}"].
1232-
1. If |url| is failure or null, return a new {{DOMException}} with name
1233-
"`SyntaxError`".
1234-
1235-
Issue: Consider throwing an error if the path is not empty.
1236-
1. Let |origin| be |url|'s [=url/origin=].
1237-
1. If the result of [=determining if an origin is an aggregation coordinator=]
1238-
given |origin| is false, return a new {{DOMException}} with name
1239-
"`DataError`".
1240-
1. Return |origin|.
1241-
1242-
</div>
1243-
1244-
<div algorithm>
1245-
To <dfn>obtain the pre-specified report parameters</dfn> given a
1246-
{{SharedStorageRunOperationMethodOptions}} |options| and a [=browsing context=]
1247-
|context|, perform the following steps. They return a [=pre-specified report
1248-
parameters=], null, or a {{DOMException}}:
1249-
1. If |options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"]
1250-
does not [=map/exist=], return null.
1251-
1. Let |privateAggregationConfig| be
1252-
|options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"].
1253-
1. Let |contextId| be null.
1254-
1. If |privateAggregationConfig|["{{SharedStoragePrivateAggregationConfig/contextId}}"]
1255-
[=map/exists=], set |contextId| to
1256-
|privateAggregationConfig|["{{SharedStoragePrivateAggregationConfig/contextId}}"].
1257-
1. If |contextId|'s [=string/length=] is greater than 64, return a new
1258-
{{DOMException}} with name "`DataError`".
1259-
1. Let |filteringIdMaxBytes| be the [=default filtering ID max bytes=].
1260-
1. If |privateAggregationConfig|["{{SharedStoragePrivateAggregationConfig/filteringIdMaxBytes}}"]
1261-
[=map/exists=], set |filteringIdMaxBytes| to
1262-
|privateAggregationConfig|["{{SharedStoragePrivateAggregationConfig/filteringIdMaxBytes}}"].
1263-
1. If |filteringIdMaxBytes| is not [=set/contained=] in the [=valid filtering ID
1264-
max bytes range=], return a new {{DOMException}} with name "`DataError`".
1265-
1. If |context|'s [=browsing context/fenced frame config instance=] is not null:
1266-
1. If |filteringIdMaxBytes| is not the [=default filtering ID max bytes=] or
1267-
|contextId| is not null, return a new {{DOMException}} with name
1268-
"`DataError`".
1269-
1. Return a new [=pre-specified report parameters=] with the items:
1270-
: [=pre-specified report parameters/context ID=]
1271-
:: |contextId|
1272-
: [=pre-specified report parameters/filtering ID max bytes=]
1273-
:: |filteringIdMaxBytes|
1274-
1275-
</div>
1276-
1277-
The {{SharedStorageWorklet}}'s {{SharedStorageWorklet/run()}} method steps are
1278-
modified in four ways. First, add the following steps just after step 4
1279-
("[=Assert=]: <var ignore>window</var> is a [=Window=]"), renumbering later
1280-
steps as appropriate:
1281-
<div algorithm="shared-storage-run-monkey-patch-1">
1282-
5. Let |context| be <var ignore>window</var>'s [=Window/browsing context=].
1283-
1. If |context| is null, then return [=a promise rejected with=] a
1284-
{{TypeError}}.
1285-
1. Let |preSpecifiedParams| be the result of [=obtaining the pre-specified
1286-
report parameters=] given |options| and |context|.
1287-
1. If |preSpecifiedParams| is a {{DOMException}}, return [=a promise rejected
1288-
with=] |preSpecifiedParams|.
1289-
1. Let |aggregationCoordinator| be the result of [=obtaining the aggregation
1290-
coordinator=] given |options|.
1291-
1. If |aggregationCoordinator| is a {{DOMException}}, return [=a promise
1292-
rejected with=] |aggregationCoordinator|.
1293-
1294-
</div>
1295-
Second, add the following steps in the nested scope just after "Let |operation|
1296-
be |operationMap|[|name|]." (renumbering later steps as appropriate):
1297-
<div algorithm="shared-storage-run-monkey-patch-2">
1298-
2. Let |batchingScope| be a new [=batching scope=].
1299-
1. Let <var ignore>debugScope</var> be a new [=debug scope=].
1300-
1. Let |privateAggregationTimeout| be null.
1301-
1. Let |isDeterministicReport| be false.
1302-
1. If |preSpecifiedParams| is not null:
1303-
1. Set |isDeterministicReport| to the result of [=determining if a report
1304-
should be sent deterministically=] given |preSpecifiedParams|.
1305-
1. If |isDeterministicReport|:
1306-
1. Set |privateAggregationTimeout| to the [=current wall time=] plus the
1307-
[=deterministic operation timeout duration=].
1308-
1. [=Set the pre-specified report parameters for a batching scope=] given
1309-
|preSpecifiedParams| and |batchingScope|.
1310-
1. If |aggregationCoordinator| is not null, [=set the aggregation coordinator
1311-
for a batching scope=] given |aggregationCoordinator| and |batchingScope|.
1312-
1313-
</div>
1314-
1315-
Third, add the following steps in the same nested scope just before the current
1316-
penultimate step ("If <var ignore>options</var>
1317-
[=map/contains=] <var ignore>data</var>", renumbering the last step as
1318-
appropriate):
1319-
<div algorithm="shared-storage-run-monkey-patch-3">
1320-
1. Let |hasRunPrivateAggregationCompletionTask| be false.
1321-
1. Let |privateAggregationCompletionTask| be an algorithm to perform the
1322-
following steps:
1323-
1. If |hasRunPrivateAggregationCompletionTask|, return.
1324-
1. Set |hasRunPrivateAggregationCompletionTask| to true.
1325-
1. [=Mark a debug scope complete=] given <var ignore>debugScope</var>.
1326-
1. [=Process contributions for a batching scope=] given
1327-
<var ignore>batchingScope</var>, <var ignore>outsideSettings</var>'
1328-
[=environment settings object/origin=], "<code>shared-storage</code>"
1329-
and |privateAggregationTimeout|.
1330-
1. If <var ignore>isDeterministicReport</var>>, run the following steps [=in
1331-
parallel=]:
1332-
1. Wait until |privateAggregationTimeout|.
1333-
1. Run |privateAggregationCompletionTask|.
1334-
1335-
</div>
1336-
1337-
Finally, at the end of the same nested scope, add the following step:
1338-
<div algorithm="shared-storage-run-monkey-patch-4">
1339-
9. When the above [=call=] returns, perform the following steps:
1340-
1. Run <var ignore>privateAggregationCompletionTask</var>.
1341-
1342-
</div>
1343-
1344-
The {{SharedStorageWorklet}}'s {{SharedStorageWorklet/selectURL()}} method steps
1345-
are modified in three ways. First, add the following steps just after step 6
1346-
("If <var ignore>context</var> is null..."), renumbering later steps:
1347-
<div algorithm="shared-storage-selecturl-monkey-patch-1">
1348-
7. Let |preSpecifiedParams| be the result of [=obtaining the pre-specified
1349-
report parameters=] given |options| and <var ignore>context</var>.
1350-
1. If |preSpecifiedParams| is a {{DOMException}}, return [=a promise rejected
1351-
with=] |preSpecifiedParams|.
1352-
1. Let |aggregationCoordinator| be the result of [=obtaining the aggregation
1353-
coordinator=] given |options|.
1354-
1. If |aggregationCoordinator| is a {{DOMException}}, return [=a promise
1355-
rejected with=] |aggregationCoordinator|.
1356-
1357-
</div>
1358-
Second, add the following steps in the nested scope just after "Let |operation|
1359-
be |operationMap|[|name|]." (renumbering later steps as appropriate):
1360-
<div algorithm="shared-storage-selecturl-monkey-patch-2">
1361-
2. Let |batchingScope| be a new [=batching scope=].
1362-
1. Let |debugScope| be a new [=debug scope=].
1363-
1. Let |privateAggregationTimeout| be null.
1364-
1. Let |hasRunPrivateAggregationCompletionTask| be false.
1365-
1. Let |privateAggregationCompletionTask| be an algorithm to perform the
1366-
following steps:
1367-
1. If |hasRunPrivateAggregationCompletionTask|, return.
1368-
1. Set |hasRunPrivateAggregationCompletionTask| to true.
1369-
1. [=Mark a debug scope complete=] given |debugScope|.
1370-
1. [=Process contributions for a batching scope=] given
1371-
|batchingScope|, <var ignore>outsideSettings</var>'
1372-
[=environment settings object/origin=], "<code>shared-storage</code>"
1373-
and |privateAggregationTimeout|.
1374-
1. If |aggregationCoordinator| is not null, [=set the aggregation coordinator
1375-
for a batching scope=] given |aggregationCoordinator| and |batchingScope|.
1376-
1. If |preSpecifiedParams| is not null:
1377-
1. Let |isDeterministicReport| be the result of [=determining if a report
1378-
should be sent deterministically=] given |preSpecifiedParams|.
1379-
1. If |isDeterministicReport|:
1380-
1. Set |privateAggregationTimeout| to the [=current wall time=] plus the
1381-
[=deterministic operation timeout duration=].
1382-
1. [=Set the pre-specified report parameters for a batching scope=] given
1383-
|preSpecifiedParams| and |batchingScope|.
1384-
1. If |isDeterministicReport|, run the following steps [=in parallel=]:
1385-
1. Wait until |privateAggregationTimeout|.
1386-
1. Run |privateAggregationCompletionTask|.
1387-
1388-
</div>
1389-
Finally, at the end of the same nested scope, add the following steps:
1390-
<div algorithm="shared-storage-selecturl-monkey-patch-3">
1391-
13. Run <var ignore>privateAggregationCompletionTask</var>.
1392-
1393-
</div>
1394-
1395-
Issue: Once <a href="https://github.com/wicg/shared-storage/issues/88">
1396-
shared-storage/88</a> is resolved, align the above monkey patches with how
1397-
`keepAlive` is handled at operation completion.
1398-
1399-
The {{Worklet/addModule()}} steps are modified to add a new step just before
1400-
the final step ("Return <var ignore>promise</var>."), renumbering the last step
1401-
as appropriate:
1402-
<div algorithm="shared-storage-addmodule-monkey-patch">
1403-
7. If |this| is a {{SharedStorageWorklet}}, [=upon fulfillment=] of |promise| or
1404-
[=upon rejection=] of |promise|, run the following steps:
1405-
1. Let |globalScopes| be |this|'s [=Worklet/global scopes=].
1406-
1. [=Assert=]: |globalScopes|' [=list/size=] equals 1.
1407-
1. Let |privateAggregationObj| be |globalScopes|[0]'s
1408-
{{SharedStorageWorkletGlobalScope/privateAggregation}}.
1409-
1. Set |privateAggregationObj|'s [=PrivateAggregation/allowed to use=] to
1410-
the result of determining whether [=this=]'s [=relevant global
1411-
object=]'s [=associated document=] is [=allowed to use=] the
1412-
"<code>[=private-aggregation=]</code>" [=policy-controlled feature=].
1413-
1414-
Issue: Consider adding an early return here (and equivalently for
1415-
Protected Audience) if the permissions policy check is made first.
1416-
1. Set |privateAggregationObj|'s [=PrivateAggregation/scoping details=] to a
1417-
new [=scoping details=] with the items:
1418-
: [=scoping details/get batching scope steps=]
1419-
:: An algorithm that returns the [=batching scope=] that is scheduled to
1420-
be passed to [=process contributions for a batching scope=] when the
1421-
call currently executing in |scope| returns.
1422-
: [=scoping details/get debug scope steps=]
1423-
:: An algorithm that returns the [=debug scope=] that is scheduled to be
1424-
passed to [=mark a debug scope complete=] when the call currently
1425-
executing in |scope| returns.
1426-
1427-
Note: Multiple operation invocations can be in-progress at the same
1428-
time, each with a different batching scope and debug scope. However,
1429-
only one can be currently executing.
1430-
1431-
</div>
1432-
1433-
Issue: Once <a href="https://github.com/wicg/shared-storage/issues/89">
1434-
shared-storage/89</a> is resolved, align the above monkey patch with how
1435-
access to `sharedStorage` is prevented in
1436-
{{SharedStorageWorkletGlobalScope}}s until {{Worklet/addModule()}}'s initial
1437-
execution is complete.
1438-
1439-
Note: This extends Shared Storage's existing {{Worklet/addModule()}}
1440-
<a href="https://wicg.github.io/shared-storage/#worklet-monkey-patch">
1441-
monkey patch</a>.
1442-
1443-
[=Implementation-defined=] values {#shared-storage-implementation-defined-values}
1444-
---------------------------------------------------------------------------------
1445-
1446-
<dfn>Deterministic operation timeout duration</dfn> is a non-negative
1447-
[=duration=] that controls how long a Shared Storage operation may make Private
1448-
Aggregation contributions if it is triggering a deterministic report and,
1449-
equivalently, when that report should be sent after the operation begins.
1450-
14511199
Protected Audience API monkey patches {#protected-audience-api-monkey-patches}
14521200
==============================================================================
14531201

0 commit comments

Comments
 (0)