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); ::JS_DefineProfilingFunctions(cx, aGlobalObj);
#ifdef NS_TRACE_MALLOC #ifdef NS_TRACE_MALLOC
if (nsContentUtils::IsCallerChrome()) {
// Attempt to initialize TraceMalloc functions // Attempt to initialize TraceMalloc functions
::JS_DefineFunctions(cx, aGlobalObj, TraceMallocFunctions); ::JS_DefineFunctions(cx, aGlobalObj, TraceMallocFunctions);
}
#endif #endif
#ifdef MOZ_DMD #ifdef MOZ_DMD

View File

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