Bug 705423 - ensureTypes in ArgSetter (r=billm)

--HG--
extra : rebase_source : f3c1553625a9a1a41c00cabddb2c3a6f4d267aa8
This commit is contained in:
Luke Wagner 2012-06-08 13:46:56 -07:00
parent c1b02c6f63
commit 12081c2581
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,19 @@
gczeal(1);
var g = newGlobal('new-compartment');
g.eval("\
var f = function(x) { \
arg = arguments; \
fun = function() { return x }; \
} \
");
g.f(3);
g.f = null;
assertEq(g.fun(), 3);
assertEq(g.arg[0], 3);
gc();
g.arg[0] = 9;
assertEq(g.fun(), 9);
assertEq(g.arg[0], 9);

View File

@ -181,8 +181,11 @@ ArgSetter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, Value *vp
unsigned arg = unsigned(JSID_TO_INT(id));
if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg)) {
argsobj.setElement(arg, *vp);
if (arg < script->function()->nargs)
if (arg < script->function()->nargs) {
if (!script->ensureHasTypes(cx))
return false;
types::TypeScript::SetArgument(cx, script, arg, *vp);
}
return true;
}
} else {