diff --git a/spec.bs b/spec.bs index ead461aa4..1693baa17 100644 --- a/spec.bs +++ b/spec.bs @@ -29,6 +29,9 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/C text: create an agent; url: create-an-agent text: immediately; url: immediately text: valid floating-point number; url: valid-floating-point-number +spec: infra; urlPrefix: https://infra.spec.whatwg.org/ + type: dfn + text: convert an Infra value to a JSON-compatible JavaScript value; url: #convert-an-infra-value-to-a-json-compatible-javascript-value spec: RFC8941; urlPrefix: https://httpwg.org/specs/rfc8941.html type: dfn text: structured header; url: top @@ -1337,41 +1340,40 @@ To score and rank a bid given an [=auction config=] |auctionConfig|, "single-level-auction", "top-level-auction", or "component-auction", a [=currency tag=] |componentAuctionExpectedCurrency|, and an [=origin=] |topWindowOrigin|: -1. Let |renderURLs| be a new [=set=]. -1. Let |adComponentRenderUrls| be a new [=set=]. -1. [=set/Append=] |generatedBid|'s [=generated bid/ad descriptor=]'s [=ad descriptor/url=] to |renderURLs|. +1. Let |renderURL| be [=URL serializer|serialized=] |generatedBid|'s + [=generated bid/ad descriptor=]'s [=ad descriptor/url=]. +1. Let |adComponentRenderURLs| be a new empty [=list=]. 1. If |generatedBid|'s [=generated bid/ad component descriptors=] is not null: - 1. [=set/For each=] |adComponentDescriptor| in |generatedBid|'s + 1. [=list/For each=] |adComponentDescriptor| in |generatedBid|'s [=generated bid/ad component descriptors=]: - 1. [=set/Append=] |adComponentDescriptor|'s [=ad descriptor/url=] to |adComponentRenderUrls|. + 1. [=list/Append=] [=URL serializer|serialized=] |adComponentDescriptor|'s [=ad descriptor/url=] + to |adComponentRenderURLs|. 1. Let |fullSignalsUrl| be the result of [=building trusted scoring signals url=] with |auctionConfig|'s - [=auction config/trusted scoring signals url=], |renderURLs|, |adComponentRenderUrls|, + [=auction config/trusted scoring signals url=], «|renderURL|», |adComponentRenderURLs|, |auctionConfig|'s [=auction config/seller experiment group id=], and |topWindowOrigin|. Implementations may batch requests by collecting render URLs and ad component render URLs from multiple invocations of [=score and rank a bid=] and passing them all to a single invocation - of [=building trusted scoring signals url=] -- the network response has to be parsed to pull out the pieces - relevant to each [=evaluating a scoring script|evaluation of a scoring script=]. + of [=building trusted scoring signals url=] -- the network response has to be parsed to pull out + the pieces relevant to each [=evaluating a scoring script|evaluation of a scoring script=]. 1. Let |trustedScoringSignals| be null. -1. Let «|allTrustedScoringSignals|, |scoringDataVersion|» be the result of [=fetching trusted signals=] with - |fullSignalsUrl| and false. +1. Let «|allTrustedScoringSignals|, |scoringDataVersion|» be the result of [=fetching trusted signals=] + with |fullSignalsUrl| and false. 1. If |allTrustedScoringSignals| is an [=ordered map=]: - 1. Let |trustedScoringSignals| be a new [=map=]. - 1. [=Assert=]: |renderURLs|'s [=set/size=] is 1. - 1. [=set/For each=] |renderURL| in |renderURLs|: - 1. If |allTrustedScoringSignals|["`renderURLs`"] [=map/exists=] and - |allTrustedScoringSignals|["`renderURLs`"][|renderURL|] [=map/exists=]: - 1. Let |renderURLValue| be a new [=map=]. - 1. [=map/Set=] |renderURLValue|[|renderURL|] to |allTrustedScoringSignals|["`renderURLs`"][|renderURL|]. - 1. [=map/Set=] |trustedScoringSignals|["`renderURL`"] to |renderURLValue|. - 1. Let |adComponentRenderUrlsValue| be a new [=map=]. - 1. [=set/For each=] |adComponentRenderUrl| in |adComponentRenderUrls|: - 1. If |allTrustedScoringSignals|["`adComponentRenderUrls`"] [=map/exists=] and - |allTrustedScoringSignals|["`adComponentRenderUrls`"][|adComponentRenderUrl|] [=map/exists=]: - 1. [=map/Set=] |adComponentRenderUrlsValue|[|adComponentRenderUrl|] to - |allTrustedScoringSignals|["`adComponentRenderUrls`"][|adComponentRenderUrl|]. - 1. If |adComponentRenderUrlsValue| is not [=map/is empty|empty=]: - 1. [=map/Set=] |trustedScoringSignals|["`adComponentRenderUrls`"] to |adComponentRenderUrlsValue|. + 1. Set |trustedScoringSignals| to a new empty [=map=]. + 1. [=map/Set=] |trustedScoringSignals|["`renderURL`"] to a new empty [=map=]. + 1. If |allTrustedScoringSignals|["`renderURLs`"] [=map/exists=] and + |allTrustedScoringSignals|["`renderURLs`"][|renderURL|] [=map/exists=]: + 1. [=map/Set=] |trustedScoringSignals|["`renderURL`"][|renderURL|] to + |allTrustedScoringSignals|["`renderURLs`"][|renderURL|]. + 1. If |adComponentRenderURLs| is not [=list/empty=]: + 1. Let |adComponentRenderURLsValue| be a new empty [=map=]. + 1. If |allTrustedScoringSignals|["`adComponentRenderURLs`"] [=map/exists=], [=set/for each=] + |adComponentRenderURL| in |adComponentRenderURLs|: + 1. If |allTrustedScoringSignals|["`adComponentRenderURLs`"][|adComponentRenderURL|] [=map/exists=]: + 1. [=map/Set=] |adComponentRenderURLsValue|[|adComponentRenderURL|] to + |allTrustedScoringSignals|["`adComponentRenderURLs`"][|adComponentRenderURL|]. + 1. [=map/Set=] |trustedScoringSignals|["`adComponentRenderURLs`"] to |adComponentRenderURLsValue|. 1. Let |adMetadata| be |generatedBid|'s [=generated bid/ad=]. 1. Let |bidValue| be |generatedBid|'s [=generated bid/bid=]. 1. If |generatedBid|'s [=generated bid/modified bid=] is not null: @@ -1628,6 +1630,9 @@ To fetch trusted signals given a [=URL=] |url|, and a [=boolean=] |is 1. Wait for |signals| to be set. 1. If |signals| is a parsing exception, or if |signals| is not an [=ordered map=], return « null, null ». + 1. [=map/For each=] |key| → |value| of |signals|: + 1. [=map/Set=] |signals|[|key|] to the result of [=serializing an Infra value to a JSON string=] + given |value|. 1. If |formatVersion| is 2: 1. If |signals|["`keys`"] does not [=map/exist=], return « null, null ». 1. Set |signals| to |signals|["`keys`"]. @@ -1676,29 +1681,24 @@ To build trusted bidding signals url given a [=URL=] |signalsUrl|, an
-To build trusted scoring signals url given a [=URL=] |signalsUrl|, an [=ordered set=] of -[=URLs=] |renderURLs|, an [=ordered set=] of [=URLs=] |adComponentRenderUrls|, an {{unsigned short}} -|experimentGroupId|, and an [=origin=] |topWindowOrigin|: +To build trusted scoring signals url given a [=URL=] |signalsUrl|, a [=list=] of +[=strings=] |renderURLs|, an [=ordered set=] of [=strings=] |adComponentRenderURLs|, an +{{unsigned short}} |experimentGroupId|, and an [=origin=] |topWindowOrigin|: + +Note: When trusted scoring signals fetches are not batched, |renderURLs|'s [=list/size=] is 1. + 1. Let |queryParamsList| be a new empty [=list=]. 1. [=list/Append=] "hostname=" to |queryParamsList|. 1. [=list/Append=] the result of [=string/UTF-8 percent-encoding=] |topWindowOrigin| using [=component percent-encode set=] to |queryParamsList|. 1. If |renderURLs| is not [=set/is empty|empty=]: 1. [=list/Append=] "&renderURLs=" to |queryParamsList|. - 1. Let |renderURLsStrings| be a new empty [=list=]. - 1. [=list/For each=] |renderURL| of |renderURLs|: - 1. [=list/Append=] the result of [=URL serializer|serialization=] of |renderURL| to - |renderURLsStrings|. 1. [=list/Extend=] |queryParamsList| with the result of [=encode trusted signals keys=] with - |renderURLsStrings|. -1. If |adComponentRenderUrls| is not [=set/is empty|empty=]: - 1. [=list/Append=] "&adComponentRenderUrls=" to |queryParamsList|. - 1. Let |adComponentRenderUrlsStrings| be a new empty [=list=]. - 1. [=list/For each=] |adComponentRenderUrl| of |adComponentRenderUrls|: - 1. [=list/Append=] the result of [=URL serializer|serialization=] of |adComponentRenderUrl| to - |adComponentRenderUrlsStrings|. + |renderURLs|. +1. If |adComponentRenderURLs| is not [=set/is empty|empty=]: + 1. [=list/Append=] "&adComponentRenderURLs=" to |queryParamsList|. 1. [=list/Extend=] |queryParamsList| with the result of [=encode trusted signals keys=] with - |adComponentRenderUrlsStrings|. + |adComponentRenderURLs|. 1. If |experimentGroupId| is not null: 1. [=list/Append=] "&experimentGroupId=" to |queryParamsList|. 1. [=list/Append=] [=serialize an integer|serialized=] |experimentGroupId| to |queryParamsList|. @@ -2150,10 +2150,11 @@ of the following global objects: |auctionSignals| if |auctionSignals| is not null, otherwise {{undefined}}. 1. Let |perBuyerSignalsJS| be the result of [=parsing a JSON string to a JavaScript value=] given |perBuyerSignals| if |perBuyerSignals| is not null, otherwise {{undefined}}. + 1. Let |trustedBiddingSignalsJS| be |trustedBiddingSignals| [=converted to ECMAScript values=]. 1. Let |browserSignalsJS| be |browserSignals| [=converted to ECMAScript values=]. 1. Let |startTime| be the [=current wall time=]. 1. Let |result| be the result of [=evaluating a script=] with |realm|, |script|, "`generateBid`", - « |igJS|, |auctionSignalsJS|, |perBuyerSignalsJS|, |trustedBiddingSignals|, |browserSignalsJS| », + « |igJS|, |auctionSignalsJS|, |perBuyerSignalsJS|, |trustedBiddingSignalsJS|, |browserSignalsJS| », and |timeout|. 1. Let |duration| be the [=current wall time=] minus |startTime| in milliseconds. 1. If |global|'s [=InterestGroupBiddingScriptRunnerGlobalScope/priority=] is not null: @@ -2193,9 +2194,10 @@ of the following global objects: 1. Let |realm| be the result of [=creating a new script runner realm=] given {{InterestGroupScoringScriptRunnerGlobalScope}}. 1. Let |browserSignalsJS| be |browserSignals| [=converted to ECMAScript values=]. - 1. TODO: convert |trustedScoringSignals| to a JS value. + 1. Let |auctionConfigJS| be |auctionConfigIDL| [=converted to ECMAScript values=]. + 1. Let |trustedScoringSignalsJS| be |trustedScoringSignals| [=converted to ECMAScript values=]. 1. Return the result of [=evaluating a script=] with |realm|, |script|, "`scoreAd`", - «|adMetadata|, |bidValue|, |auctionConfigIDL|, |trustedScoringSignals|, |browserSignalsJS|», + «|adMetadata|, |bidValue|, |auctionConfigJS|, |trustedScoringSignalsJS|, |browserSignalsJS|», and |timeout|.