From 8699684f4995073d472508a8212f2945fa95384d Mon Sep 17 00:00:00 2001 From: Toshihito Kikuchi Date: Mon, 4 May 2020 17:21:14 +0000 Subject: [PATCH] Bug 1620118 - Part 2: Add isDependent field to the third-party-modules ping. r=chutten This patch adds an optional boolean field `isDependent` to the third-party-modules ping whose value is copied from `ProcessedModuleLoadEvent::mIsDependent`. Differential Revision: https://phabricator.services.mozilla.com/D67883 --- .../telemetry/docs/data/third-party-modules-ping.rst | 11 ++++++----- .../components/telemetry/other/UntrustedModules.cpp | 7 +++++++ .../tests/unit/test_ThirdPartyModulesPing.js | 3 +++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/toolkit/components/telemetry/docs/data/third-party-modules-ping.rst b/toolkit/components/telemetry/docs/data/third-party-modules-ping.rst index dabdc946c8995..1b15daa991057 100644 --- a/toolkit/components/telemetry/docs/data/third-party-modules-ping.rst +++ b/toolkit/components/telemetry/docs/data/third-party-modules-ping.rst @@ -57,7 +57,9 @@ were loaded into Firefox processes. // The base address to which the loader mapped the module. "baseAddress": , // Index of the element in the modules array that contains details about the module that was loaded during this event. - "moduleIndex": + "moduleIndex": , + // True if the module is included in the executable's Import Directory Table. + "isDependent": }, ... Additional events (maximum 50) ], @@ -117,10 +119,9 @@ Notes Version History ~~~~~~~~~~~~~~~ -- Firefox 71: - - Renamed from untrustedModules to third-party-modules with a revised schema (`bug 1542830 `_). -- Firefox 70: - - Added ``%SystemRoot%`` as an exemption to path sanitization (`bug 1573275 `_). +- Firefox 77: Added ``isDependent`` (`bug 1620118 `_). +- Firefox 71: Renamed from untrustedModules to third-party-modules with a revised schema (`bug 1542830 `_). +- Firefox 70: Added ``%SystemRoot%`` as an exemption to path sanitization (`bug 1573275 `_). - Firefox 66: - Added Windows Side-by-side directory trust flag (`bug 1514694 `_). - Added module load times (``xulLoadDurationMS``, ``loadDurationMS``) and xul.dll trust flag (`bug 1518490 `_). diff --git a/toolkit/components/telemetry/other/UntrustedModules.cpp b/toolkit/components/telemetry/other/UntrustedModules.cpp index 48e39c5128d42..ae3d6e7a49a27 100644 --- a/toolkit/components/telemetry/other/UntrustedModules.cpp +++ b/toolkit/components/telemetry/other/UntrustedModules.cpp @@ -293,6 +293,13 @@ static bool SerializeEvent(JSContext* aCx, JS::MutableHandleValue aElement, return false; } + JS::RootedValue jsIsDependent(aCx); + jsIsDependent.setBoolean(aEvent.mIsDependent); + if (!JS_DefineProperty(aCx, obj, "isDependent", jsIsDependent, + JSPROP_ENUMERATE)) { + return false; + } + aElement.setObject(*obj); return true; diff --git a/toolkit/components/telemetry/tests/unit/test_ThirdPartyModulesPing.js b/toolkit/components/telemetry/tests/unit/test_ThirdPartyModulesPing.js index 45f266582ade2..180261b5dbd5d 100644 --- a/toolkit/components/telemetry/tests/unit/test_ThirdPartyModulesPing.js +++ b/toolkit/components/telemetry/tests/unit/test_ThirdPartyModulesPing.js @@ -121,6 +121,9 @@ add_task(async function test_send_ping() { Assert.ok(typeof event.moduleIndex == "number", "'moduleIndex' exists"); Assert.ok(event.moduleIndex >= 0, "'moduleIndex' is non-negative"); + Assert.ok(typeof event.isDependent == "boolean", "'isDependent' exists"); + Assert.ok(!event.isDependent, "'isDependent' is false"); + let modRecord = found.payload.modules[event.moduleIndex]; Assert.ok(modRecord, "module record for this event exists"); Assert.ok(