Bug 793577 - Implement Return<T> for direct returns of unrooted GC pointers; r=billm r=njn
Return<T> wraps GC things that are returned from accessor methods. The wrapper helps to ensure correct rooting of the returned pointer and safe access while unrooted.
This commit is contained in:
@@ -1503,6 +1503,8 @@ static JSBool
|
||||
SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
JSGenerator *gen, const Value &arg)
|
||||
{
|
||||
AssertCanGC();
|
||||
|
||||
if (gen->state == JSGEN_RUNNING || gen->state == JSGEN_CLOSING) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NESTING_GENERATOR);
|
||||
return JS_FALSE;
|
||||
@@ -1562,7 +1564,8 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
PropertyIteratorObject *enumerators = cx->enumerators;
|
||||
cx->enumerators = gen->enumerators;
|
||||
|
||||
ok = RunScript(cx, fp->script(), fp);
|
||||
RootedScript script(cx, fp->script());
|
||||
ok = RunScript(cx, script, fp);
|
||||
|
||||
gen->enumerators = cx->enumerators;
|
||||
cx->enumerators = enumerators;
|
||||
|
||||
Reference in New Issue
Block a user