Backed out changeset 9eec5a814230 (bug 1294013)

This commit is contained in:
Iris Hsiao 2016-08-17 18:50:34 +08:00
parent 91d9cf2da1
commit 82b995f603
2 changed files with 15 additions and 37 deletions

View File

@ -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);

View File

@ -1514,28 +1514,6 @@ ParseResumptionValue(JSContext* cx, HandleValue rval, JSTrapStatus* statusp, Mut
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,
@ -1550,12 +1528,25 @@ Debugger::parseResumptionValueHelper(Maybe<AutoCompartment>& ac, bool ok, const
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();