Bug 1294013 - [jsdbg2] Disentangle parsing and checking of resumption values. r=jimb
authorEddy Bruel <ejpbruel>
Thu, 11 Aug 2016 10:50:00 +0800
changeset 309833 5b0e2ac69f72
parent 309832 6ebd9f34c08e
child 309834 d618b94e6612
push id30570
push userkwierso@gmail.com
push date2016-08-17 23:38 +0000
treeherdermozilla-central@a70835fe9f55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1294013
milestone51.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 1294013 - [jsdbg2] Disentangle parsing and checking of resumption values. r=jimb CLOSED TREE
js/src/vm/Debugger.cpp
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1499,39 +1499,45 @@ ParseResumptionValueAsObject(JSContext* 
 
     if (hits != 1) {
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_BAD_RESUMPTION);
         return false;
     }
     return true;
 }
 
+static bool
+ParseResumptionValue(JSContext* cx, HandleValue rval, JSTrapStatus* statusp, MutableHandleValue vp)
+{
+    if (rval.isUndefined()) {
+        *statusp = JSTRAP_CONTINUE;
+        vp.setUndefined();
+        return true;
+    }
+    if (rval.isNull()) {
+        *statusp = JSTRAP_ERROR;
+        vp.setUndefined();
+        return true;
+    }
+    return ParseResumptionValueAsObject(cx, rval, statusp, vp);
+}
+
 JSTrapStatus
 Debugger::parseResumptionValueHelper(Maybe<AutoCompartment>& ac, bool ok, const Value& rv,
                                      const Maybe<HandleValue>& thisVForCheck, AbstractFramePtr frame,
                                      MutableHandleValue vp, bool callHook)
 {
-    vp.setUndefined();
     if (!ok)
         return handleUncaughtException(ac, vp, callHook, thisVForCheck, frame);
-    if (rv.isUndefined()) {
-        ac.reset();
-        return JSTRAP_CONTINUE;
-    }
-    if (rv.isNull()) {
-        ac.reset();
-        return JSTRAP_ERROR;
-    }
 
     JSContext* cx = ac->context()->asJSContext();
+    RootedValue rvRoot(cx, rv);
     JSTrapStatus status = JSTRAP_CONTINUE;
     RootedValue v(cx);
-    RootedValue rvRoot(cx, rv);
-
-    if (!ParseResumptionValueAsObject(cx, rvRoot, &status, &v) ||
+    if (!ParseResumptionValue(cx, rvRoot, &status, &v) ||
         !unwrapDebuggeeValue(cx, &v))
     {
         return handleUncaughtException(ac, vp, callHook, thisVForCheck, frame);
     }
 
     if (status == JSTRAP_RETURN && thisVForCheck.isSome() && v.isPrimitive()) {
         if (v.isUndefined()) {
             if (thisVForCheck.ref().isMagic(JS_UNINITIALIZED_LEXICAL)) {