Merge m-c to ionmonkey

This commit is contained in:
Jan de Mooij
2012-06-08 11:18:39 +02:00
1047 changed files with 60079 additions and 10143 deletions

View File

@@ -837,12 +837,13 @@ iterator_next(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
bool ok;
RootedObject obj(cx, NonGenericMethodGuard(cx, args, iterator_next, &IteratorClass, &ok));
if (!obj)
return ok;
RootedObject thisObj(cx);
if (!NonGenericMethodGuard(cx, args, iterator_next, &IteratorClass, thisObj.address()))
return false;
if (!thisObj)
return true;
if (!js_IteratorMore(cx, obj, &args.rval()))
if (!js_IteratorMore(cx, thisObj, &args.rval()))
return false;
if (!args.rval().toBoolean()) {
@@ -850,7 +851,7 @@ iterator_next(JSContext *cx, unsigned argc, Value *vp)
return false;
}
return js_IteratorNext(cx, obj, &args.rval());
return js_IteratorNext(cx, thisObj, &args.rval());
}
#define JSPROP_ROPERM (JSPROP_READONLY | JSPROP_PERMANENT)
@@ -894,7 +895,7 @@ js::ValueToIterator(JSContext *cx, unsigned flags, Value *vp)
* but it's "web JS" compatible. ES5 fixed for-in to match this de-facto
* standard.
*/
if ((flags & JSITER_ENUMERATE)) {
if (flags & JSITER_ENUMERATE) {
if (!js_ValueToObjectOrNull(cx, *vp, obj.address()))
return false;
/* fall through */
@@ -1591,12 +1592,13 @@ generator_op(JSContext *cx, Native native, JSGeneratorOp op, Value *vp, unsigned
{
CallArgs args = CallArgsFromVp(argc, vp);
bool ok;
JSObject *obj = NonGenericMethodGuard(cx, args, native, &GeneratorClass, &ok);
if (!obj)
return ok;
JSObject *thisObj;
if (!NonGenericMethodGuard(cx, args, native, &GeneratorClass, &thisObj))
return false;
if (!thisObj)
return true;
JSGenerator *gen = (JSGenerator *) obj->getPrivate();
JSGenerator *gen = (JSGenerator *) thisObj->getPrivate();
if (!gen) {
/* This happens when obj is the generator prototype. See bug 352885. */
goto closed_generator;
@@ -1639,7 +1641,7 @@ generator_op(JSContext *cx, Native native, JSGeneratorOp op, Value *vp, unsigned
}
bool undef = ((op == JSGENOP_SEND || op == JSGENOP_THROW) && args.length() != 0);
if (!SendToGenerator(cx, op, obj, gen, undef ? args[0] : UndefinedValue()))
if (!SendToGenerator(cx, op, thisObj, gen, undef ? args[0] : UndefinedValue()))
return false;
args.rval() = gen->fp->returnValue();