Bug 880697 - Push in a few other suspicious places. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Wed, 12 Jun 2013 14:17:56 -0700
changeset 146365 81d4a3cf9e140a0d5792557ca15eae6513dfb2fd
parent 146364 5f37e9cb1334532e8b86b63813cd1e40f8f9eede
child 146366 101be41e6536d1aced2ef01cf2c8ed51156a4b08
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs880697
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 880697 - Push in a few other suspicious places. r=gabor
js/jsd/jsd_stak.cpp
js/jsd/jsd_xpc.cpp
--- a/js/jsd/jsd_stak.cpp
+++ b/js/jsd/jsd_stak.cpp
@@ -5,16 +5,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * JavaScript Debugging support - Call stack support
  */
 
 #include "jsd.h"
 #include "jsfriendapi.h"
+#include "nsCxPusher.h"
+
+using mozilla::AutoPushJSContext;
 
 #ifdef DEBUG
 void JSD_ASSERT_VALID_THREAD_STATE(JSDThreadState* jsdthreadstate)
 {
     JS_ASSERT(jsdthreadstate);
     JS_ASSERT(jsdthreadstate->stackDepth > 0);
 }
 
@@ -393,28 +396,27 @@ jsd_EvaluateUCScriptInStackFrame(JSDCont
                                  JSDStackFrameInfo* jsdframe,
                                  const jschar *bytes, unsigned length,
                                  const char *filename, unsigned lineno,
                                  JSBool eatExceptions, JS::MutableHandleValue rval)
 {
     JSBool retval;
     JSBool valid;
     JSExceptionState* exceptionState = NULL;
-    JSContext* cx;
 
     JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
 
     JSD_LOCK_THREADSTATES(jsdc);
     valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe);
     JSD_UNLOCK_THREADSTATES(jsdc);
 
     if( ! valid )
         return JS_FALSE;
 
-    cx = jsdthreadstate->context;
+    AutoPushJSContext cx(jsdthreadstate->context);
     JS_ASSERT(cx);
 
     if (eatExceptions)
         exceptionState = JS_SaveExceptionState(cx);
     JS_ClearPendingException(cx);
     jsd_StartingEvalUsingFilename(jsdc, filename);
     retval = jsdframe->frame.evaluateUCInStackFrame(cx, bytes, length, filename, lineno,
                                                     rval);
@@ -431,28 +433,27 @@ jsd_EvaluateScriptInStackFrame(JSDContex
                                JSDStackFrameInfo* jsdframe,
                                const char *bytes, unsigned length,
                                const char *filename, unsigned lineno,
                                JSBool eatExceptions, JS::MutableHandleValue rval)
 {
     JSBool retval;
     JSBool valid;
     JSExceptionState* exceptionState = NULL;
-    JSContext *cx;
 
     JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
 
     JSD_LOCK_THREADSTATES(jsdc);
     valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe);
     JSD_UNLOCK_THREADSTATES(jsdc);
 
     if (!valid)
         return JS_FALSE;
 
-    cx = jsdthreadstate->context;
+    AutoPushJSContext cx(jsdthreadstate->context);
     JS_ASSERT(cx);
 
     if (eatExceptions)
         exceptionState = JS_SaveExceptionState(cx);
     JS_ClearPendingException(cx);
     jsd_StartingEvalUsingFilename(jsdc, filename);
     retval = jsdframe->frame.evaluateInStackFrame(cx, bytes, length, filename, lineno,
                                                   rval);
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -31,16 +31,17 @@
 /* XXX DOM dependency */
 #include "nsIScriptContext.h"
 #include "SandboxPrivate.h"
 #include "nsJSPrincipals.h"
 #include "nsContentUtils.h"
 #include "nsCxPusher.h"
 
 using mozilla::AutoSafeJSContext;
+using mozilla::AutoPushJSContext;
 
 /*
  * defining CAUTIOUS_SCRIPTHOOK makes jsds disable GC while calling out to the
  * script hook.  This was a hack to avoid some js engine problems that should
  * be fixed now (see Mozilla bug 77636).
  */
 #undef CAUTIOUS_SCRIPTHOOK
 
@@ -1996,26 +1997,23 @@ jsdStackFrame::Eval (const nsAString &by
 
     // get pointer to buffer contained in |bytes|
     nsAString::const_iterator h;
     bytes.BeginReading(h);
     const jschar *char_bytes = reinterpret_cast<const jschar *>(h.get());
 
     JSExceptionState *estate = 0;
 
-    JSContext *cx = JSD_GetJSContext (mCx, mThreadState);
+    AutoPushJSContext cx(JSD_GetJSContext (mCx, mThreadState));
 
     JS::RootedValue jv(cx);
 
     estate = JS_SaveExceptionState (cx);
     JS_ClearPendingException (cx);
 
-    nsCxPusher pusher;
-    pusher.Push(cx);
-
     *_rval = JSD_AttemptUCScriptInStackFrame (mCx, mThreadState,
                                               mStackFrameInfo,
                                               char_bytes, bytes.Length(),
                                               PromiseFlatCString(fileName).get(),
                                               line, &jv);
     if (!*_rval) {
         if (JS_IsExceptionPending(cx))
             JS_GetPendingException (cx, jv.address());