From d9ad4d175bfbb3cb01bd8f50ee6b8c724619fbc8 Mon Sep 17 00:00:00 2001 From: brusshamilton Date: Wed, 4 Sep 2024 13:32:30 -0400 Subject: [PATCH] Fix previous wins and ad render ID (#1258) * Fix previous wins and ad render ID * Apply suggestions from code review Co-authored-by: qingxinwu <6334674+qingxinwu@users.noreply.github.com> * Address comments * fix references * address comments * Update spec.bs Co-authored-by: qingxinwu <6334674+qingxinwu@users.noreply.github.com> --------- Co-authored-by: qingxinwu <6334674+qingxinwu@users.noreply.github.com> Co-authored-by: Paul Jensen --- spec.bs | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/spec.bs b/spec.bs index 165fc6fb4..f56a55397 100644 --- a/spec.bs +++ b/spec.bs @@ -198,6 +198,7 @@ dictionary AuctionAd { USVString buyerReportingId; USVString buyerAndSellerReportingId; sequence allowedReportingOrigins; + DOMString adRenderId; }; dictionary AuctionAdInterestGroupSize { @@ -409,6 +410,10 @@ This is detectable because it can change the set of fields that are read from th |igAd|'s [=interest group ad/metadata=] be the result of [=serializing a JavaScript value to a JSON string=], given |ad|["{{AuctionAd/metadata}}"]. This can [=exception/throw=] a {{TypeError}}. + 1. If |ad|["{{AuctionAd/adRenderId}}"] [=map/exists=]: + 1. If |ad|["{{AuctionAd/adRenderId}}"]'s [=string/length=] > 12, [=exception/throw=] a {{TypeError}}. + 1. If any [=code point=] in |ad|["{{AuctionAd/adRenderId}}"] is not an [=ASCII code point=], [=exception/throw=] a {{TypeError}}. + 1. Set |igAd|'s [=interest group ad/ad render id=] to |ad|["{{AuctionAd/adRenderId}}"]. 1. If |groupMember| is "{{GenerateBidInterestGroup/ads}}": 1. If |ad|["{{AuctionAd/buyerReportingId}}"] [=map/exists=], then set |igAd|'s [=interest group ad/buyer reporting ID=] to it. @@ -1480,13 +1485,14 @@ To validate and convert auction ad config given an {{AuctionAdConfig} [=interest group/name=] is |ig|'s [=interest group/name=], return if none found. 1. Let |win| be a new [=previous win=]. 1. Set |win|'s [=previous win/time=] to the [=current wall time=]. - 1. Let |ad| be an [=interest group ad=] whose [=interest group ad/render url=] is |bid|'s - [=generated bid/bid ad=]'s [=interest group ad/render url=], whose - [=interest group ad/metadata=] is |bid|'s [=generated bid/bid ad=]'s - [=interest group ad/metadata=], and whose [=interest group ad/ad render ID=] is - |bid|'s [=generated bid/bid ad=]'s [=interest group ad/ad render ID=]. - 1. Set |win|'s [=previous win/ad json=] to the result of - [=serializing an Infra value to a JSON string=] given |ad|. + 1. Let |ad| be a new [=interest group ad=] with the following [=struct/items=]: + : [=interest group ad/render url=] + :: |bid|'s [=generated bid/bid ad=]'s [=interest group ad/render url=] + : [=interest group ad/metadata=] + :: |bid|'s [=generated bid/bid ad=]'s [=interest group ad/metadata=] + : [=interest group ad/ad render ID=] + :: |bid|'s [=generated bid/bid ad=]'s [=interest group ad/ad render ID=] + 1. Set |win|'s [=previous win/ad=] to |ad|. 1. [=list/Append=] |win| to |loadedIg|'s [=interest group/previous wins=]. 1. [=list/Replace=] the [=interest group=] that has |loadedIg|'s [=interest group/owner=] and [=interest group/name=] in the [=user agent=]'s [=interest group set=] with |loadedIg|. @@ -1588,10 +1594,15 @@ failing to fetch the script or wasm, otherwise a [=tuple=] of ([=list=] of [=gen 1. Let |timeDelta| be |auctionStartTime| minus |prevWin|'s [=previous win/time=]. 1. Set |timeDelta| to 0 if |timeDelta| is negative, |timeDelta|'s nearest second (rounding down) otherwise. - 1. Let |prevWinIDL| be a new {{PreviousWin}}. - 1. [=map/Set=] |prevWinIDL|["{{PreviousWin/timeDelta}}"] to |timeDelta|. - 1. [=map/Set=] |prevWinIDL|["{{PreviousWin/adJSON}}"] to |prevWin|'s [=previous win/ad json=]. - 1. [=list/Append=] |prevWinIDL| to |prevWins|. + 1. Let |prevWinAdIDL| be a new {{AuctionAd}} with the following [=struct/items=]: + : {{AuctionAd/renderURL}} + :: the [=URL serializer|serialization=] of |prevWin|'s [=interest group ad/render url=] + : {{AuctionAd/metadata}} + :: |prevWin|'s [=interest group ad/metadata=] + : {{AuctionAd/adRenderId}} + :: |prevWin|'s [=interest group ad/ad render ID=] + 1. Let |prevWinElement| be the [=sequence=]<{{PreviousWinElement}}> «|timeDelta|, |prevWinAdIDL|». + 1. [=list/Append=] |prevWinElement| to |prevWins|. 1. [=map/Set=] |browserSignals|["{{BiddingBrowserSignals/prevWinsMs}}"] to |prevWins|. 1. Let |biddingScriptFetcher| be the result of [=creating a new script fetcher=] with |ig|'s [=interest group/bidding url=], and |settings|. @@ -3011,7 +3022,7 @@ The getInterestGroupAdAuctionData(|config|) meth : [=server auction previous win/time delta=] :: |timeDelta| : [=server auction previous win/ad render ID=] - :: the value of the "adRenderId" field in |prevWin|'s [=previous win/ad json=], or the empty string if not present + :: the value of the [=interest group ad/ad render ID=] field in |prevWin|'s [=previous win/ad=], or the empty string if not present 1. [=list/Append=] |serverPrevWin| to |prevWins|. 1. Let |browserSignals| be a new [=server auction browser signals=] with the following [=struct/items=]: : [=server auction browser signals/bid count=] @@ -5708,10 +5719,8 @@ To handle ad auction signals header value given a [=byte sequence=] | # Structures # {#structures} -dictionary PreviousWin { - required long long timeDelta; - required DOMString adJSON; -}; +typedef (long long or AuctionAd) PreviousWinElement; +typedef sequence<PreviousWinElement> PreviousWin; dictionary BiddingBrowserSignals { required DOMString topWindowHostname; @@ -6062,8 +6071,9 @@ frequency capping. It's a [=struct=] with the following [=struct/items=]: <dl dfn-for="previous win"> : <dfn>time</dfn> :: A [=moment=]. Approximate time the [=interest group=] won an auction. - : <dfn>ad json</dfn> - :: A [=string=]. A JSON serialized object corresponding to the ad that won the auction. + : <dfn>ad</dfn> + :: An [=interest group ad=]. The ad that won the auction. + [=struct/Items=] except [=interest group ad/render url=], [=interest group ad/metadata=] and [=interest group ad/ad render ID=] are excluded. </dl> A <dfn>seller capability</dfn> is a permission granted by an [=interest group=] to sellers. It's