From 1a6daf49fd6bda926316b6920577b42ec62b7352 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 18 Jul 2023 09:36:57 -0400 Subject: [PATCH] Revert "Fix a number of imprecisions in GenerateBidOutput handling: (#664)" This reverts commit 66cc6c278ed3ee179a79f7a068b11a8d793bda7f. --- spec.bs | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/spec.bs b/spec.bs index db7ee718e..8d29de814 100644 --- a/spec.bs +++ b/spec.bs @@ -2147,9 +2147,11 @@ of the following global objects: 1. Let |generatedBidIDL| be the result of [=converted to an IDL value|converting=] |result|'s \[[Value]] to a {{GenerateBidOutput}}. 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. Let |groupHasAdComponents| be true. + 1. If |ig|'s [=interest group/ad components=] is null, set |groupHasAdComponents| be false. + 1. Let |possibleGeneratedBid| be the result of [=converting GenerateBidOutput to generated bid=] + with |generatedBidIDL|, |ig|, |expectedCurrency|, |isComponentAuction|, and |groupHasAdComponents|. + 1. If |possibleGeneratedBid| is not failure, set |generatedBid| to it. 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|. @@ -2268,25 +2270,26 @@ interface InterestGroupScriptRunnerGlobalScope { InterestGroupBiddingScriptRunnerGlobalScope)] interface InterestGroupBiddingScriptRunnerGlobalScope : InterestGroupScriptRunnerGlobalScope { - boolean setBid(optional GenerateBidOutput generateBidOutput = {}); + boolean setBid(); + boolean setBid(GenerateBidOutput generateBidOutput); undefined setPriority(double priority); undefined setPrioritySignalsOverride(DOMString key, double priority); }; dictionary AdRender { required DOMString url; - DOMString width; - DOMString height; + required DOMString width; + required DOMString height; }; dictionary GenerateBidOutput { - double bid = -1; + required double bid; DOMString bidCurrency; - (DOMString or AdRender) render; + required (DOMString or AdRender) render; any ad; sequence<(DOMString or AdRender)> adComponents; double adCost; - unrestricted double modelingSignals; + double modelingSignals; boolean allowComponentAuction = false; }; @@ -2311,20 +2314,24 @@ Each {{InterestGroupBiddingScriptRunnerGlobalScope}} has a +
+ The setBid() method steps are: + + 1. Set [=this=]'s [=relevant global object=]'s [=InterestGroupBiddingScriptRunnerGlobalScope/bid=] + to null. + 1. Return true. +
To convert GenerateBidOutput to generated bid given a {{GenerateBidOutput}} |generateBidOutput|, an [=interest group=] |ig|, a [=currency tag=] |expectedCurrency|, a [=boolean=] |isComponentAuction| and a [=boolean=] |groupHasAdComponents|: - 1. Let |bid| be a new [=generated bid=]. - 1. If |generateBidOutput|["{{GenerateBidOutput/bid}}"] ≤ 0: - 1. Set |bid|'s [=generated bid/bid=] to a [=bid with currency=] with [=bid with currency/value=] |generateBidOutput|["{{GenerateBidOutput/bid}}"] and [=bid with currency/currency=] null. - 1. Return |bid|. - 1. If |generateBidOutput|["{{GenerateBidOutput/render}}"] does not [=map/exist=], return failure. + 1. If |generateBidOutput|["{{GenerateBidOutput/bid}}"] is less than or equal to 0, return failure. 1. If |isComponentAuction| is true, and |generateBidOutput|["{{GenerateBidOutput/allowComponentAuction}}"] is false: 1. Return failure. + 1. Let |bid| be a new [=generated bid=]. 1. Let |bidCurrency| be null. 1. If |generateBidOutput|["{{GenerateBidOutput/bidCurrency}}"] is specified: 1. If the result of [=checking whether a string is a valid currency tag=] on @@ -2376,8 +2383,8 @@ To convert GenerateBidOutput to generated bid given a {{GenerateBidOu |generateBidOutput|["{{GenerateBidOutput/adCost}}"]. 1. If |generateBidOutput|["{{GenerateBidOutput/modelingSignals}}"] [=map/exists=]: 1. Let |modelingSignals| be |generateBidOutput|["{{GenerateBidOutput/modelingSignals}}"]. - 1. If |modelingSignals| ≥ 0 and |modelingSignals| < 4096: - 1. Set |bid|'s [=generated bid/modeling signals=] to the result of [=converted to an IDL value|converting=] the ECMAScript value represented by |modelingSignals| to an {{unsigned short}}. + 1. If |modelingSignals| is greater than or equal to 0 and less than 4096: + 1. Set |bid|'s [=generated bid/modeling signals=] to |modelingSignals|. 1. Return |bid|.
@@ -2405,6 +2412,7 @@ To convert GenerateBidOutput to generated bid given a {{GenerateBidOu To convert an ad render given an {{AdRender}} |adRender|, an [=interest group=] |ig|, and a [=boolean=] |isComponent|: + 1. If |adRender|["{{AdRender/url}}"] does not [=map/exist=], return false. 1. Let |adUrl| be the result of running the [=URL parser=] on |adRender|["{{AdRender/url}}"]. 1. If |adUrl| is failure, return failure. 1. If [=validating an ad url=] given |adUrl|, |ig|, and |isComponent| returns false, return failure. @@ -2454,9 +2462,10 @@ To convert GenerateBidOutput to generated bid given a {{GenerateBidOu [=InterestGroupBiddingScriptRunnerGlobalScope/is component auction=], and [=this=]'s [=relevant global object=]'s [=InterestGroupBiddingScriptRunnerGlobalScope/group has ad components=]. - 1. If |bidToSet| is failure, [=exception/throw=] a {{TypeError}}. + 1. If |bidToSet| is failure, return false. 1. Set [=this=]'s [=relevant global object=]'s [=InterestGroupBiddingScriptRunnerGlobalScope/bid=] to |bidToSet|. + 1. Return true.