tor-browser

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

commit 81baf8470463b4101ccb004c18a942f86c6ab722
parent ede104feef5622371ff797a22dc2bb465627b808
Author: Benjamin VanderSloot <bvandersloot@mozilla.com>
Date:   Wed, 29 Oct 2025 14:28:09 +0000

Bug 1994604 - Remove set cookie partitioning telemtry - r=timhuang,cookie-reviewers

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

Diffstat:
Mnetwerk/cookie/CookieParser.cpp | 21---------------------
Mnetwerk/cookie/test/browser/browser.toml | 3---
Dnetwerk/cookie/test/browser/browser_partitioned_telemetry.js | 134-------------------------------------------------------------------------------
Mnetwerk/metrics.yaml | 69---------------------------------------------------------------------
4 files changed, 0 insertions(+), 227 deletions(-)

diff --git a/netwerk/cookie/CookieParser.cpp b/netwerk/cookie/CookieParser.cpp @@ -634,21 +634,6 @@ void CookieParser::FixDomain(CookieStruct& aCookieData, nsIURI* aHostURI, */ } -static void RecordPartitionedTelemetry(const CookieStruct& aCookieData, - bool aIsForeign) { - mozilla::glean::networking::set_cookie.Add(1); - if (aCookieData.isPartitioned()) { - mozilla::glean::networking::set_cookie_partitioned.AddToNumerator(1); - } - if (aIsForeign) { - mozilla::glean::networking::set_cookie_foreign.AddToNumerator(1); - } - if (aIsForeign && aCookieData.isPartitioned()) { - mozilla::glean::networking::set_cookie_foreign_partitioned.AddToNumerator( - 1); - } -} - // Main entry point for cookie parsing. Parses a single cookie string // (from either document.cookie or a Set-Cookie header) and populates // the internal CookieStruct data. @@ -732,12 +717,6 @@ void CookieParser::Parse(const nsACString& aBaseDomain, bool aRequireHostMatch, if (mValidation->Result() != nsICookieValidation::eOK) { return; } - - // We count SetCookie operations in the parent process only for HTTP set - // cookies to prevent double counting. - if (XRE_IsParentProcess() || !aFromHttp) { - RecordPartitionedTelemetry(mCookieData, aIsForeignAndNotAddon); - } } void CookieParser::RejectCookie(Rejection aRejection) { diff --git a/netwerk/cookie/test/browser/browser.toml b/netwerk/cookie/test/browser/browser.toml @@ -46,9 +46,6 @@ support-files = ["oversize.sjs"] ["browser_partitionedConsole.js"] support-files = ["partitioned.sjs"] -["browser_partitioned_telemetry.js"] -support-files = ["partitioned.sjs"] - ["browser_sameSiteConsole.js"] support-files = ["sameSite.sjs"] diff --git a/netwerk/cookie/test/browser/browser_partitioned_telemetry.js b/netwerk/cookie/test/browser/browser_partitioned_telemetry.js @@ -1,134 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ -"use strict"; - -const TEST_URL = - "https://example.com/browser/netwerk/cookie/test/browser/file_empty.html"; - -async function validateTelemetryValues( - { setCookies, setForeigns, setPartitioneds, setForeignPartitioneds }, - message -) { - await Services.fog.testFlushAllChildren(); - let setCookieTelemetry = Glean.networking.setCookie.testGetValue(); - is( - setCookieTelemetry ?? undefined, - setCookies, - message + " - all set cookies" - ); - let foreignTelemetry = Glean.networking.setCookieForeign.testGetValue(); - is( - foreignTelemetry?.numerator, - setForeigns, - message + " - foreign set cookies" - ); - is( - foreignTelemetry?.denominator, - setCookies, - message + " - foreign set cookies denominator" - ); - let partitonedTelemetry = - Glean.networking.setCookiePartitioned.testGetValue(); - is( - partitonedTelemetry?.numerator, - setPartitioneds, - message + " - partitioned set cookies" - ); - is( - partitonedTelemetry?.denominator, - setCookies, - message + " - partitioned set cookies denominator" - ); - let foreignPartitonedTelemetry = - Glean.networking.setCookieForeignPartitioned.testGetValue(); - is( - foreignPartitonedTelemetry?.numerator, - setForeignPartitioneds, - message + " - foreign partitioned set cookies" - ); - is( - foreignPartitonedTelemetry?.denominator, - setCookies, - message + " - foreign partitioned set cookies denominator" - ); -} - -add_task(async () => { - await Services.fog.testFlushAllChildren(); - Services.fog.testResetFOG(); - await validateTelemetryValues({}, "initially empty"); - - // open a browser window for the test - let tab = BrowserTestUtils.addTab(gBrowser, TEST_URL); - let browser = gBrowser.getBrowserForTab(tab); - await BrowserTestUtils.browserLoaded(browser); - - // Set cookies with Javascript - await SpecialPowers.spawn(browser, [], function () { - content.document.cookie = "a=1; Partitioned; SameSite=None; Secure"; - content.document.cookie = "b=2; SameSite=None; Secure"; - }); - await validateTelemetryValues( - { - setCookies: 2, - setForeigns: 0, - setPartitioneds: 1, - setForeignPartitioneds: 0, - }, - "javascript cookie" - ); - - // Set cookies with HTTP - await SpecialPowers.spawn(browser, [], async function () { - await content.fetch("partitioned.sjs"); - }); - await validateTelemetryValues( - { - setCookies: 4, - setForeigns: 0, - setPartitioneds: 2, - setForeignPartitioneds: 0, - }, - "same site fetch" - ); - - // Set cookies with cross-site HTTP - await SpecialPowers.spawn(browser, [], async function () { - await content.fetch( - "https://example.org/browser/netwerk/cookie/test/browser/partitioned.sjs", - { credentials: "include" } - ); - }); - await validateTelemetryValues( - { - setCookies: 6, - setForeigns: 2, - setPartitioneds: 3, - setForeignPartitioneds: 1, - }, - "foreign fetch" - ); - - // Set cookies with cross-site HTTP redirect - await SpecialPowers.spawn(browser, [], async function () { - await content.fetch( - encodeURI( - "https://example.org/browser/netwerk/cookie/test/browser/partitioned.sjs?redirect=https://example.com/browser/netwerk/cookie/test/browser/partitioned.sjs?nocookie" - ), - { credentials: "include" } - ); - }); - - await validateTelemetryValues( - { - setCookies: 8, - setForeigns: 4, - setPartitioneds: 4, - setForeignPartitioneds: 2, - }, - "foreign fetch redirect" - ); - - // remove the tab - gBrowser.removeTab(tab); -}); diff --git a/netwerk/metrics.yaml b/netwerk/metrics.yaml @@ -364,75 +364,6 @@ networking: expires: never telemetry_mirror: MOZ_SQLITE_COOKIES_TIME_TO_BLOCK_MAIN_THREAD_MS - set_cookie: - type: counter - description: > - This counts the number of times we set a cookie. Introduced - as a denomenator for measuring CHIPS adoption. - bugs: - - https://bugzilla.mozilla.org/1865199 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1949776 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1865199#c3 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184#c7 - notification_emails: - - bvandersloot@mozilla.com - expires: 147 - - set_cookie_foreign: - type: rate - description: > - This counts the number of times we set a cookie from a foreign (not - same-site) context. Introduced as a denomenator for measuring CHIPS - adoption. - bugs: - - https://bugzilla.mozilla.org/1865199 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1949776 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1865199#c3 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184#c7 - notification_emails: - - bvandersloot@mozilla.com - expires: 147 - denominator_metric: networking.set_cookie - - set_cookie_partitioned: - type: rate - description: > - This counts the number of times we set a cookie that has the Partitioned - attribute. This tracks the adoption of CHIPS. - bugs: - - https://bugzilla.mozilla.org/1865199 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1949776 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1865199#c3 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184#c7 - notification_emails: - - bvandersloot@mozilla.com - expires: 147 - denominator_metric: networking.set_cookie - - set_cookie_foreign_partitioned: - type: rate - description: > - This counts the number of times we set a cookie that has the Partitioned - attribute in a foreign (not same-site) context. This tracks the adoption - of CHIPS. - bugs: - - https://bugzilla.mozilla.org/1865199 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1949776 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1865199#c3 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1912184#c7 - notification_emails: - - bvandersloot@mozilla.com - expires: 147 - denominator_metric: networking.set_cookie - dns_lookup_time: type: timing_distribution time_unit: millisecond