From c71d1284747374d8a7d5f2bd6036dc2b16ead1ab Mon Sep 17 00:00:00 2001 From: Andreas Gal Date: Fri, 14 Jan 2011 19:02:11 -0800 Subject: [PATCH] Temporary restore old shark start/stop functions (bug 625993, r=bz). --- dom/base/nsJSEnvironment.cpp | 2 -- dom/src/threads/nsDOMWorker.cpp | 2 -- js/src/jsdbgapi.cpp | 26 ++++++++++++++++++++++---- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 740fc7cf09e7..0c6252f738ae 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -3362,10 +3362,8 @@ nsJSContext::InitClasses(void *aGlobalObj) rv = NS_ERROR_FAILURE; } -#ifdef MOZ_PROFILING // Attempt to initialize profiling functions ::JS_DefineProfilingFunctions(mContext, globalObj); -#endif #ifdef NS_TRACE_MALLOC // Attempt to initialize TraceMalloc functions diff --git a/dom/src/threads/nsDOMWorker.cpp b/dom/src/threads/nsDOMWorker.cpp index 2dc09614e17e..d2ebee238026 100644 --- a/dom/src/threads/nsDOMWorker.cpp +++ b/dom/src/threads/nsDOMWorker.cpp @@ -2105,10 +2105,8 @@ nsDOMWorker::CompileGlobalObject(JSContext* aCx, nsLazyAutoRequest *aRequest, success = JS_DefineFunctions(aCx, global, gDOMWorkerFunctions); NS_ENSURE_TRUE(success, PR_FALSE); -#ifdef MOZ_PROFILING success = JS_DefineProfilingFunctions(aCx, global); NS_ENSURE_TRUE(success, PR_FALSE); -#endif if (IsPrivileged()) { // Add chrome functions. diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index d8d9a1a3b102..9f97ae51ad93 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -1924,20 +1924,38 @@ JS_StopProfiling() static JSBool StartProfiling(JSContext *cx, uintN argc, jsval *vp) { - *vp = BOOLEAN_TO_JSVAL(Probes::startProfiling()); + JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(Probes::startProfiling())); return true; } static JSBool StopProfiling(JSContext *cx, uintN argc, jsval *vp) { - *vp = JSVAL_VOID; + JS_SET_RVAL(cx, vp, JSVAL_VOID); return true; } +#ifdef MOZ_SHARK + +static JSBool +IgnoreAndReturnTrue(JSContext *cx, uintN argc, jsval *vp) +{ + JS_SET_RVAL(cx, vp, JSVAL_TRUE); + return true; +} + +#endif + static JSFunctionSpec profiling_functions[] = { - JS_FN("startProfiling", StartProfiling, 0,0), - JS_FN("stopProfiling", StopProfiling, 0,0), + JS_FN("startProfiling", StartProfiling, 0,0), + JS_FN("stopProfiling", StopProfiling, 0,0), +#ifdef MOZ_SHARK + /* Keep users of the old shark API happy. */ + JS_FN("connectShark", IgnoreAndReturnTrue, 0,0), + JS_FN("disconnectShark", IgnoreAndReturnTrue, 0,0), + JS_FN("startShark", StartProfiling, 0,0), + JS_FN("stopShark", StopProfiling, 0,0), +#endif JS_FS_END };