From 68b656f5513605650d16ab55907ba4cfd18c35ce Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Tue, 16 Feb 2016 11:21:11 -0500 Subject: [PATCH] Bug 1245901 - Measure counts of browser CPOW usage which is now rejected, r=billm MozReview-Commit-ID: GwLq9EoDEuR --HG-- extra : rebase_source : 84a84edfea9628aeed53903bfa3c9897793df34f extra : amend_source : 58e846e6be3c5bf3a787723c45ec5b2d67913051 --- js/ipc/JavaScriptParent.cpp | 2 ++ toolkit/components/telemetry/Histograms.json | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/js/ipc/JavaScriptParent.cpp b/js/ipc/JavaScriptParent.cpp index 1cbf4dffdf10..a88dea85ac00 100644 --- a/js/ipc/JavaScriptParent.cpp +++ b/js/ipc/JavaScriptParent.cpp @@ -15,6 +15,7 @@ #include "js/HeapAPI.h" #include "xpcprivate.h" #include "mozilla/Casting.h" +#include "mozilla/Telemetry.h" using namespace js; using namespace JS; @@ -74,6 +75,7 @@ JavaScriptParent::allowMessage(JSContext* cx) if (jsGlobal) { JSAutoCompartment ac(cx, jsGlobal); if (!JS::AddonIdOfObject(jsGlobal) && !xpc::CompartmentPrivate::Get(jsGlobal)->allowCPOWs) { + Telemetry::Accumulate(Telemetry::BROWSER_SHIM_USAGE_BLOCKED, 1); JS_ReportError(cx, "unsafe CPOW usage forbidden"); return false; } diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 509a781f3cf9..ca0dfc5d4d46 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -34,6 +34,14 @@ "keyed": true, "description": "Reasons why add-on shims were used, keyed by add-on ID." }, + "BROWSER_SHIM_USAGE_BLOCKED": { + "expires_in_version": "never", + "kind": "count", + "description": "Counts the number of times a CPOW shim was blocked from being created by browser code.", + "releaseChannelCollection": "opt-out", + "bug_numbers": [1245901], + "alert_emails": ["benjamin@smedbergs.us"] + }, "APPLICATION_REPUTATION_SHOULD_BLOCK": { "expires_in_version": "never", "kind": "boolean",