Backed out changeset 8ead64ff09e8 (bug 1294013)
authorIris Hsiao <ihsiao@mozilla.com>
Wed, 17 Aug 2016 18:50:40 +0800
changeset 309855 7e2cfb44947efe8028d4b6cc6f072af56495f0bc
parent 309854 5471793e8e65ac52c8d33a67c944f319d028005d
child 309856 e232e2267d5f5fb009cb5d3d1a446e5b28ae8915
push id20333
push userkwierso@gmail.com
push dateThu, 18 Aug 2016 00:26:40 +0000
treeherderfx-team@11c94ec980d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1294013
milestone51.0a1
backs out8ead64ff09e8ef5004981be47c7b4b7cf099e30d
Backed out changeset 8ead64ff09e8 (bug 1294013)
js/src/vm/Debugger.cpp
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1480,32 +1480,22 @@ GetStatusProperty(JSContext* cx, HandleO
         *statusOut = status;
         if (!GetProperty(cx, obj, obj, name, vp))
             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;
-    }
-
+ParseResumptionValueAsObject(JSContext* cx, HandleValue rv, JSTrapStatus* statusp,
+                             MutableHandleValue vp)
+{
     int hits = 0;
-    if (rval.isObject()) {
-        RootedObject obj(cx, &rval.toObject());
+    if (rv.isObject()) {
+        RootedObject obj(cx, &rv.toObject());
         if (!GetStatusProperty(cx, obj, cx->names().return_, JSTRAP_RETURN, statusp, vp, &hits))
             return false;
         if (!GetStatusProperty(cx, obj, cx->names().throw_, JSTRAP_THROW, statusp, vp, &hits))
             return false;
     }
 
     if (hits != 1) {
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_BAD_RESUMPTION);
@@ -1517,22 +1507,31 @@ ParseResumptionValue(JSContext* cx, Hand
 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);
-    if (!ParseResumptionValue(cx, rvRoot, &status, &v) ||
+    RootedValue rvRoot(cx, rv);
+
+    if (!ParseResumptionValueAsObject(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)) {