Bug 880917 - Add an API to mutate the version on the compartment and use it from the shells. r=luke

This commit is contained in:
Bobby Holley
2013-06-29 09:11:19 -06:00
parent 2e61f1496e
commit 3897f057e6
5 changed files with 28 additions and 9 deletions

View File

@@ -305,10 +305,10 @@ Version(JSContext *cx,
JS::Value *vp)
{
JS::Value *argv = JS_ARGV(cx, vp);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(JS_GetVersion(cx)));
if (argc > 0 && JSVAL_IS_INT(argv[0]))
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(JS_SetVersion(cx, JSVersion(JSVAL_TO_INT(argv[0])))));
else
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(JS_GetVersion(cx)));
JS_SetVersionForCompartment(js::GetContextCompartment(cx),
JSVersion(JSVAL_TO_INT(argv[0])));
return JS_TRUE;
}