Making extra FLEDGE worklet functions only available in worklet functions

752 views
Skip to first unread message

Russ Hamilton

unread,
Mar 23, 2023, 12:03:01 PM3/23/23
to fledge-ap...@chromium.org

Previously, we made certain FLEDGE-specific functions available to the top-level script context of worklets. In the future, these functions will only be available within the worklet functions (i.e. inside of generateBid(), scoreAd(), reportWin(), or reportResult() or functions called from these). This will affect the following global objects and functions:

  • forDebuggingOnly object and functions:

    • forDebuggingOnly.reportAdAuctionLoss()

    • forDebuggingOnly.reportAdAuctionWin()

  • privateAggregation object and functions:

    • privateAggregation.sendHistogramReport()

    • privateAggregation.reportContributionForEvent()

    • privateAggregation.enableDebugMode()

  • registerAdBeacon()

  • sendReportTo()

  • setBid()

  • setPriority()

  • setPrioritySignalsOverride()

  • sharedStorage object and functions:

    • sharedStorage.set()

    • sharedStorage.append()

    • sharedStorage.delete()

    • sharedStorage.clear()

We are making these changes to make scripts behave more consistently as we work to optimize the JavaScript environment. In the cases where we only execute the top-level script once across multiple worklet runs (such with the groupByOrigin execution mode or for re-running the auction when the winner fails the k-anonymity check), the effects of a top-level call to these functions on subsequent worklets was undefined and inconsistent – setBid() at the top level only affected the first bidder to run. These functions only make sense within the context of a specific bidder or seller, so we are clarifying the interface by only defining the functions immediately before executing the generateBid(), scoreAd(), reportWin(), and reportResult() functions.

For example, consider the bidding script below:

// Initialize some stuff


setBid(foo); // This will now fail

function generateBid(...) {

  setBid(foo); // This will still work

}


let oldSendReportTo = sendReportTo; // This will now fail

function reportWin(...) {

  let oldSendReportTo = sendReportTo; // This will still work

}

Reply all
Reply to author
Forward
0 new messages