Skip to content

Commit

Permalink
Fix previous wins and ad render ID (WICG#1258)
Browse files Browse the repository at this point in the history
* Fix previous wins and ad render ID

* Apply suggestions from code review

Co-authored-by: qingxinwu <[email protected]>

* Address comments

* fix references

* address comments

* Update spec.bs

Co-authored-by: qingxinwu <[email protected]>

---------

Co-authored-by: qingxinwu <[email protected]>
Co-authored-by: Paul Jensen <[email protected]>
  • Loading branch information
3 people authored Sep 4, 2024
1 parent f2f8805 commit d9ad4d1
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ dictionary AuctionAd {
USVString buyerReportingId;
USVString buyerAndSellerReportingId;
sequence<USVString> allowedReportingOrigins;
DOMString adRenderId;
};

dictionary AuctionAdInterestGroupSize {
Expand Down Expand Up @@ -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=] &gt; 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.
Expand Down Expand Up @@ -1480,13 +1485,14 @@ To <dfn>validate and convert auction ad config</dfn> 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|.
Expand Down Expand Up @@ -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 <code>[=sequence=]<{{PreviousWinElement}}></code> «|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|.
Expand Down Expand Up @@ -3011,7 +3022,7 @@ The <dfn for=Navigator method>getInterestGroupAdAuctionData(|config|)</dfn> 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=]
Expand Down Expand Up @@ -5708,10 +5719,8 @@ To <dfn>handle ad auction signals header value</dfn> given a [=byte sequence=] |
# Structures # {#structures}

<xmp class="idl">
dictionary PreviousWin {
required long long timeDelta;
required DOMString adJSON;
};
typedef (long long or AuctionAd) PreviousWinElement;
typedef sequence<PreviousWinElement> PreviousWin;

dictionary BiddingBrowserSignals {
required DOMString topWindowHostname;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d9ad4d1

Please sign in to comment.