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
This commit is contained in:
Benjamin Smedberg 2016-02-16 11:21:11 -05:00
parent 3adec83e78
commit 68b656f551
2 changed files with 10 additions and 0 deletions

View File

@ -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;
}

View File

@ -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",