@@ -706,6 +706,7 @@ dictionary AuctionAdConfig {
706
706
USVString sellerCurrency;
707
707
Promise<record<USVString, any> > perBuyerSignals;
708
708
Promise<record<USVString, unsigned long long> > perBuyerTimeouts;
709
+ Promise<record<USVString, unsigned long long> > perBuyerCumulativeTimeouts;
709
710
record<USVString, unsigned short> perBuyerGroupLimits;
710
711
record<USVString, unsigned short> perBuyerExperimentGroupIds;
711
712
record<USVString, record<USVString, double>> perBuyerPrioritySignals;
@@ -1163,23 +1164,36 @@ To <dfn>validate and convert auction ad config</dfn> given an {{AuctionAdConfig}
1163
1164
1. [=map/Set=] |auctionConfig|'s [=auction config/per buyer signals=] [|buyer|] to
1164
1165
|signalsString|.
1165
1166
* To handle an error, set |auctionConfig|'s [=auction config/per buyer signals=] to failure.
1166
- 1. If |config|["{{AuctionAdConfig/perBuyerTimeouts}}"] [=map/exists=] :
1167
- 1. Set |auctionConfig|'s [=auction config/per buyer timeouts=] to
1168
- |config|["{{AuctionAdConfig/perBuyerTimeouts}}"] .
1169
- 1. [=Handle an input promise in configuration=] given |auctionConfig| and |auctionConfig|'s
1170
- [=auction config/per buyer timeouts=] :
1171
- * To parse the value |result|:
1172
- 1. Set |auctionConfig|'s [=auction config/per buyer timeouts=] to a new [=ordered map=] whose
1173
- [=map/keys=] are [=origins=] and whose [=map/values=] are [=durations=] in milliseconds.
1174
- 1. [=map/For each=] |key| → |value| of |result|:
1175
- 1. If |key| is "*", then set |auctionConfig|'s [=auction config/all buyers timeout=]
1176
- to |value| in milliseconds or 500 milliseconds, whichever is smaller, and
1177
- [=iteration/continue=] .
1178
- 1. Let |buyer| be the result of [=parsing an https origin=] with |key|. If |buyer| is
1179
- failure, [=exception/throw=] a {{TypeError}} .
1180
- 1. [=map/Set=] |auctionConfig|'s [=auction config/per buyer timeouts=] [|buyer|] to
1181
- |value| in milliseconds or 500 milliseconds, whichever is smaller.
1182
- * To handle an error, set |auctionConfig|'s [=auction config/per buyer timeouts=] to failure.
1167
+ 1. For each |idlTimeoutMember|, |perBuyerTimeoutField|, |allBuyersTimeoutField| in the following table
1168
+ <table class="data">
1169
+ <thead><tr><th> IDL timeout member</th><th> Per buyer timeout field</th><th> All buyers timeout field</th></tr></thead>
1170
+ <tr>
1171
+ <td> "{{AuctionAdConfig/perBuyerTimeouts}} "</td>
1172
+ <td> [=auction config/per buyer timeouts=] </td>
1173
+ <td> [=auction config/all buyers timeout=] </td>
1174
+ </tr>
1175
+ <tr>
1176
+ <td> "{{AuctionAdConfig/perBuyerCumulativeTimeouts}} "</td>
1177
+ <td> [=auction config/per buyer cumulative timeouts=] </td>
1178
+ <td> [=auction config/all buyers cumulative timeout=] </td>
1179
+ </tr>
1180
+ </table>
1181
+ 1. If |config| [=map/contains=] |idlTimeoutMember|:
1182
+ 1. Set |auctionConfig|'s |perBuyerTimeoutField| to |config|[|idlTimeoutMember|] .
1183
+ 1. [=Handle an input promise in configuration=] given |auctionConfig| and |auctionConfig|'s
1184
+ |perBuyerTimeoutField|:
1185
+ * To parse the value |result|:
1186
+ 1. Set |auctionConfig|'s |perBuyerTimeoutField| to a new [=ordered map=] whose
1187
+ [=map/keys=] are [=origins=] and whose [=map/values=] are [=durations=] in milliseconds.
1188
+ 1. [=map/For each=] |key| → |value| of |result|:
1189
+ 1. If |perBuyerTimeoutField| is "{{AuctionAdConfig/perBuyerTimeouts}} ", and
1190
+ |value| > 500, then set |value| to 500.
1191
+ 1. If |key| is "*", then set |auctionConfig|'s |allBuyersTimeoutField| to |value| in
1192
+ milliseconds, and [=iteration/continue=] .
1193
+ 1. Let |buyer| be the result of [=parsing an https origin=] with |key|. If |buyer| is
1194
+ failure, [=exception/throw=] a {{TypeError}} .
1195
+ 1. [=map/Set=] |auctionConfig|'s |perBuyerTimeoutField|[|buyer|] to |value| in milliseconds.
1196
+ * To handle an error, set |auctionConfig|'s |perBuyerTimeoutField| to failure.
1183
1197
1. If |config|["{{AuctionAdConfig/perBuyerGroupLimits}}"] [=map/exists=] , [=map/for each=]
1184
1198
|key| → |value| of |config|["{{AuctionAdConfig/perBuyerGroupLimits}}"] :
1185
1199
1. If |value| is 0, then return failure.
@@ -1483,6 +1497,12 @@ To <dfn>generate and score bids</dfn> given an [=auction config=] |auctionConfig
1483
1497
1. Decrement |pendingAdditionalBids| by 1.
1484
1498
1. [=map/For each=] |buyer| → |perBuyerGenerator| of |bidGenerators|,
1485
1499
[=parallel queue/enqueue steps|enqueue the following steps=] to |queue|:
1500
+ 1. Let |perBuyerCumulativeTimeout| be |auctionConfig|'s
1501
+ [=auction config/all buyers cumulative timeout=] .
1502
+ 1. If |auctionConfig|'s [=auction config/per buyer cumulative timeouts=] is not null and
1503
+ [=auction config/per buyer cumulative timeouts=] [|buyer|] [=map/exists=] , then set
1504
+ |perBuyerCumulativeTimeout| to |auctionConfig|'s
1505
+ [=auction config/per buyer cumulative timeouts=] [|buyer|] .
1486
1506
1. Let |buyerExperimentGroupId| be |allBuyersExperimentGroupId|.
1487
1507
1. Let |perBuyerExperimentGroupIds| be |auctionConfig|'s
1488
1508
[=auction config/per buyer experiment group ids=] .
@@ -1516,6 +1536,8 @@ To <dfn>generate and score bids</dfn> given an [=auction config=] |auctionConfig
1516
1536
1. [=map/For each=] |signalsUrl| → |perSignalsUrlGenerator| of |perBuyerGenerator|:
1517
1537
1. Let |keys| be a new [=ordered set=] .
1518
1538
1. Let |igNames| be a new [=ordered set=] .
1539
+ 1. Let |fetchSignalStartTime| be |settings|'s [=environment settings object/current monotonic time=] .
1540
+
1519
1541
1. [=map/For each=] joiningOrigin → |groups| of |perSignalsUrlGenerator|:
1520
1542
1. [=list/For each=] |ig| of |groups|:
1521
1543
1. [=set/Append=] |ig|'s [=interest group/trusted bidding signals keys=] to |keys|.
@@ -1526,16 +1548,25 @@ To <dfn>generate and score bids</dfn> given an [=auction config=] |auctionConfig
1526
1548
with |biddingSignalsUrl| and true.
1527
1549
1. If |dataVersion| is not null, then [=map/set=]
1528
1550
|browserSignals|["{{BiddingBrowserSignals/dataVersion}}"] to |dataVersion|.
1551
+ 1. Let |fetchSignalDuration| be the [=duration from=] |fetchSignalStartTime| to |settings|'s
1552
+ [=environment settings object/current monotonic time=] , in milliseconds.
1553
+ 1. If |perBuyerCumulativeTimeout| is not null:
1554
+ 1. Decrement |perBuyerCumulativeTimeout| by |fetchSignalDuration|.
1555
+ 1. If |perBuyerCumulativeTimeout| is negative, then [=iteration/break=] ;
1529
1556
1. [=map/For each=] joiningOrigin → |groups| of |perSignalsUrlGenerator|:
1530
1557
1. [=list/For each=] |ig| of |groups|:
1531
1558
1. If |ig|'s [=interest group/bidding url=] is null, [=iteration/continue=] .
1532
- 1. Let |directFromSellerSignalsForBuyer| be the result of running
1533
- [=get direct from seller signals for a buyer=] with |directFromSellerSignals|, and
1534
- |ig|'s [=interest group/owner=] .
1535
- 1. Let |generatedBid| be the result of [=generate a bid=] given
1536
- |allTrustedBiddingSignals|, |auctionSignals|, a [=map/clone=] of |browserSignals|,
1537
- |perBuyerSignals|, |directFromSellerSignalsForBuyer|, |perBuyerTimeout|, |expectedCurrency|,
1538
- |ig|, and |auctionStartTime|.
1559
+ 1. If |perBuyerCumulativeTimeout| is not null and is less than |perBuyerTimeout|, then set
1560
+ |perBuyerTimeout| to |perBuyerCumulativeTimeout|.
1561
+ 1. Let |generateBidStartTime| be |settings|'s
1562
+ [=environment settings object/current monotonic time=] .
1563
+ 1. Let |generatedBid| be the result of [=generate a bid=] given |allTrustedBiddingSignals|,
1564
+ |auctionSignals|, a [=map/clone=] of |browserSignals|, |perBuyerSignals|,
1565
+ |perBuyerTimeout|, |expectedCurrency|, |ig|, and |auctionStartTime|.
1566
+ 1. Let |generateBidDuration| be the [=duration from=] |generateBidStartTime| to |settings|'s
1567
+ [=environment settings object/current monotonic time=] , in milliseconds.
1568
+ 1. If |perBuyerCumulativeTimeout| is not null, decrement |perBuyerCumulativeTimeout| by
1569
+ |generateBidDuration|.
1539
1570
1. If |generatedBid| is failure, [=iteration/continue=] .
1540
1571
1. If [=query generated bid k-anonymity count=] given |generatedBid| returns false:
1541
1572
@@ -1563,13 +1594,20 @@ To <dfn>generate and score bids</dfn> given an [=auction config=] |auctionConfig
1563
1594
1. If [=query component ad k-anonymity count=] given |adComponent|'s
1564
1595
[=interest group ad/render url=] returns true, [=list/append=] |adComponent| to |ig|'s
1565
1596
[=interest group/ad components=] .
1597
+ 1. If |perBuyerCumulativeTimeout| is not null and is less than |perBuyerTimeout|, then set
1598
+ |perBuyerTimeout| to |perBuyerCumulativeTimeout|.
1599
+ 1. Let |generateBidStartTime| be |settings|'s
1600
+ [=environment settings object/current monotonic time=] .
1566
1601
1. Set |generatedBid| to the result of [=generate a bid=] given
1567
1602
|allTrustedBiddingSignals|, |auctionSignals|, a [=map/clone=] of |browserSignals|,
1568
1603
|perBuyerSignals|, |directFromSellerSignalsForBuyer|, |perBuyerTimeout|, |expectedCurrency|,
1569
1604
and |ig|.
1570
-
1571
1605
1. Set |ig|'s [=interest group/ads=] to |originalAds|.
1572
1606
1. Set |ig|'s [=interest group/ad components=] to |originalAdComponents|.
1607
+ 1. Let |generateBidDuration| be the [=duration from=] |generateBidStartTime| to
1608
+ |settings|'s [=environment settings object/current monotonic time=] , in milliseconds.
1609
+ 1. If |perBuyerCumulativeTimeout| is not null, then decrement |perBuyerCumulativeTimeout|
1610
+ by |generateBidDuration|.
1573
1611
1. If |generatedBid| is failure, [=iteration/continue=] .
1574
1612
1. [=list/Insert=] |generatedBid|'s [=generated bid/interest group=] in |bidIgs|.
1575
1613
1. [=Score and rank a bid=] with |auctionConfig|, |generatedBid|, |leadingBidInfo|,
@@ -2953,6 +2991,10 @@ of the following global objects:
2953
2991
1. Let |realm| be the result of [=creating a new script runner realm=] given
2954
2992
{{InterestGroupBiddingScriptRunnerGlobalScope}} .
2955
2993
1. Let |global| be |realm|'s [=realm/global object=] .
2994
+ 1. Let |settings| be |realm|'s [=realm/settings object=] .
2995
+
2996
+ Issue: <a href="https://github.com/WICG/turtledove/issues/676">WICG/turtledove#676</a> needs
2997
+ to be fixed in order to get |realm|'s [=realm/settings object=] .
2956
2998
1. Set |global|'s
2957
2999
[=InterestGroupBiddingScriptRunnerGlobalScope/group has ad components=] to true if |ig|'s
2958
3000
[=interest group/ad components=] is not null, or false otherwise.
@@ -2972,11 +3014,12 @@ of the following global objects:
2972
3014
1. Let |browserSignalsJS| be |browserSignals| [=converted to ECMAScript values=] .
2973
3015
1. Let |directFromSellerSignalsJs| be |directFromSellerSignalsForBuyer|
2974
3016
[=converted to ECMAScript values=] .
2975
- 1. Let |startTime| be the [=current wall time=] .
3017
+ 1. Let |startTime| be |settings|'s [=environment settings object/ current monotonic time=] .
2976
3018
1. Let |result| be the result of [=evaluating a script=] with |realm|, |script|, "`generateBid`",
2977
3019
« |igJS|, |auctionSignalsJS|, |perBuyerSignalsJS|, |trustedBiddingSignalsJS|, |browserSignalsJS|,
2978
3020
|directFromSellerSignalsJs| », and |timeout|.
2979
- 1. Let |duration| be the [=current wall time=] minus |startTime| in milliseconds.
3021
+ 1. Let |duration| be |settings|'s [=environment settings object/current monotonic time=] minus
3022
+ |startTime| in milliseconds.
2980
3023
1. If |global|'s [=InterestGroupBiddingScriptRunnerGlobalScope/priority=] is not null and not failure:
2981
3024
1. Set |ig|'s [=interest group/priority=] to |global|' s
2982
3025
[=InterestGroupBiddingScriptRunnerGlobalScope/priority=] .
@@ -3056,13 +3099,16 @@ of the following global objects:
3056
3099
3057
3100
<div algorithm>
3058
3101
To <dfn>evaluate a script</dfn> with a [=ECMAScript/realm=] |realm|, [=string=] |script|, [=string=]
3059
- |functionName|, a [=list=] |arguments|, and an integer millisecond duration |timeout|, run these steps.
3102
+ |functionName|, a [=list=] |arguments|, and an integer millisecond [= duration=] |timeout|, run these steps.
3060
3103
They return a [=ECMAScript/Completion Record=] , which is either an [=ECMAScript/abrupt completion=] (in
3061
3104
the case of a parse failure or execution error), or a [=ECMAScript/normal completion=] populated with the
3062
3105
[=ECMAScript/ECMAScript language value=] result of invoking |functionName|.
3063
3106
3064
3107
1. [=Assert=] that these steps are running [=in parallel=] .
3065
3108
3109
+ 1. If |timeout| ≤ 0, [=immediately=] interrupt the execution and set |finalCompletion| to a
3110
+ new [=ECMAScript/throw completion=] given null.
3111
+
3066
3112
1. Let |global| be |realm|'s [=realm/global object=], and run these steps in |realm|' s [=realm/agent=] :
3067
3113
3068
3114
1. Let |result| be [$ParseScript$] (|script|, |realm|, `empty`).
@@ -3233,7 +3279,7 @@ To <dfn>convert GenerateBidOutput to generated bid</dfn> given a {{GenerateBidOu
3233
3279
[=generated bid/ad cost=] to |generateBidOutput|["{{GenerateBidOutput/adCost}}"] .
3234
3280
1. If |generateBidOutput|["{{GenerateBidOutput/modelingSignals}}"] [=map/exists=] :
3235
3281
1. Let |modelingSignals| be |generateBidOutput|["{{GenerateBidOutput/modelingSignals}}"] .
3236
- 1. If |modelingSignals| ≥ 0 and |modelingSignals| < 4096, then set |bid|'s
3282
+ 1. If |modelingSignals| ≥ 0 and |modelingSignals| < 4096, then set |bid|'s
3237
3283
[=generated bid/modeling signals=] to the result of [=converted to an IDL value|converting=]
3238
3284
the ECMAScript value represented by |modelingSignals| to an {{unsigned short}} .
3239
3285
1. Return |bid|.
@@ -4274,6 +4320,23 @@ An auction config is a [=struct=] with the following items:
4274
4320
Restricts the `generateBid()` script's runtime for all buyers without a timeout specified in
4275
4321
[=auction config/per buyer timeouts=] . If the timeout expires, only the bid submitted via
4276
4322
`setBid()` is considered.
4323
+ : <dfn>per buyer cumulative timeouts</dfn>
4324
+ :: Null, a {{Promise}} , failure, or an [=ordered map=] whose [=map/keys=] are [=origins=] and
4325
+ whose [=map/values=] are [=durations=] in milliseconds.
4326
+ [=map/Keys=] are buyers and must be valid HTTPS [=origins=] . [=map/Values=] are collective
4327
+ timeouts for all interest groups of the buyer represented by the [=map/key=] . Includes the time of
4328
+ loading scripts and signals, and running the `generateBid()` functions. Once the timer expires,
4329
+ the affected buyer's interest groups may no longer generate any bids. All bids generated before
4330
+ the timeout will continue to participate in the auction.
4331
+ Implementations should attempt, on a best-effort basis, to generate bids for each buyer in
4332
+ priority order, so lower priority [=interest groups=] are the ones more likely to be timed out. If
4333
+ {{Promise}} s are passed in to the [=auction config=] for fields that support them,
4334
+ [=wait until configuration input promises resolve=] before starting the timer.
4335
+
4336
+ : <dfn>all buyers cumulative timeout</dfn>
4337
+ :: Null or a [=duration=] in milliseconds, initially null.
4338
+ Restricts a buyer's cumulative timeout for all buyers without one specified in
4339
+ [=auction config/per buyer cumulative timeouts=] .
4277
4340
: <dfn>per buyer group limits</dfn>
4278
4341
:: Null or an [=ordered map=] whose [=map/keys=] are [=origins=] and whose [=map/values=] are
4279
4342
{{unsigned short}} s.
@@ -4359,12 +4422,13 @@ To <dfn>wait until configuration input promises resolve</dfn> given an [=auction
4359
4422
1. Wait until |auctionConfig|'s [=auction config/pending promise count=] is 0.
4360
4423
1. [=Assert=] |auctionConfig|'s [=auction config/auction signals=] , [=auction config/seller signals=] ,
4361
4424
[=auction config/per buyer signals=] , [=auction config/per buyer currencies=] ,
4362
- [=auction config/per buyer timeouts=] , and [=auction config/direct from seller signals header ad slot=]
4363
- are not {{Promise}} s, and [=auction config/expects additional bids=] is false.
4425
+ [=auction config/per buyer timeouts=] , [=auction config/per buyer cumulative timeouts=] , and
4426
+ [=auction config/direct from seller signals header ad slot=] are not {{Promise}} s, and
4427
+ [=auction config/expects additional bids=] is false.
4364
4428
1. If |auctionConfig|'s [=auction config/auction signals=] , [=auction config/seller signals=] ,
4365
4429
[=auction config/per buyer signals=] , [=auction config/per buyer currencies=] ,
4366
- [=auction config/per buyer timeouts=] , or [=auction config/direct from seller signals header ad slot=]
4367
- is failure, return failure.
4430
+ [=auction config/per buyer timeouts=] , [=auction config/per buyer cumulative timeouts=] , or
4431
+ [=auction config/direct from seller signals header ad slot=] is failure, return failure.
4368
4432
1. Return.
4369
4433
4370
4434
</div>
0 commit comments