Bug 808457 - Add Telemetry for Components.lookupMethod and Components.interfaces. r=mrbkap

This commit is contained in:
Bobby Holley 2012-11-07 08:28:35 -08:00
parent b7a80f0b32
commit b03878d5cf
2 changed files with 20 additions and 0 deletions

View File

@ -4864,6 +4864,12 @@ nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, c
{
static const char* allowed[] = { "isSuccessCode", "lookupMethod", nullptr };
*_retval = xpc_CheckAccessList(methodName, allowed);
if (*_retval &&
methodName[0] == 'l' &&
!AccessCheck::callerIsXBL(nsContentUtils::GetCurrentJSContext()))
{
Telemetry::Accumulate(Telemetry::COMPONENTS_LOOKUPMETHOD_ACCESSED_BY_CONTENT, true);
}
return NS_OK;
}
@ -4873,6 +4879,12 @@ nsXPCComponents::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName
{
static const char* allowed[] = { "interfaces", "interfacesByID", "results", nullptr};
*_retval = xpc_CheckAccessList(propertyName, allowed);
if (*_retval &&
propertyName[0] == 'i' &&
!AccessCheck::callerIsXBL(nsContentUtils::GetCurrentJSContext()))
{
Telemetry::Accumulate(Telemetry::COMPONENTS_INTERFACES_ACCESSED_BY_CONTENT, true);
}
return NS_OK;
}

View File

@ -2401,5 +2401,13 @@
"COMPONENTS_OBJECT_ACCESSED_BY_CONTENT": {
"kind": "flag",
"description": "Whether content ever accesed the Components object in this session"
},
"COMPONENTS_LOOKUPMETHOD_ACCESSED_BY_CONTENT": {
"kind": "flag",
"description": "Whether content ever accesed Components.lookupMethod in this session"
},
"COMPONENTS_INTERFACES_ACCESSED_BY_CONTENT": {
"kind": "flag",
"description": "Whether content ever accesed Components.interfaces in this session"
}
}