Bug 1245901 - Measure counts of browser CPOW usage which is now rejected, r=billm

MozReview-Commit-ID: GwLq9EoDEuR
This commit is contained in:
Benjamin Smedberg
2016-02-16 11:21:11 -05:00
parent a8ed43be87
commit 6953cf7efe
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;
}