Bug 910291 - Hide TraceMalloc debug functions from content. r=bz

This commit is contained in:
Masatoshi Kimura 2013-08-29 07:48:43 +09:00
parent 890ecab565
commit 537980e822
2 changed files with 5 additions and 14 deletions

View File

@ -1836,8 +1836,10 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
::JS_DefineProfilingFunctions(cx, aGlobalObj);
#ifdef NS_TRACE_MALLOC
// Attempt to initialize TraceMalloc functions
::JS_DefineFunctions(cx, aGlobalObj, TraceMallocFunctions);
if (nsContentUtils::IsCallerChrome()) {
// Attempt to initialize TraceMalloc functions
::JS_DefineFunctions(cx, aGlobalObj, TraceMallocFunctions);
}
#endif
#ifdef MOZ_DMD

View File

@ -569,16 +569,6 @@ var interfaceNamesInGlobalScope =
]
// IMPORTANT: Do not change this list without review from a DOM peer!
var excludedNames = [
"TraceMallocDisable", // debug builds only
"TraceMallocEnable", // debug builds only
"TraceMallocOpenLogFile", // debug builds only
"TraceMallocChangeLogFD", // debug builds only
"TraceMallocCloseLogFD", // debug builds only
"TraceMallocLogTimestamp", // debug builds only
"TraceMallocDumpAllocations", // debug builds only
];
function createInterfaceMap(isXBLScope) {
var version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version;
var isNightly = version.endsWith("a1");
@ -613,8 +603,7 @@ function runTest(isXBLScope) {
var interfaceMap = createInterfaceMap(isXBLScope);
for (var name of Object.getOwnPropertyNames(window)) {
// An interfae name should start with an upper case character.
if (!/^(moz)?[A-Z]/.test(name) ||
excludedNames.indexOf(name) >= 0) {
if (!/^(moz)?[A-Z]/.test(name)) {
continue;
}
ok(interfaceMap[name],