tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit c80d8f741871a23c36b62d86d604669abdc7cc0e
parent 891d40df1dd1bf25ce8524395b35b2fb11e80a1f
Author: Nathan Barrett <nbarrett@mozilla.com>
Date:   Thu, 20 Nov 2025 23:16:58 +0000

Bug 2001400 - Add pref for dap.hpke and pass as options in attribution conversion r=home-newtab-reviewers,mconley

Differential Revision: https://phabricator.services.mozilla.com/D273483

Diffstat:
Mbrowser/app/profile/firefox.js | 6++++++
Mbrowser/extensions/newtab/lib/NewTabAttributionService.sys.mjs | 24++++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js @@ -676,6 +676,12 @@ pref("browser.urlbar.merino.ohttpConfigURL", ""); // OHTTP relay URL for Merino requests pref("browser.urlbar.merino.ohttpRelayURL", ""); +// OHTTP hpke for DAP +pref("dap.ohttp.hpke", "https://dap-09-3.api.divviup.org/ohttp-configs"); + +// OHTTP relay URL for DAP +pref("dap.ohttp.relayURL", "https://mozilla-ohttp-dap.mozilla.fastly-edge.com/"); + // Enable site specific search result. pref("browser.urlbar.contextualSearch.enabled", true); diff --git a/browser/extensions/newtab/lib/NewTabAttributionService.sys.mjs b/browser/extensions/newtab/lib/NewTabAttributionService.sys.mjs @@ -15,6 +15,9 @@ const MAX_LOOKBACK_DAYS = 30; const DAY_IN_MILLI = 1000 * 60 * 60 * 24; const CONVERSION_RESET_MILLI = 7 * DAY_IN_MILLI; +const DAP_HPKE_PREF = "dap.ohttp.hpke"; +const DAP_RELAY_PREF = "dap.ohttp.relayURL"; + /** * */ @@ -175,7 +178,14 @@ class NewTabAttributionService { if (lookbackDays > MAX_LOOKBACK_DAYS) { return; } - + const dapHpke = Services.prefs.getCharPref( + DAP_HPKE_PREF, + "https://dap-09-3.api.divviup.org/ohttp-configs" + ); + const ohttpRelayURL = Services.prefs.getCharPref( + DAP_RELAY_PREF, + "https://mozilla-ohttp-dap.mozilla.fastly-edge.com/" + ); const now = this.#now(); const budget = await this.#getBudget(partnerId, now); @@ -205,10 +215,20 @@ class NewTabAttributionService { } await this.#updateBudget(budget, budgetSpend, partnerId); + + const options = {}; + if (dapHpke) { + options.ohttp_hpke = dapHpke; + } + + if (ohttpRelayURL) { + options.ohttp_relay = ohttpRelayURL; + } + await this.#dapSender.sendDAPMeasurement( conversion.task, measurement, - {} + options ); } catch (e) { console.error(e);