Bug 1963608 - Add a etpCategory to the AntiTracking info of the reportBrokenSite. r=twisniewski,anti-tracking-reviewers,android-reviewers,webcompat-reviewers,emz,npoon

Differential Revision: https://phabricator.services.mozilla.com/D247569
This commit is contained in:
Tim Huang
2025-05-16 08:59:04 +00:00
committed by tihuang@mozilla.com
parent 8438ee01cb
commit 0a7f12580c
13 changed files with 66 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ add_task(async function testSendButton() {
hasMixedActiveContentBlocked: true, hasMixedActiveContentBlocked: true,
hasMixedDisplayContentBlocked: true, hasMixedDisplayContentBlocked: true,
btpHasPurgedSite: false, btpHasPurgedSite: false,
etpCategory: "strict",
}, },
frameworks: { frameworks: {
fastclick: true, fastclick: true,
@@ -66,6 +67,7 @@ add_task(async function testSendingMoreInfo() {
hasMixedActiveContentBlocked: true, hasMixedActiveContentBlocked: true,
hasMixedDisplayContentBlocked: true, hasMixedDisplayContentBlocked: true,
btpHasPurgedSite: false, btpHasPurgedSite: false,
etpCategory: "strict",
}, },
frameworks: { fastclick: true, mobify: true, marfeel: true }, frameworks: { fastclick: true, mobify: true, marfeel: true },
consoleLog: [ consoleLog: [

View File

@@ -831,6 +831,7 @@ async function setupStrictETP() {
"urlclassifier.trackingTable", "urlclassifier.trackingTable",
"content-track-digest256,mochitest2-track-simple", "content-track-digest256,mochitest2-track-simple",
], ],
["browser.contentblocking.category", "strict"],
], ],
}); });
} }

View File

@@ -216,6 +216,7 @@ async function getExpectedWebCompatInfo(tab, snapshot, fullAppData = false) {
hasMixedActiveContentBlocked: false, hasMixedActiveContentBlocked: false,
hasMixedDisplayContentBlocked: false, hasMixedDisplayContentBlocked: false,
btpHasPurgedSite: false, btpHasPurgedSite: false,
etpCategory: "standard",
}, },
frameworks: { frameworks: {
fastclick: false, fastclick: false,

View File

@@ -51,6 +51,7 @@ async function reformatExpectedWebCompatInfo(tab, overrides) {
atOverrides?.isPrivateBrowsing ?? antitracking.isPrivateBrowsing; atOverrides?.isPrivateBrowsing ?? antitracking.isPrivateBrowsing;
const btpHasPurgedSite = const btpHasPurgedSite =
atOverrides?.btpHasPurgedSite ?? antitracking.btpHasPurgedSite; atOverrides?.btpHasPurgedSite ?? antitracking.btpHasPurgedSite;
const etpCategory = atOverrides?.etpCategory ?? antitracking.etpCategory;
const extra_labels = []; const extra_labels = [];
const frameworks = overrides.frameworks ?? { const frameworks = overrides.frameworks ?? {
@@ -118,6 +119,7 @@ async function reformatExpectedWebCompatInfo(tab, overrides) {
hasTrackingContentBlocked, hasTrackingContentBlocked,
btpHasPurgedSite, btpHasPurgedSite,
isPB: isPrivateBrowsing, isPB: isPrivateBrowsing,
etpCategory,
languages, languages,
locales: snapshot.intl.localeService.available, locales: snapshot.intl.localeService.available,
memoryMB: browserInfo.system.memory, memoryMB: browserInfo.system.memory,

View File

@@ -13109,6 +13109,22 @@ broken_site_report.tab_info.antitracking:
- webcompat-reporting-tool-telemetry@mozilla.com - webcompat-reporting-tool-telemetry@mozilla.com
send_in_pings: send_in_pings:
- broken-site-report - broken-site-report
etp_category:
type: string
expires: never
data_sensitivity:
- interaction
description: >
The current ETP category, either `standard`, `strict`, or `custom`.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1963608
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852340#c16
notification_emails:
- twisniewski@mozilla.com
- webcompat-reporting-tool-telemetry@mozilla.com
send_in_pings:
- broken-site-report
broken_site_report.tab_info.frameworks: broken_site_report.tab_info.frameworks:
fastclick: fastclick:
type: boolean type: boolean

View File

@@ -36,6 +36,7 @@ data class WebCompatInfoDto(
* *
* @property blockList The blocklist string. * @property blockList The blocklist string.
* @property btpHasPurgedSite Whether the current tab has recently been purged by Bounce Tracking Protection. * @property btpHasPurgedSite Whether the current tab has recently been purged by Bounce Tracking Protection.
* @property etpCategory The current ETP category.
* @property hasMixedActiveContentBlocked Whether the current tab has mixed active content blocked. * @property hasMixedActiveContentBlocked Whether the current tab has mixed active content blocked.
* @property hasMixedDisplayContentBlocked Whether the current tab has mixed display content blocked. * @property hasMixedDisplayContentBlocked Whether the current tab has mixed display content blocked.
* @property hasTrackingContentBlocked Whether the current tab has tracking content blocked. * @property hasTrackingContentBlocked Whether the current tab has tracking content blocked.
@@ -45,6 +46,7 @@ data class WebCompatInfoDto(
data class WebCompatAntiTrackingDto( data class WebCompatAntiTrackingDto(
val blockList: String, val blockList: String,
val btpHasPurgedSite: Boolean, val btpHasPurgedSite: Boolean,
val etpCategory: String,
val hasMixedActiveContentBlocked: Boolean, val hasMixedActiveContentBlocked: Boolean,
val hasMixedDisplayContentBlocked: Boolean, val hasMixedDisplayContentBlocked: Boolean,
val hasTrackingContentBlocked: Boolean, val hasTrackingContentBlocked: Boolean,

View File

@@ -122,6 +122,7 @@ class WebCompatReporterSubmissionMiddleware(
private fun setTabAntiTrackingMetrics(antiTracking: WebCompatInfoDto.WebCompatAntiTrackingDto) { private fun setTabAntiTrackingMetrics(antiTracking: WebCompatInfoDto.WebCompatAntiTrackingDto) {
BrokenSiteReportTabInfoAntitracking.blockList.set(antiTracking.blockList) BrokenSiteReportTabInfoAntitracking.blockList.set(antiTracking.blockList)
BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.set(antiTracking.btpHasPurgedSite) BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.set(antiTracking.btpHasPurgedSite)
BrokenSiteReportTabInfoAntitracking.etpCategory.set(antiTracking.etpCategory)
BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.set( BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.set(
antiTracking.hasMixedActiveContentBlocked, antiTracking.hasMixedActiveContentBlocked,
) )

View File

@@ -84,6 +84,7 @@ class DefaultWebCompatReporterRetrievalServiceTest {
antitracking = WebCompatInfoDto.WebCompatAntiTrackingDto( antitracking = WebCompatInfoDto.WebCompatAntiTrackingDto(
blockList = "basic", blockList = "basic",
btpHasPurgedSite = false, btpHasPurgedSite = false,
etpCategory = "standard",
hasMixedActiveContentBlocked = false, hasMixedActiveContentBlocked = false,
hasMixedDisplayContentBlocked = false, hasMixedDisplayContentBlocked = false,
hasTrackingContentBlocked = false, hasTrackingContentBlocked = false,
@@ -180,6 +181,7 @@ class DefaultWebCompatReporterRetrievalServiceTest {
antitracking = WebCompatInfoDto.WebCompatAntiTrackingDto( antitracking = WebCompatInfoDto.WebCompatAntiTrackingDto(
blockList = "basic", blockList = "basic",
btpHasPurgedSite = false, btpHasPurgedSite = false,
etpCategory = "standard",
hasMixedActiveContentBlocked = false, hasMixedActiveContentBlocked = false,
hasMixedDisplayContentBlocked = false, hasMixedDisplayContentBlocked = false,
hasTrackingContentBlocked = false, hasTrackingContentBlocked = false,

View File

@@ -68,6 +68,10 @@ class WebCompatReporterSubmissionMiddlewareTest {
false, false,
BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.testGetValue(), BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.testGetValue(),
) )
assertEquals(
"standard",
BrokenSiteReportTabInfoAntitracking.etpCategory.testGetValue(),
)
assertEquals( assertEquals(
false, false,
BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.testGetValue(), BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.testGetValue(),
@@ -219,6 +223,7 @@ class WebCompatReporterSubmissionMiddlewareTest {
Pings.brokenSiteReport.testBeforeNextSubmit { Pings.brokenSiteReport.testBeforeNextSubmit {
assertNull(BrokenSiteReportTabInfoAntitracking.blockList.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.blockList.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.etpCategory.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedDisplayContentBlocked.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedDisplayContentBlocked.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.hasTrackingContentBlocked.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.hasTrackingContentBlocked.testGetValue())
@@ -351,6 +356,7 @@ class WebCompatReporterSubmissionMiddlewareTest {
Pings.brokenSiteReport.testBeforeNextSubmit { Pings.brokenSiteReport.testBeforeNextSubmit {
assertNull(BrokenSiteReportTabInfoAntitracking.blockList.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.blockList.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.btpHasPurgedSite.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.etpCategory.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedActiveContentBlocked.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedDisplayContentBlocked.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.hasMixedDisplayContentBlocked.testGetValue())
assertNull(BrokenSiteReportTabInfoAntitracking.hasTrackingContentBlocked.testGetValue()) assertNull(BrokenSiteReportTabInfoAntitracking.hasTrackingContentBlocked.testGetValue())
@@ -441,6 +447,7 @@ class WebCompatReporterSubmissionMiddlewareTest {
antitracking = WebCompatInfoDto.WebCompatAntiTrackingDto( antitracking = WebCompatInfoDto.WebCompatAntiTrackingDto(
blockList = "basic", blockList = "basic",
btpHasPurgedSite = false, btpHasPurgedSite = false,
etpCategory = "standard",
hasMixedActiveContentBlocked = false, hasMixedActiveContentBlocked = false,
hasMixedDisplayContentBlocked = false, hasMixedDisplayContentBlocked = false,
hasTrackingContentBlocked = false, hasTrackingContentBlocked = false,

View File

@@ -11,6 +11,7 @@ object WebCompatTestData {
"antitracking": { "antitracking": {
"blockList": "basic", "blockList": "basic",
"btpHasPurgedSite": false, "btpHasPurgedSite": false,
"etpCategory": "standard",
"hasMixedActiveContentBlocked": false, "hasMixedActiveContentBlocked": false,
"hasMixedDisplayContentBlocked": false, "hasMixedDisplayContentBlocked": false,
"hasTrackingContentBlocked": false, "hasTrackingContentBlocked": false,
@@ -96,6 +97,7 @@ object WebCompatTestData {
"antitracking": { "antitracking": {
"blockList": "basic", "blockList": "basic",
"btpHasPurgedSite": false, "btpHasPurgedSite": false,
"etpCategory": "standard",
"hasMixedActiveContentBlocked": false, "hasMixedActiveContentBlocked": false,
"hasMixedDisplayContentBlocked": false, "hasMixedDisplayContentBlocked": false,
"hasTrackingContentBlocked": false, "hasTrackingContentBlocked": false,

View File

@@ -311,6 +311,7 @@ export class ReportBrokenSiteChild extends JSWindowActorChild {
hasMixedDisplayContentBlocked, hasMixedDisplayContentBlocked,
hasTrackingContentBlocked, hasTrackingContentBlocked,
btpHasPurgedSite, btpHasPurgedSite,
etpCategory,
} = antitracking; } = antitracking;
message.blockList = blockList; message.blockList = blockList;
@@ -359,6 +360,7 @@ export class ReportBrokenSiteChild extends JSWindowActorChild {
hasTrackingContentBlocked, hasTrackingContentBlocked,
btpHasPurgedSite, btpHasPurgedSite,
isPB: isPrivateBrowsing, isPB: isPrivateBrowsing,
etpCategory,
languages, languages,
locales, locales,
memoryMB, memoryMB,

View File

@@ -17,6 +17,16 @@ export class ReportBrokenSiteParent extends JSWindowActorParent {
return trackingTable.includes("content") ? "strict" : "basic"; return trackingTable.includes("content") ? "strict" : "basic";
} }
#getETPCategory() {
// Note that the pref will be set to "custom" if the user disables ETP on
// mobile.
const etpState = Services.prefs.getStringPref(
"browser.contentblocking.category",
"standard"
);
return etpState;
}
#getAntitrackingInfo(browsingContext) { #getAntitrackingInfo(browsingContext) {
// Ask BounceTrackingProtection whether it has recently purged state for the // Ask BounceTrackingProtection whether it has recently purged state for the
// site in the current top level context. // site in the current top level context.
@@ -54,6 +64,7 @@ export class ReportBrokenSiteParent extends JSWindowActorParent {
Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT
), ),
btpHasPurgedSite, btpHasPurgedSite,
etpCategory: this.#getETPCategory(),
}; };
} }

View File

@@ -202,6 +202,23 @@ broken_site_report.tab_info.antitracking:
send_in_pings: send_in_pings:
- broken-site-report - broken-site-report
etp_category:
type: string
expires: never
data_sensitivity:
- interaction
description: >
The current ETP category, either `standard`, `strict`, or `custom`.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1963608
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852340#c16
notification_emails:
- twisniewski@mozilla.com
- webcompat-reporting-tool-telemetry@mozilla.com
send_in_pings:
- broken-site-report
broken_site_report.tab_info.frameworks: broken_site_report.tab_info.frameworks:
fastclick: fastclick:
type: boolean type: boolean