demo · v134

Budget tuning — request more, request less

The chromestatus rationale called out two pain points. Some Shared Storage callers want more than 20 contributions per report (large histograms shouldn’t need to issue a second worklet call). Others want fewer — but the report still pads to 20 slots for privacy. With per-context limits the caller picks. Dial the cap and the contribution count below and watch the assembled report.

probing Private Aggregation per-context cap…
Private Aggregation lives inside Shared Storage worklets. The table shows the request plan; the button below attempts the real sharedStorage.worklet.addModule() and sharedStorage.run() path where the browser exposes it.

Configure a report

20
14
waiting for worklet run…
slotbucketvaluenote

The code

// inside Shared Storage operation
privateAggregation.enableDebugMode();
privateAggregation.contributeToHistogram({ bucket: 1n, value: 10n });
privateAggregation.contributeToHistogram({ bucket: 2n, value: 25n });
// ...

// register() now accepts a maxContributions option for the operation
sharedStorage.run('my-op', { keepAlive: false, data: {} });

// declared in addModule:
register('my-op', class {
  async run(data) { /* ... */ }
  static get options() { return { maxContributions: 5 }; }  // NEW
});

see also