Bug 1141865 - Part 2: Plumb new.target on the stack and make it accessible to JSNatives. (r=jorendorff, r=jandem, r=shu)

This commit is contained in:
Eric Faust
2015-06-01 15:03:32 -07:00
parent dcec8a1f20
commit 241e7a2be7
44 changed files with 583 additions and 169 deletions

View File

@@ -448,16 +448,14 @@ GetCustomIterator(JSContext* cx, HandleObject obj, unsigned flags, MutableHandle
if (!Invoke(cx, ObjectValue(*obj), rval, 1, &arg, &rval))
return false;
if (rval.isPrimitive()) {
/*
* We are always coming from js::ValueToIterator, and we are no longer on
* trace, so the object we are iterating over is on top of the stack (-1).
*/
// Ignore the stack when throwing. We can't tell whether we were
// supposed to skip over a new.target or not.
JSAutoByteString bytes;
if (!AtomToPrintableString(cx, name, &bytes))
return false;
RootedValue val(cx, ObjectValue(*obj));
ReportValueError2(cx, JSMSG_BAD_TRAP_RETURN_VALUE,
-1, val, nullptr, bytes.ptr());
JSDVG_IGNORE_STACK, val, nullptr, bytes.ptr());
return false;
}
objp.set(&rval.toObject());