@@ -371,6 +371,17 @@ A context type is a [=string=] indicating what kind of global scope the
371
371
{{PrivateAggregation}} object was exposed in. Each API exposing Private
372
372
Aggregation should pick a unique string (or multiple) for this.
373
373
374
+ Pre-specified report parameters {#pre-specified-report-parameters-structure}
375
+ ----------------------------------------------------------------------------
376
+
377
+ A <dfn>pre-specified report parameters</dfn> is a [=struct=] with the following
378
+ items:
379
+ <dl dfn-for="pre-specified report parameters">
380
+ : <dfn>context ID</dfn> (default: null)
381
+ :: A [=string=] or null
382
+
383
+ </dl>
384
+
374
385
Storage {#storage}
375
386
==================
376
387
@@ -380,8 +391,8 @@ A [=user agent=] holds an <dfn>aggregatable report cache</dfn>, which is a
380
391
A [=user agent=] holds an <dfn>aggregation coordinator map</dfn> , which is a
381
392
[=map=] from [=batching scopes=] to [=aggregation coordinators=] .
382
393
383
- A [=user agent=] holds a <dfn>context ID map</dfn> , which is a [=map=] from
384
- [= batching scopes=] to [=strings =] .
394
+ A [=user agent=] holds a <dfn>pre-specified report parameters map</dfn> , which
395
+ is a [=map=] from [= batching scopes=] to [=pre-specified report parameters =] .
385
396
386
397
A [=user agent=] holds a <dfn>contribution cache</dfn> , which is a [=list=] of
387
398
[=contribution cache entries=] .
@@ -399,7 +410,8 @@ the [=aggregatable report cache=] as well as any contribution history data
399
410
stored for the [=consume budget if permitted=] algorithm.
400
411
401
412
The user agent may expose controls that allow the user to delete data from the
402
- [=context ID map=] , the [=contribution cache=] and the [=debug scope map=] .
413
+ [=contribution cache=] , the [=debug scope map=] and the [=pre-specified report
414
+ parameters map=] .
403
415
404
416
[=Implementation-defined=] values {#implementation-defined-values}
405
417
==================================================================
@@ -493,6 +505,18 @@ scope=] |debugScope| and an optional [=debug details=] or null
493
505
set |entry|'s [=contribution cache entry/debug details=] to
494
506
|debugDetails|.
495
507
508
+ To <dfn>determine if a report should be sent deterministically</dfn> given a
509
+ [=pre-specified report parameters=] |preSpecifiedParams|, perform the following
510
+ steps. They return a [=boolean=] :
511
+ 1. If |preSpecifiedParams|' [=pre-specified report parameters/context ID=] is
512
+ not null, return true.
513
+ 1. Return false.
514
+
515
+ Note: If a context ID was specified, a report is sent, even if there are no
516
+ contributions or there is insufficent budget for the requested
517
+ contributions. See [Protecting against leaks via the number of
518
+ reports](#protecting-against-leaks-via-the-number-of-reports).
519
+
496
520
To <dfn algorithm export>process contributions for a batching scope</dfn> given
497
521
a [=batching scope=] |batchingScope|, an [=origin=] |reportingOrigin|, a
498
522
[=context type=] |contextType| and a [=moment=] or null |timeout|:
@@ -513,18 +537,18 @@ a [=batching scope=] |batchingScope|, an [=origin=] |reportingOrigin|, a
513
537
1. Set |aggregationCoordinator| to [=aggregation coordinator
514
538
map=] [|batchingScope|] .
515
539
1. [=map/Remove=] [=aggregation coordinator map=] [|batchingScope|] .
516
- 1. Let |contextId| be null.
517
- 1. If [=context ID map=] [|batchingScope|] [=map/exists=] :
518
- 1. Set |contextId| to [=context ID map=] [|batchingScope|] .
519
- 1. [=map/Remove=] [=context ID map=] [|batchingScope|] .
520
- 1. Otherwise, [=assert=] : |timeout| is null.
540
+ 1. Let |preSpecifiedParams| be a new [=pre-specified report parameters=] .
541
+ 1. If [=pre-specified report parameters map=] [|batchingScope|] [=map/exists=] :
542
+ 1. Set |preSpecifiedParams| to [=pre-specified report parameters
543
+ map=] [|batchingScope|] .
544
+ 1. [=map/Remove=] [=pre-specified report parameters map=] [|batchingScope|] .
545
+ 1. Let |isDeterministicReport| be the result of [=determining if a report should
546
+ be sent deterministically=] given |preSpecifiedParams|.
547
+ 1. If |isDeterministicReport| is false, [=assert=] : |timeout| is null.
521
548
522
549
Note: Timeouts can only be used for deterministic reports.
523
- 1. If |batchEntries| [=list/is empty=] and |contextId| is null, return.
524
-
525
- Note: If a context ID was specified, a report is sent, even if there are no
526
- contributions. See [Protecting against leaks via the number of
527
- reports](#protecting-against-leaks-via-the-number-of-reports).
550
+ 1. If |batchEntries| [=list/is empty=] and |isDeterministicReport| is false,
551
+ return.
528
552
1. Let |batchedContributions| be a new [=ordered map=] .
529
553
1. [=list/iterate|For each=] |entry| of |batchEntries|:
530
554
1. [=list/Remove=] |entry| from the [=contribution cache=] .
@@ -541,7 +565,7 @@ a [=batching scope=] |batchingScope|, an [=origin=] |reportingOrigin|, a
541
565
|batchedContributions|:
542
566
1. Perform the [=report creation and scheduling steps=] with
543
567
|reportingOrigin|, |contextType|, |contributions|, |debugDetails|,
544
- |aggregationCoordinator|, |contextId | and |timeout|.
568
+ |aggregationCoordinator|, |preSpecifiedParams | and |timeout|.
545
569
546
570
Note: These steps break up the contributions based on their [=debug details=] as
547
571
each report can only have one set of metadata.
@@ -567,11 +591,15 @@ Issue: Elsewhere, surround algorithms in a `<div algorithm>` block to match, and
567
591
add styling for all algorithms per
568
592
[bikeshed/1472] (https://github.com/speced/bikeshed/issues/1472).
569
593
570
- To <dfn algorithm export>set the context ID for a batching scope</dfn> given
571
- a [=string=] |contextId| and a [=batching scope=] |batchingScope|:
594
+ To <dfn algorithm export>set the pre-specified report parameters for a batching
595
+ scope</dfn> given a [=pre-specified report parameters=] |params| and a
596
+ [=batching scope=] |batchingScope|:
572
597
573
- 1. [=Assert=] : |contextId|'s [=string/length=] is not larger than 64.
574
- 1. [=map/Set=] [=context ID map=] [|batchingScope|] to |contextId|.
598
+ 1. Let |contextId| be |params|' [=pre-specified report parameters/context ID=] .
599
+ 1. [=Assert=] : |contextId| is null or |contextId|'s [=string/length=] is not
600
+ larger than 64.
601
+ 1. [=map/Set=] [=pre-specified report parameters map=] [|batchingScope|] to
602
+ |params|.
575
603
576
604
Scheduling reports {#scheduling-reports}
577
605
----------------------------------------
@@ -580,7 +608,8 @@ To perform the <dfn algorithm>report creation and scheduling steps</dfn> with an
580
608
[=origin=] |reportingOrigin|, a [=context type=] |api|, a [=list=] of
581
609
{{PAHistogramContribution}} s |contributions|, a [=debug details=]
582
610
|debugDetails|, an [=aggregation coordinator=] |aggregationCoordinator|, a
583
- [=string=] or null |contextId| and a [=moment=] or null |timeout|:
611
+ [=pre-specified report parameters=] |preSpecifiedParams| and a [=moment=] or
612
+ null |timeout|:
584
613
1. [=Assert=] : |reportingOrigin| is a [=potentially trustworthy origin=] .
585
614
1. Optionally, return.
586
615
@@ -603,17 +632,14 @@ To perform the <dfn algorithm>report creation and scheduling steps</dfn> with an
603
632
1. Let |sufficientBudget| be the result of [=consuming budget if permitted=]
604
633
given |contributionSum|, |reportingOrigin|, |api| and |currentWallTime|.
605
634
1. If |sufficientBudget| is false:
606
- 1. If |contextId| is null, return.
635
+ 1. Let |isDeterministicReport| be the result of [=determining if a report
636
+ should be sent deterministically=] given |preSpecifiedParams|.
637
+ 1. If |isDeterministicReport| is false, return.
607
638
1. [=list/Empty=] |truncatedContributions|.
608
-
609
- Note: If a context ID was specified, a report is sent, even if there is
610
- insufficent budget for the requested contributions. In this case,
611
- the contributions are dropped. See
612
- [Protecting against leaks via the number of
613
- reports](#protecting-against-leaks-via-the-number-of-reports).
614
639
1. Let |report| be the result of [=obtaining an aggregatable report=] given
615
640
|reportingOrigin|, |api|, |truncatedContributions|, |debugDetails|,
616
- |aggregationCoordinator|, |contextId|, |timeout| and |currentWallTime|.
641
+ |aggregationCoordinator|, |preSpecifiedParams|, |timeout| and
642
+ |currentWallTime|.
617
643
1. [=set/Append=] |report| to the user agent's [=aggregatable report cache=] .
618
644
619
645
To <dfn algorithm>consume budget if permitted</dfn> given a {{long}} |value|, an
@@ -630,8 +656,8 @@ To <dfn>obtain an aggregatable report</dfn> given an [=origin=]
630
656
|reportingOrigin|, a [=context type=] |api|, a [=list=] of
631
657
{{PAHistogramContribution}} s |contributions|, a [=debug details=]
632
658
|debugDetails|, an [=aggregation coordinator=] |aggregationCoordinator|, a
633
- [=string =] or null |contextId |, a [=moment] or null |timeout| and a [=moment=]
634
- |currentTime|,
659
+ [=pre-specified report parameters =] |preSpecifiedParams |, a [=moment] or null
660
+ |timeout| and a [=moment=] | currentTime|,
635
661
perform the following steps. They return an [=aggregatable report=] .
636
662
1. [=Assert=] : |reportingOrigin| is a [=potentially trustworthy origin=] .
637
663
1. Let |reportTime| be the result of running [=obtain a report delivery time=]
@@ -654,7 +680,7 @@ perform the following steps. They return an [=aggregatable report=].
654
680
: [=aggregatable report/aggregation coordinator=]
655
681
:: |aggregationCoordinator|
656
682
: [=aggregatable report/context ID=]
657
- :: |contextId|
683
+ :: |preSpecifiedParams|' [=pre-specified report parameters/context ID=]
658
684
: [=aggregatable report/queued=]
659
685
:: false
660
686
1. Return |report|.
@@ -1046,28 +1072,31 @@ steps. They return an [=aggregation coordinator=], null or a {{DOMException}}:
1046
1072
"`DataError`".
1047
1073
1. Return |origin|.
1048
1074
1049
- To <dfn algorithm>obtain the context ID </dfn> given a
1075
+ To <dfn algorithm>obtain the pre-specified report parameters </dfn> given a
1050
1076
{{SharedStorageRunOperationMethodOptions}} |options|, perform the following
1051
- steps. They return a [=string=] , null, or a {{DOMException}} :
1077
+ steps. They return a [=pre-specified report parameters=] , null, or a
1078
+ {{DOMException}} :
1052
1079
1. If |options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"]
1053
1080
does not [=map/exist=] , return null.
1081
+ 1. Let |contextId| be null.
1054
1082
1. If |options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"]["{{SharedStoragePrivateAggregationConfig/contextId}}"]
1055
- does not [=map/exist=] , return null.
1056
- 1. Let |contextId| be
1083
+ [=map/exists=] , set |contextId| to
1057
1084
|options|["{{SharedStorageRunOperationMethodOptions/privateAggregationConfig}}"]["{{SharedStoragePrivateAggregationConfig/contextId}}"] .
1058
1085
1. If |contextId|'s [=string/length=] is greater than 64, return a new
1059
1086
{{DOMException}} with name "`DataError`".
1060
- 1. Return |contextId|.
1087
+ 1. Return a new [=pre-specified report parameters=] with the items:
1088
+ : [=pre-specified report parameters/context ID=]
1089
+ :: |contextId|
1061
1090
1062
1091
The {{WindowSharedStorage}} 's {{WindowSharedStorage/run()}} method steps are
1063
1092
modified in four ways. First, add the following steps just after step 2 ("If
1064
1093
{{Worklet/addModule()}} has not yet been called, ..."), renumbering later steps
1065
1094
as appropriate:
1066
1095
<div algorithm="shared-storage-run-monkey-patch-1">
1067
- 3. Let |contextId | be the result of [=obtaining the context ID=] given
1068
- |options|.
1069
- 1. If |contextId | is a {{DOMException}} , return [=a promise rejected with=]
1070
- |contextId |.
1096
+ 3. Let |preSpecifiedParams | be the result of [=obtaining the pre-specified
1097
+ report parameters=] given |options|.
1098
+ 1. If |preSpecifiedParams | is a {{DOMException}} , return [=a promise rejected
1099
+ with=] |preSpecifiedParams |.
1071
1100
1. Let |aggregationCoordinator| be the result of [=obtaining the aggregation
1072
1101
coordinator=] given |options|.
1073
1102
1. If |aggregationCoordinator| is a {{DOMException}} , return [=a promise
@@ -1080,19 +1109,23 @@ be |operationMap|[|name|]." (renumbering later steps as appropriate):
1080
1109
2. Let |batchingScope| be a new [=batching scope=] .
1081
1110
1. Let <var ignore> debugScope</var> be a new [=debug scope=] .
1082
1111
1. Let |privateAggregationTimeout| be null.
1083
- 1. If |contextId| is not null:
1084
- 1. Set |privateAggregationTimeout| to the [=current wall time=] plus a
1085
- non-negative [=implementation-defined=] [=duration=] .
1086
- 1. [=Set the context ID for a batching scope=] given |contextId| and
1087
- |batchingScope|.
1112
+ 1. Let |isDeterministicReport| be false.
1113
+ 1. If |preSpecifiedParams| is not null:
1114
+ 1. Set |isDeterministicReport| to the result of [=determining if a report
1115
+ should be sent deterministically=] given |preSpecifiedParams|.
1116
+ 1. If |isDeterministicReport|:
1117
+ 1. Set |privateAggregationTimeout| to the [=current wall time=] plus the
1118
+ [=deterministic operation timeout duration=] .
1119
+ 1. [=Set the pre-specified report parameters for a batching scope=] given
1120
+ |preSpecifiedParams| and |batchingScope|.
1088
1121
1. If |aggregationCoordinator| is not null, [=set the aggregation coordinator
1089
1122
for a batching scope=] given |aggregationCoordinator| and |batchingScope|.
1090
1123
1091
1124
</div>
1092
1125
1093
1126
Third, add the following steps in the same nested scope just before the current
1094
- last step ("Otherwise, [=call =] operation without any arguments list",
1095
- renumbering the last step as appropriate):
1127
+ penultimate step ("If |options| [=map/contains =] |data|", renumbering the last
1128
+ step as appropriate):
1096
1129
<div algorithm="shared-storage-run-monkey-patch-3">
1097
1130
1. Let |hasRunPrivateAggregationCompletionTask| be false.
1098
1131
1. Let |privateAggregationCompletionTask| be an algorithm to perform the
@@ -1101,17 +1134,13 @@ renumbering the last step as appropriate):
1101
1134
1. Set |hasRunPrivateAggregationCompletionTask| to true.
1102
1135
1. [=Mark a debug scope complete=] given <var ignore> debugScope</var> .
1103
1136
1. [=Process contributions for a batching scope=] given
1104
- |batchingScope|, <var ignore> outsideSettings</var> ' [=environment
1105
- settings object/origin=] , "<code> shared-storage</code> " and
1106
- |privateAggregationTimeout|.
1107
- 1. If |contextId| is not null:
1108
- 1. Set |privateAggregationTimeout| to the [=current wall time=] plus a
1109
- non-negative [=implementation-defined=] [=duration=] .
1110
- 1. [=Set the context ID for a batching scope=] given |contextId| and
1111
- |batchingScope|.
1112
- 1. Run the following steps [=in parallel=] :
1113
- 1. Wait until |privateAggregationTimeout|.
1114
- 1. Run |privateAggregationCompletionTask|.
1137
+ <var ignore> batchingScope</var> , <var ignore> outsideSettings</var> '
1138
+ [=environment settings object/origin=] , "<code> shared-storage</code> "
1139
+ and |privateAggregationTimeout|.
1140
+ 1. If <var ignore> isDeterministicReport</var> >, run the following steps [=in
1141
+ parallel=] :
1142
+ 1. Wait until |privateAggregationTimeout|.
1143
+ 1. Run |privateAggregationCompletionTask|.
1115
1144
1116
1145
</div>
1117
1146
@@ -1127,10 +1156,10 @@ are modified in three ways. First, add the following steps just after step 5
1127
1156
("If {{Worklet/addModule()}} has not yet been called, ..."), renumbering later
1128
1157
steps:
1129
1158
<div algorithm="shared-storage-selecturl-monkey-patch-1">
1130
- 6. Let |contextId | be the result of [=obtaining the context ID=] given
1131
- |options|.
1132
- 1. If |contextId | is a {{DOMException}} , return [=a promise rejected with=]
1133
- |contextId |.
1159
+ 6. Let |preSpecifiedParams | be the result of [=obtaining the pre-specified
1160
+ report parameters=] given |options|.
1161
+ 1. If |preSpecifiedParams | is a {{DOMException}} , return [=a promise rejected
1162
+ with=] |preSpecifiedParams |.
1134
1163
1. Let |aggregationCoordinator| be the result of [=obtaining the aggregation
1135
1164
coordinator=] given |options|.
1136
1165
1. If |aggregationCoordinator| is a {{DOMException}} , return [=a promise
@@ -1155,12 +1184,15 @@ be |operationMap|[|name|]." (renumbering later steps as appropriate):
1155
1184
and |privateAggregationTimeout|.
1156
1185
1. If |aggregationCoordinator| is not null, [=set the aggregation coordinator
1157
1186
for a batching scope=] given |aggregationCoordinator| and |batchingScope|.
1158
- 1. If |contextId| is not null:
1159
- 1. Set |privateAggregationTimeout| to the [=current wall time=] plus a
1160
- non-negative [=implementation-defined=] [=duration=] .
1161
- 1. [=Set the context ID for a batching scope=] given |contextId| and
1162
- |batchingScope|.
1163
- 1. Run the following steps [=in parallel=] :
1187
+ 1. If |preSpecifiedParams| is not null:
1188
+ 1. Let |isDeterministicReport| be the result of [=determining if a report
1189
+ should be sent deterministically=] given |preSpecifiedParams|.
1190
+ 1. If |isDeterministicReport|:
1191
+ 1. Set |privateAggregationTimeout| to the [=current wall time=] plus the
1192
+ [=deterministic operation timeout duration=] .
1193
+ 1. [=Set the pre-specified report parameters for a batching scope=] given
1194
+ |preSpecifiedParams| and |batchingScope|.
1195
+ 1. If |isDeterministicReport|, run the following steps [=in parallel=] :
1164
1196
1. Wait until |privateAggregationTimeout|.
1165
1197
1. Run |privateAggregationCompletionTask|.
1166
1198
@@ -1219,6 +1251,14 @@ Note: This extends Shared Storage's existing {{Worklet/addModule()}}
1219
1251
<a href="https://wicg.github.io/shared-storage/#worklet-monkey-patch">
1220
1252
monkey patch</a> .
1221
1253
1254
+ [=Implementation-defined=] values {#shared-storage-implementation-defined-values}
1255
+ ---------------------------------------------------------------------------------
1256
+
1257
+ <dfn>Deterministic operation timeout duration</dfn> is a non-negative
1258
+ [=duration=] that controls how long a Shared Storage operation may make Private
1259
+ Aggregation contributions if it is triggering a deterministic report and,
1260
+ equivalently, when that report should be sent after the operation begins.
1261
+
1222
1262
Protected Audience API monkey patches {#protected-audience-api-monkey-patches}
1223
1263
==============================================================================
1224
1264
@@ -2220,9 +2260,10 @@ stored for the [=consume budget if permitted=] algorithm contain data about a
2220
2260
user’s web activity. As such, user controls to delete this data are required,
2221
2261
see [clearing storage] (#clearing-storage).
2222
2262
2223
- On the other hand, the [=context ID map=] , the [=contribution cache=] and the
2224
- [=debug scope map=] only contain short-lived data tied to particular [=batching
2225
- scopes=] and [=debug scopes=] , so controls are not required.
2263
+ On the other hand, the [=contribution cache=] , the [=debug scope map=] and the
2264
+ [=pre-specified report parameters map=] only contain short-lived data tied to
2265
+ particular [=batching scopes=] and [=debug scopes=] , so controls are not
2266
+ required.
2226
2267
2227
2268
Reporting delay concerns {#reporting-delay-concerns}
2228
2269
----------------------------------------------------
@@ -2304,10 +2345,10 @@ Security considerations {#security-considerations}
2304
2345
Same-origin policy {#same-origin-policy}
2305
2346
----------------------------------------
2306
2347
2307
- Writes to the [=aggregatable report cache=] , [=context ID map =] , [=contribution
2308
- cache =] and [=debug scope map=] are separated by the reporting [=origin=] and
2309
- the data included in any report with a given reporting [=origin=] are generated
2310
- with only data from that [=origin=] .
2348
+ Writes to the [=aggregatable report cache=] , [=contribution cache =] , [=debug
2349
+ scope map =] and [=pre-specified report parameters map=] are attributed to the
2350
+ reporting [=origin=] and the data included in any report with a given reporting
2351
+ [=origin=] are generated with only data from that [=origin=] .
2311
2352
2312
2353
One notable exception is the [=consume budget if permitted=] algorithm which is
2313
2354
[=implementation-defined=] and can consider contribution history from other
0 commit comments