From d48622e17afae85a2144d628262ba544eb978233 Mon Sep 17 00:00:00 2001 From: Toshihito Kikuchi Date: Fri, 22 Jan 2021 21:40:46 +0000 Subject: [PATCH] Bug 1686229 - Part3. Display a module's loading status on about:support. r=Gijs,fluent-reviewers This patch displays the new telemetry field "loadStatus", which was introduced by the earlier patch, on about:support. With this information, a user can see each of injected modules was really loaded or blocked by our DLL blocklist. Differential Revision: https://phabricator.services.mozilla.com/D102409 --- mozglue/dllservices/ModuleLoadInfo.h | 3 +++ toolkit/content/aboutSupport.js | 14 ++++++++++++++ .../locales/en-US/toolkit/about/aboutSupport.ftl | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/mozglue/dllservices/ModuleLoadInfo.h b/mozglue/dllservices/ModuleLoadInfo.h index ad06a90d0def..2d9bdc0cc729 100644 --- a/mozglue/dllservices/ModuleLoadInfo.h +++ b/mozglue/dllservices/ModuleLoadInfo.h @@ -14,6 +14,9 @@ namespace mozilla { struct ModuleLoadInfo final { + // If you add a new value or change the meaning of the values, please + // update createLoadStatusElement in aboutSupport.js accordingly, which + // defines text labels of these enum values displayed on about:support. enum class Status : uint32_t { Loaded = 0, Blocked, diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index d936c9a31436..a7917b9f5d0c 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -1189,6 +1189,16 @@ var snapshotFormatters = { : $.new(tag, "", "", { "data-l10n-id": "support-third-party-modules-no-value", }); + const createLoadStatusElement = (tag, status) => { + const labelLoadStatus = [ + "support-third-party-modules-status-loaded", + "support-third-party-modules-status-blocked", + "support-third-party-modules-status-redirected", + ]; + return status >= 0 && status < labelLoadStatus.length + ? $.new(tag, "", "", { "data-l10n-id": labelLoadStatus[status] }) + : $.new(tag, status); + }; const iconUp = "chrome://global/skin/icons/arrow-up-12.svg"; const iconDown = "chrome://global/skin/icons/arrow-dropdown-12.svg"; @@ -1233,6 +1243,7 @@ var snapshotFormatters = { // loadDurationMS can be empty (not zero) when a module is loaded // very early in the process. processUptimeMS always has a value. createElementWithLabel("td", event.loadDurationMS), + createLoadStatusElement("td", event.loadStatus), ]) ); } @@ -1260,6 +1271,9 @@ var snapshotFormatters = { $.new("th", "", "", { "data-l10n-id": "support-third-party-modules-duration", }), + $.new("th", "", "", { + "data-l10n-id": "support-third-party-modules-status", + }), ]), innerTBody, ]), diff --git a/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl b/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl index fe36452a851f..eb70ef3d8ed7 100644 --- a/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl +++ b/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl @@ -192,6 +192,10 @@ support-third-party-modules-thread = Thread support-third-party-modules-base = Imagebase Address support-third-party-modules-uptime = Process Uptime (ms) support-third-party-modules-duration = Loading Duration (ms) +support-third-party-modules-status = Status +support-third-party-modules-status-loaded = Loaded +support-third-party-modules-status-blocked = Blocked +support-third-party-modules-status-redirected = Redirected support-third-party-modules-empty = No third-party modules were loaded. support-third-party-modules-no-value = (No value) support-third-party-modules-button-open =