Skip to content

Commit

Permalink
[spec] Fix semantics around Abort Signal for runAdAuction() (#1266)
Browse files Browse the repository at this point in the history
* Fix semantics around Abort Signal for runAdAuction()

* Address comments

* Address more comments

* Address comments

* Apply suggestions from code review

Co-authored-by: qingxinwu <6334674+qingxinwu@users.noreply.github.com>

---------

Co-authored-by: Paul Jensen <JensenPaul@users.noreply.github.com>
Co-authored-by: qingxinwu <6334674+qingxinwu@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 23, 2024
1 parent 8500843 commit 9a4a270
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -774,11 +774,11 @@ The <dfn for=Navigator method>runAdAuction(|config|)</dfn> method steps are:
1. Let |signal| be |config|["{{AuctionAdConfig/signal}}"].
1. If |signal| is [=AbortSignal/aborted=], then [=reject=] |p| with |signal|'s
[=AbortSignal/abort reason=] and return |p|.
1. [=AbortSignal/Add|Add the following abort steps=] to |signal|:
1. [=Reject=] |p| with |signal|’s [=AbortSignal/abort reason=].
1. Run [=update bid counts=] with |bidIgs|.
1. Run [=interest group update=] with |auctionConfig|'s [=auction config/interest group buyers=]
and |settings|'s [=environment settings object/policy container=].
1. Otherwise [=AbortSignal/Add|add the following abort steps=] to |signal|:
1. Set |auctionConfig|'s [=auction config/aborted=] to true.
1. Set |auctionConfig|'s [=auction config/abort reason=] to |signal|'s [=AbortSignal/abort reason=].
1. [=list/For each=] |auction| in |auctionConfig|'s [=auction config/component auctions=]:
1. Set |auction|'s [=auction config/aborted=] to true.
1. [=Assert=] that |settings|'s [=environment settings object/origin=] is not an [=opaque origin=]
and its [=origin/scheme=] is "`https`".
1. Let |queue| be the result of [=starting a new parallel queue=].
Expand All @@ -797,7 +797,10 @@ The <dfn for=Navigator method>runAdAuction(|config|)</dfn> method steps are:
|bidDebugReportInfoList|, |auctionConfig|'s [=auction config/seller=], and |winnerInfo|.
1. Set |auctionReportInfo|'s [=auction report info/real time reporting contributions map=] to
|realTimeContributionsMap|.
1. If |winnerInfo| is failure, then [=queue a global task=] on [=DOM manipulation task source=],
1. If |auctionConfig|'s [=auction config/aborted=] is true:
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |global|, to
[=reject=] |p| with |auctionConfig|'s [=auction config/abort reason=].
1. Otherwise if |winnerInfo| is failure, then [=queue a global task=] on [=DOM manipulation task source=],
given |global|, to [=reject=] |p| with a "{{TypeError}}".
1. Otherwise if |winnerInfo| is null or |winnerInfo|'s [=leading bid info/leading bid=] is null:
1. [=Queue a global task=] on [=DOM manipulation task source=], given |global|, to [=resolve=]
Expand All @@ -818,10 +821,10 @@ The <dfn for=Navigator method>runAdAuction(|config|)</dfn> method steps are:
1. If |auctionConfig|'s [=auction config/resolve to config=] is false, then set |result| to |urn|.
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |global|, to
resolve |p| with |result|.
1. Run [=update previous wins=] with |winner|.
1. Run [=interest group update=] with |auctionConfig|'s [=auction config/interest group buyers=]
and |settings|'s [=environment settings object/policy container=].
1. Run [=update bid counts=] with |bidIgs|.
1. Run [=update previous wins=] with |winner|.
1. Return |p|.

</div>
Expand Down Expand Up @@ -1659,6 +1662,7 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
batcher=] with |auctionConfig|'s [=auction config/max trusted scoring signals url length=].
1. Let « |bidGenerators|, |negativeTargetInfo| » be the result of running
[=build bid generators map=] with |auctionConfig|.
1. If |auctionConfig|'s [=auction config/aborted=] is true, return failure.
1. Let |leadingBidInfo| be a new [=leading bid info=].
1. Let |queue| be the result of [=starting a new parallel queue=].
1. Let |capturedAuctionHeaders| be |global|'s [=associated Document's=] [=node navigable's=]
Expand Down Expand Up @@ -1699,6 +1703,7 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
and |realTimeContributionsMap|.
1. Decrement |pendingComponentAuctions| by 1.
1. Wait until |pendingComponentAuctions| is 0.
1. If |auctionConfig|'s [=auction config/aborted=] is true, return failure.
1. If |leadingBidInfo|'s [=leading bid info/leading bid=] is null, return null.
1. Let |winningComponentConfig| be |leadingBidInfo|'s [=leading bid info/auction config=].
1. Set |leadingBidInfo|'s [=leading bid info/auction config=] to |auctionConfig|.
Expand Down Expand Up @@ -1943,6 +1948,7 @@ and a [=real time reporting contributions map=] |realTimeContributionsMap|:
|componentAuctionExpectedCurrency|, |topLevelOrigin|, and |realTimeContributionsMap|.
1. Decrement |pendingBuyers| by 1.
1. Wait until both |pendingBuyers| and |pendingAdditionalBids| are 0.
1. If |auctionConfig|'s [=auction config/aborted=] is true, return failure.
1. If |leadingBidInfo|'s [=leading bid info/leading bid=] is null, return null.
1. If |topLevelAuctionConfig| is null:
1. Let « |sellerSignals|, |reportResultBrowserSignals| » be the result of running
Expand Down Expand Up @@ -4083,6 +4089,7 @@ from querying the server during an auction.

<div algorithm>
To <dfn>update k-anonymity cache for key</dfn> given a [=SHA-256=] |hashCode|:
1. [=Assert=] that these steps are running [=in parallel=].
1. Let |record| be a new [=k-anonymity record=].
1. Set |record|'s [=k-anonymity record/timestamp=] field to the [=current wall time=].
1. Set |record|'s [=k-anonymity record/is k-anonymous=] field to the result of executing [=query k-anonymity count=] for |hashCode|.
Expand All @@ -4091,6 +4098,7 @@ from querying the server during an auction.

<div algorithm>
To <dfn>update k-anonymity cache for interest group</dfn> given an [=interest group=] |ig|:
1. [=Assert=] that these steps are running [=in parallel=].
1. [=list/For each=] |igAd| of |ig|'s [=interest group/ads=]:
1. Compute the |adHashCode| following [=compute the key hash of ad=] for |ig| and |igAd|.
1. Run [=update k-anonymity cache for key=] on |adHashCode|.
Expand Down Expand Up @@ -6463,13 +6471,19 @@ An <dfn>auction config</dfn> is a [=struct=] with the following [=struct/items=]
encrypted response stored in [=auction config=]'s [=auction config/server response=] field.
Must be null when [=auction config=]'s [=auction config/server response=] is null,
and non-null otherwise.
: <dfn>aborted</dfn>
:: A [=boolean=] indicating whether the auction has been aborted, initially false.
: <dfn>abort reason</dfn>
:: {{any}}.
</dl>

<div algorithm>
To <dfn>wait until configuration input promises resolve</dfn> given an [=auction config=]
|auctionConfig|:

1. Wait until |auctionConfig|'s [=auction config/pending promise count=] is 0.
1. Wait until either |auctionConfig|'s [=auction config/pending promise count=] is 0
or |auctionConfig|'s [=auction config/aborted=] is true.
1. If |auctionConfig|'s [=auction config/aborted=] is true, return failure.
1. [=Assert=] |auctionConfig|'s [=auction config/auction signals=], [=auction config/seller signals=],
[=auction config/per buyer signals=], [=auction config/per buyer currencies=],
[=auction config/per buyer timeouts=], [=auction config/per buyer cumulative timeouts=],
Expand Down

0 comments on commit 9a4a270

Please sign in to comment.