diff --git a/spec.bs b/spec.bs index 9c13897..1ec3ebd 100644 --- a/spec.bs +++ b/spec.bs @@ -379,6 +379,8 @@ An aggregatable report is a [=struct=] with the following items: :: A [=string=] or null : filtering ID max bytes :: A positive integer +: max contributions +:: A positive integer : queued :: A [=boolean=] @@ -411,6 +413,8 @@ items: :: A [=string=] or null : filtering ID max bytes (default: [=default filtering ID max bytes=]) :: A positive integer +: requested max contributions (default: null) +:: A positive integer or null @@ -467,10 +471,20 @@ controls which [=origins=] are valid [=aggregation coordinators=]. Every Default aggregation coordinator is an [=aggregation coordinator=] that controls which is used for a report if none is explicitly selected. -Maximum report contributions is a [=map=] from [=context type=] to -positive integers. Semantically, it defines the maximum number of contributions -that can be present in a single report for every kind of calling context, e.g. -Shared Storage. +Maximum maxContributions is a positive integer that defines an upper +bound on the number of contributions per [=aggregatable report=]. + +Valid maxContributions range is a non-empty [=set=] of positive +integers. Its value is [=the inclusive range=] 1 to [=maximum +maxContributions=]. The values in this range exhaustively define the possible +values for the number of contributions per [=aggregatable report=]. + +Default maxContributions by API is a [=map=] from [=context types=] +to positive integers. Semantically, it defines the default number of +contributions per report for every kind of calling context, e.g. Shared Storage. +The values in this map are used when callers do not specifically request another +value. Each of the values in this map must be [=set/contained=] in the [=valid +maxContributions range=]. Minimum report delay is a non-negative [=duration=] that controls the minimum delay to deliver an [=aggregatable report=]. @@ -666,6 +680,9 @@ scope given a [=pre-specified report parameters=] |params| and a filtering ID max bytes=]. 1. [=Assert=]: |filteringIdMaxBytes| is [=set/contained=] in the [=valid filtering ID max bytes range=] +1. Let |requestedMaxContributions| be |params|' [=pre-specified report + parameters/requested max contributions=]. +1. [=Assert=]: |requestedMaxContributions| is null or greater than zero. 1. [=map/Set=] [=pre-specified report parameters map=][|batchingScope|] to |params|. @@ -701,11 +718,13 @@ null |timeout|: 1. [=iteration/Break=]. 1. If |hasProcessedContribution| is false, [=list/append=] |contribution| to |mergedContributions|. +1. Let |effectiveMaxContributions| be the result of [=determining the effective + max contributions=] with |preSpecifiedParams| and |api|. 1. Let |truncatedContributions| be a new [=list=]. -1. If |mergedContributions| has a [=list/size=] greater than [=maximum report - contributions=][|api|]: - 1. [=set/For each=] |n| of [=the exclusive range|the range=] 0 to [=maximum - report contributions=][|api|], exclusive: +1. If |mergedContributions| has a [=list/size=] greater than + |effectiveMaxContributions|: + 1. [=set/For each=] |n| of [=the exclusive range|the range=] 0 to + |effectiveMaxContributions|, exclusive: 1. [=set/Append=] |mergedContributions|[|n|] to |truncatedContributions|. 1. Otherwise, set |truncatedContributions| to |mergedContributions|. @@ -754,7 +773,7 @@ To obtain an aggregatable report given an [=origin=] |reportingOrigin|, a [=context type=] |api|, a [=list=] of {{PAHistogramContribution}}s |contributions|, a [=debug details=] |debugDetails|, an [=aggregation coordinator=] |aggregationCoordinator|, a -[=pre-specified report parameters=] |preSpecifiedParams|, a [=moment] or null +[=pre-specified report parameters=] |preSpecifiedParams|, a [=moment=] or null |timeout| and a [=moment=] |currentTime|, perform the following steps. They return an [=aggregatable report=]. 1. [=Assert=]: |reportingOrigin| is a [=potentially trustworthy origin=]. @@ -782,6 +801,9 @@ perform the following steps. They return an [=aggregatable report=]. : [=aggregatable report/filtering ID max bytes=] :: |preSpecifiedParams|' [=pre-specified report parameters/filtering ID max bytes=] + : [=aggregatable report/max contributions=] + :: The result of [=determining the effective max contributions=] with + |preSpecifiedParams| and |api|. : [=aggregatable report/queued=] :: false 1. Return |report|. @@ -804,6 +826,21 @@ They return a [=moment=]. +
+To determine the effective max contributions given a [=pre-specified +report parameters=] |preSpecifiedParams| and a [=context type=] |api|, perform +the following steps. They return a positive integer that is [=set/contained=] in +the [=valid maxContributions range=]. +1. Let |defaultMaxContributions| be [=default maxContributions by API=][|api|]. +1. Let |requestedMaxContributions| be |preSpecifiedParams|' [=pre-specified + report parameters/requested max contributions=]. +1. If |requestedMaxContributions| is null, return |defaultMaxContributions|. +1. If |requestedMaxContributions| is greater than [=maximum maxContributions=], + return [=maximum maxContributions=]. +1. Return |requestedMaxContributions|. + +
+ Sending reports {#sending-reports} ---------------------------------- @@ -1027,8 +1064,9 @@ To obtain the plaintext payload given an [=aggregatable report=] |report|, perform the following steps. They return a [=byte sequence=]. 1. Let |payloadData| be a new [=list=]. 1. Let |contributions| be |report|'s [=aggregatable report/contributions=]. -1. Let |maxContributions| be - [=maximum report contributions=][[=aggregatable report/api=]]. +1. Let |maxContributions| be |report|'s [=aggregatable report/max contributions=]. +1. If |maxContributions| is null, set it to [=default maxContributions by + API=][[=aggregatable report/api=]]. 1. [=Assert=]: |contributions|' [=list/size=] is not greater than |maxContributions|. 1. [=iteration/While=] |contributions|' [=list/size=] is less than @@ -1196,6 +1234,9 @@ Note: Without this, [=aggregatable reports=] would be subject to delays, making +Issue: Add Shared Storage monkey patch that defines the `maxContributions` +field. + Protected Audience API monkey patches {#protected-audience-api-monkey-patches} ============================================================================== @@ -1341,16 +1382,21 @@ WebIDL modifications {#protected-audience-api-webidl-modifications} The {{AuctionAdConfig}} and {{AuctionAdInterestGroup}} dictionaries are modified to add a new field: -dictionary ProtectedAudiencePrivateAggregationConfig { +dictionary ProtectedAudienceAuctionPrivateAggregationConfig { + USVString aggregationCoordinatorOrigin; + [EnforceRange] unsigned long long maxContributions; +}; + +dictionary ProtectedAudienceInterestGroupPrivateAggregationConfig { USVString aggregationCoordinatorOrigin; }; partial dictionary AuctionAdConfig { - ProtectedAudiencePrivateAggregationConfig privateAggregationConfig; + ProtectedAudienceAuctionPrivateAggregationConfig privateAggregationConfig; }; partial dictionary AuctionAdInterestGroup { - ProtectedAudiencePrivateAggregationConfig privateAggregationConfig; + ProtectedAudienceInterestGroupPrivateAggregationConfig privateAggregationConfig; };