From c277235aa0ed7bc21c57dce981d0ee7c0f4f1264 Mon Sep 17 00:00:00 2001 From: qingxinwu <6334674+qingxinwu@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:18:54 -0400 Subject: [PATCH] Some cleanups came up during another PR's review. (#789) Also wrapped some very long lines. Co-authored-by: Qingxin Wu --- spec.bs | 82 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/spec.bs b/spec.bs index 133099ecc..76e51e99d 100644 --- a/spec.bs +++ b/spec.bs @@ -898,7 +898,8 @@ To validate and convert auction ad config given an {{AuctionAdConfig} 1. If |config|["{{AuctionAdConfig/auctionSignals}}"] [=map/exists=]: 1. Set |auctionConfig|'s [=auction config/auction signals=] to |config|["{{AuctionAdConfig/auctionSignals}}"]. - 1. [=Handle an input promise in configuration=] given |auctionConfig| and |auctionConfig|'s [=auction config/auction signals=]: + 1. [=Handle an input promise in configuration=] given |auctionConfig| and |auctionConfig|'s + [=auction config/auction signals=]: * To parse the value |result|: 1. Let |auctionSignalsJSON| be the result of [=serializing a JavaScript value to a JSON string=], given |result|. @@ -910,14 +911,16 @@ To validate and convert auction ad config given an {{AuctionAdConfig} 1. If |config|["{{AuctionAdConfig/sellerSignals}}"] [=map/exists=]: 1. Set |auctionConfig|'s [=auction config/seller signals=] to |config|["{{AuctionAdConfig/sellerSignals}}"]. - 1. [=Handle an input promise in configuration=] given |auctionConfig| and |auctionConfig|'s [=auction config/seller signals=]: + 1. [=Handle an input promise in configuration=] given |auctionConfig| and |auctionConfig|'s + [=auction config/seller signals=]: * To parse the value |result|: 1. Set |auctionConfig|'s [=auction config/seller signals=] to the result of [=serializing a JavaScript value to a JSON string=], given |result|. * To handle an error, set |auctionConfig|'s [=auction config/seller signals=] to failure. 1. If |config|["{{AuctionAdConfig/directFromSellerSignals}}"] [=map/exists=]: 1. TODO: The receiving end of this isn't specified yet, so there is no place to put the computed value. - 1. [=Handle an input promise in configuration=] given |auctionConfig| and |config|["{{AuctionAdConfig/directFromSellerSignals}}"]: + 1. [=Handle an input promise in configuration=] given |auctionConfig| and + |config|["{{AuctionAdConfig/directFromSellerSignals}}"]: * To parse the value |result|: 1. Let |directFromSellerSignalsPrefix| be the result of running the [=URL parser=] on |result|. 1. [=exception/Throw=] a {{TypeError}} if any of the following conditions hold: @@ -1430,7 +1433,8 @@ To score and rank a bid given an [=auction config=] |auctionConfig|,
{{ScoringBrowserSignals/interestGroupOwner}}
[=serialization of an origin|Serialized=] |owner|
{{ScoringBrowserSignals/renderURL}} -
The result of running the [=URL serializer=] on |generatedBid|'s [=generated bid/ad descriptor=]'s [=ad descriptor/url=] +
The result of running the [=URL serializer=] on |generatedBid|'s + [=generated bid/ad descriptor=]'s [=ad descriptor/url=]
{{ScoringBrowserSignals/biddingDurationMsec}}
|generatedBid|'s [=generated bid/bid duration=]
{{ScoringBrowserSignals/bidCurrency}} @@ -1810,7 +1814,8 @@ To round a value given a {{double}} |value|: 1. If |value| is less than 0, return −∞. 1. Otherwise, return ∞. 1. Let |precisionScaledValue| be |normValue| multiplied by 256. - 1. Let |noisyScaledValue| be |precisionScaledValue| plus a random {{double}} value greater than or equal to 0 but less than 1. + 1. Let |noisyScaledValue| be |precisionScaledValue| plus a random {{double}} value greater than or + equal to 0 but less than 1. 1. Let |truncatedScaledValue| be the largest integer not greater than |noisyScaledValue|. 1. Return |truncatedScaledValue| multiplied by 2(|valueExp| − 8). @@ -1883,7 +1888,9 @@ null |winningComponentConfig|:
|leadingBidInfo|'s [=leading bid info/scoring data version=] if it is not null, {{undefined}} otherwise - 1. Let |igAd| be the [=interest group ad=] from |winner|'s [=generated bid/interest group=]'s [=interest group/ads=] whose [=interest group ad/render url=] is |winner|'s [=generated bid/ad descriptor=]'s [=ad descriptor/url=]. + 1. Let |igAd| be the [=interest group ad=] from |winner|'s [=generated bid/interest group=]'s + [=interest group/ads=] whose [=interest group ad/render url=] is |winner|'s + [=generated bid/ad descriptor=]'s [=ad descriptor/url=]. 1. If |igAd|'s [=interest group ad/buyer and seller reporting ID=] [=map/exists=] and the result of [=query reporting ID k-anonymity count=] given |winner|'s [=generated bid/interest group=] and |igAd| is true: @@ -1949,10 +1956,13 @@ and a {{ReportingBrowserSignals}} |browserSignals|: [=interest group ad/render url=] is |winner|'s [=generated bid/ad descriptor=]'s [=ad descriptor/url=]. 1. If |igAd|'s [=interest group ad/buyer and seller reporting ID=] - does not [=map/exist=] and the result of [=query reporting ID k-anonymity count=] given |winner|'s [=generated bid/interest group=] and |igAd| is true: + does not [=map/exist=] and the result of [=query reporting ID k-anonymity count=] given + |winner|'s [=generated bid/interest group=] and |igAd| is true: 1. If |igAd|'s [=interest group ad/buyer reporting ID=] [=map/exists=], - [=map/set=] |reportWinBrowserSignals|["{{ReportWinBrowserSignals/buyerReportingId}}"] to |igAd|'s [=interest group ad/buyer reporting ID=]. - 1. Otherwise, [=map/Set=] |reportWinBrowserSignals|["{{ReportWinBrowserSignals/interestGroupName}}"] to |winner|'s [=generated bid/interest group=] [=interest group/name=]. + [=map/set=] |reportWinBrowserSignals|["{{ReportWinBrowserSignals/buyerReportingId}}"] to + |igAd|'s [=interest group ad/buyer reporting ID=]. + 1. Otherwise, [=map/Set=] |reportWinBrowserSignals|["{{ReportWinBrowserSignals/interestGroupName}}"] + to |winner|'s [=generated bid/interest group=] [=interest group/name=]. 1. Let |buyerReportingScript| be the result of [=fetching script=] with |winner|'s [=generated bid/interest group=]'s [=interest group/bidding url=]. 1. Let « ignored, |resultUrl|, |reportingBeaconMap|, |reportingMacroMap| » be the result of @@ -2022,7 +2032,8 @@ threshold when responding to [=query k-anonymity count=].
- To compute the key hash of reporting ID given an [=interest group=] |ig| and an [=interest group ad=] |igAd|: + To compute the key hash of reporting ID given an [=interest group=] |ig| and an + [=interest group ad=] |igAd|: 1. Let |keyString| be the [=string/concatenation=] of the following strings separated with U+000A (LF): 1. "NameReport" @@ -2101,7 +2112,8 @@ threshold when responding to [=query k-anonymity count=].
To increment reporting ID k-anonymity count given an [=interest group=] |ig| and a [=URL=] |ad|: - 1. Let |igAd| be the [=interest group ad=] from |ig|'s [=interest group/ads=] whose [=interest group ad/render url=] is |ad|. + 1. Let |igAd| be the [=interest group ad=] from |ig|'s [=interest group/ads=] whose + [=interest group ad/render url=] is |ad|. 1. Let |keyHash| be the result of [=computing the key hash of reporting ID=] given |ig| and |igAd|. 1. [=Increment k-anonymity count=] given |keyHash|.
@@ -2260,7 +2272,8 @@ of the following global objects: 1. If no exception was [=exception/thrown=] in the previous step: 1. Set |generatedBid| to the result of [=converting GenerateBidOutput to generated bid=] with |generatedBidIDL|, |ig|, |expectedCurrency|, |isComponentAuction|, and |global|'s [=InterestGroupBiddingScriptRunnerGlobalScope/group has ad components=]. 1. Otherwise, set |generatedBid| to failure. - 1. If |generatedBid| is a [=generated bid=] and |generatedBid|'s [=generated bid/bid=]'s [=bid with currency/value=] ≤ 0, set |generatedBid| to failure. + 1. If |generatedBid| is a [=generated bid=] and |generatedBid|'s [=generated bid/bid=]'s + [=bid with currency/value=] ≤ 0, set |generatedBid| to failure. 1. If |generatedBid| is null, set it to failure. 1. If |generatedBid| is not failure: 1. Set |generatedBid|'s [=generated bid/bid duration=] to |duration|. @@ -2505,16 +2518,22 @@ To convert GenerateBidOutput to generated bid given a {{GenerateBidOu 1. Let |position| be a [=string/position variable=], initially pointing at the start of |input|. 1. [=Strip leading and trailing ASCII whitespace=] from |input|. 1. If |input| [=string/starts with=] "`0`" but [=string/is=] not "`0`" and does not - [=string/start with=] "`0.`", then return null as the dimension and the empty string as the dimension unit. - 1. [=Collect a sequence of code points=] that are [=ASCII digits=] or U+002E (.), given |position|. Let that be |dimensionString|. - 1. If |dimensionString| is the empty string, then return null as the dimension and the empty string as the dimension unit. - 1. Let |dimension| be the result of parsing |dimensionString| using the [=rules for parsing floating-point number values=]. + [=string/start with=] "`0.`", then return null as the dimension and the empty string as the + dimension unit. + 1. [=Collect a sequence of code points=] that are [=ASCII digits=] or U+002E (.), given |position|. + Let that be |dimensionString|. + 1. If |dimensionString| is the empty string, then return null as the dimension and the empty + string as the dimension unit. + 1. Let |dimension| be the result of parsing |dimensionString| using the + [=rules for parsing floating-point number values=]. 1. If |dimension| is an error, then return null as the dimension and the empty string as the dimension unit. - 1. [=Collect a sequence of code points=] that are [=ASCII lower alpha=], given |position|. Let that be |dimensionUnit|. - 1. If |position| is not past the end of |input|, then return null as the dimension and the empty string as the dimension unit. + 1. [=Collect a sequence of code points=] that are [=ASCII lower alpha=], given |position|. Let + that be |dimensionUnit|. + 1. If |position| is not past the end of |input|, then return null as the dimension and the empty + string as the dimension unit. 1. If |dimensionUnit| [=string/is=] the empty string, then set |dimensionUnit| to "px". - 1. If |dimensionUnit| [=string/is=] not "px", "sh", or "sw", then return null as the dimension and the empty string as the - dimension unit. + 1. If |dimensionUnit| [=string/is=] not "px", "sh", or "sw", then return null as the dimension and + the empty string as the dimension unit. 1. Return |dimension| as the dimension and |dimensionUnit| as the dimension unit.
@@ -2905,7 +2924,6 @@ Issue(WICG/turtledove#522): Move from "`*`" to "`self`". # Structures # {#structures} - dictionary PreviousWin { required long long timeDelta; required DOMString adJSON; @@ -2941,7 +2959,6 @@ Note: {{ScoringBrowserSignals}}'s {{ScoringBrowserSignals/adComponents}} is {{un an [=list/is empty|empty list=]. <xmp class="idl"> - dictionary ReportingBrowserSignals { required DOMString topWindowHostname; required USVString interestGroupOwner; @@ -2987,7 +3004,6 @@ dictionary ReportingBrowserSignals { </dl> <xmp class="idl"> - dictionary ReportResultBrowserSignals : ReportingBrowserSignals { required double desirability; @@ -3012,7 +3028,6 @@ dictionary ReportResultBrowserSignals : ReportingBrowserSignals { </dl> <xmp class="idl"> - dictionary ReportWinBrowserSignals : ReportingBrowserSignals { double adCost; USVString seller; @@ -3033,7 +3048,10 @@ dictionary ReportWinBrowserSignals : ReportingBrowserSignals { <dd>True if the interest group owner was the only bidder that made bids with the second highest score <dt>{{ReportWinBrowserSignals/buyerReportingId}} - <dd>Set if the winning ad had a [=interest group ad/buyer reporting ID=] but not a [=interest group ad/buyer and seller reporting ID=] set in its listing in the interest group, and that value was [=query reporting ID k-anonymity count|jointly k-anonymous=] combined with interest group owner, bidding script URL, and ad creative URL. + <dd>Set if the winning ad had a [=interest group ad/buyer reporting ID=] but not a + [=interest group ad/buyer and seller reporting ID=] set in its listing in the interest group, + and that value was [=query reporting ID k-anonymity count|jointly k-anonymous=] combined with + interest group owner, bidding script URL, and ad creative URL. <dt>{{ReportWinBrowserSignals/interestGroupName}} <dd>Only set if the tuple of interest group owner, name, bidding script URL and ad creative URL @@ -3224,22 +3242,22 @@ An auction config is a [=struct=] with the following items: Owners of interest groups allowed to participate in the auction. Each [=origin's=] [=origin/scheme=] must be "<code>https</code>". : <dfn>auction signals</dfn> -:: Null or a [=string=] or a {{Promise}} or failure. +:: Null, a [=string=], a {{Promise}}, or failure. Opaque JSON data passed to both sellers' and buyers' [=script runners=]. : <dfn>seller signals</dfn> -:: Null or a [=string=] or a {{Promise}} or failure. +:: Null, a [=string=], a {{Promise}}, or failure. Opaque JSON data passed to the seller's [=script runner=]. : <dfn>seller timeout</dfn> :: A [=duration=] in milliseconds, initially 50 milliseconds. Restricts the runtime of the seller's `scoreAd()` script. If scoring does not complete before the timeout, the bid being scored is not considered further. : <dfn>per buyer signals</dfn> -:: Null or a {{Promise}} or failure or an [=ordered map=] whose [=map/keys=] are [=origins=] and +:: Null, a {{Promise}}, failure, or an [=ordered map=] whose [=map/keys=] are [=origins=] and whose [=map/values=] are [=strings=]. [=map/Keys=] are buyers and must be valid HTTPS origins. [=map/Values=] are opaque JSON data passed to corresponding buyer's [=script runner=]. : <dfn>per buyer timeouts</dfn> -:: Null or a {{Promise}} or failure or an [=ordered map=] whose [=map/keys=] are [=origins=] and +:: Null, a {{Promise}}, failure, or an [=ordered map=] whose [=map/keys=] are [=origins=] and whose [=map/values=] are [=durations=] in milliseconds. [=map/Keys=] are buyers and must be valid HTTPS origins. [=map/Values=] restrict the runtime of corresponding buyer's `generateBid()` script. If the timeout expires, only the bid submitted @@ -3331,7 +3349,8 @@ To <dfn>wait until configuration input promises resolve</dfn> given an [=auction <div algorithm> To <dfn>recursively wait until configuration input promises resolve</dfn> given an [=auction config=] |auctionConfig|: 1. [=list/For each=] |componentAuctionConfig| in |auctionConfig|'s [=auction config/component auctions=]: - 1. If the result of [=waiting until configuration input promises resolve=] given |componentAuctionConfig| is failure, return failure. + 1. If the result of [=waiting until configuration input promises resolve=] given + |componentAuctionConfig| is failure, return failure. 1. Return the result of [=waiting until configuration input promises resolve=] given |auctionConfig|. </div> @@ -3340,7 +3359,8 @@ To <dfn>recursively wait until configuration input promises resolve</dfn> given To <dfn>handle an input promise in configuration</dfn> given an [=auction config=] |auctionConfig|, a {{Promise}} |p|, and two sequences of steps, covering the parsing of the value and error-handling: 1. Increment |auctionConfig|'s [=auction config/pending promise count=]. -1. Let |resolvedAndTypeChecked| be the promise representing performing the following steps [=upon fulfillment=] of |p| with |result|: +1. Let |resolvedAndTypeChecked| be the promise representing performing the following steps + [=upon fulfillment=] of |p| with |result|: 1. Execute the steps to be run for parsing of the value given |result|. 1. If no exception was [=exception/thrown=] in the previous step: 1. Decrement |auctionConfig|'s [=auction config/pending promise count=].