Backed out changeset 9eec5a814230 (bug 1294013)
authorIris Hsiao <ihsiao@mozilla.com>
Wed, 17 Aug 2016 18:50:34 +0800
changeset 309732 5471793e8e65
parent 309731 33c91255b886
child 309733 7e2cfb44947e
push id80681
push userihsiao@mozilla.com
push dateWed, 17 Aug 2016 10:53:01 +0000
treeherdermozilla-inbound@7e2cfb44947e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1294013
milestone51.0a1
backs out9eec5a814230
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
Backed out changeset 9eec5a814230 (bug 1294013)
js/src/jit-test/tests/debug/class-08.js
js/src/vm/Debugger.cpp
deleted file mode 100644
--- a/js/src/jit-test/tests/debug/class-08.js
+++ /dev/null
@@ -1,13 +0,0 @@
-let g = newGlobal();
-let dbg = Debugger(g);
-dbg.onDebuggerStatement = function() {
-    // Force the constructor to return undefined, which should be replaced with
-    // |this| if the latter has been initialized.
-    return { return: undefined };
-}
-
-assertEq(g.eval(`
-    new (class extends class {} {
-        constructor() { super(); this.foo = 42; debugger; }
-    })
-`).foo, 42);
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1509,58 +1509,49 @@ ParseResumptionValue(JSContext* cx, Hand
 
     if (hits != 1) {
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_BAD_RESUMPTION);
         return false;
     }
     return true;
 }
 
-static bool
-CheckResumptionValue(JSContext* cx, AbstractFramePtr frame, const Maybe<HandleValue>& maybeThisv,
-                     JSTrapStatus status, MutableHandleValue vp)
-{
-    if (maybeThisv.isSome()) {
-        const HandleValue& thisv = maybeThisv.ref();
-        if (status == JSTRAP_RETURN && vp.isPrimitive()) {
-            if (vp.isUndefined()) {
-                if (thisv.isMagic(JS_UNINITIALIZED_LEXICAL)) {
-                    return ThrowUninitializedThis(cx, frame);
-                }
-
-                vp.set(thisv);
-            } else {
-                ReportValueError(cx, JSMSG_BAD_DERIVED_RETURN, JSDVG_IGNORE_STACK, vp, nullptr);
-                return false;
-            }
-        }
-    }
-    return true;
-}
-
 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);
 
     JSContext* cx = ac->context()->asJSContext();
     RootedValue rvRoot(cx, rv);
     JSTrapStatus status = JSTRAP_CONTINUE;
     RootedValue v(cx);
     if (!ParseResumptionValue(cx, rvRoot, &status, &v) ||
-        !unwrapDebuggeeValue(cx, &v) ||
-        !CheckResumptionValue(cx, frame, thisVForCheck, 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)) {
+                MOZ_ALWAYS_FALSE(ThrowUninitializedThis(cx, frame));
+                return handleUncaughtException(ac, vp, callHook, thisVForCheck, frame);
+            }
+
+            v = thisVForCheck.ref();
+        } else {
+            ReportValueError(cx, JSMSG_BAD_DERIVED_RETURN, JSDVG_IGNORE_STACK, v, nullptr);
+            return handleUncaughtException(ac, vp, callHook, thisVForCheck, frame);
+        }
+    }
+
     ac.reset();
     if (!cx->compartment()->wrap(cx, &v)) {
         vp.setUndefined();
         return JSTRAP_ERROR;
     }
     vp.set(v);
 
     return status;