Bug 963879 - Part 3: Add Debugger.Environment.prototype.optimizedOut. (r=jimb)

This commit is contained in:
Shu-yu Guo 2015-01-14 15:18:43 -08:00
Родитель d3357df3ed
Коммит 6a64fe7505
2 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -94,6 +94,12 @@ properties from its prototype:
[`Debugger.Object`][object] instance referring to <i>f</i>. Otherwise,
this property's value is `null`.
`optimizedOut`
: True if this environment is optimized out. False otherwise. For example,
functions whose locals are never aliased may present optimized-out
environments. When true, `getVariable` returns an ordinary JavaScript
object whose `optimizedOut` property is true on all bindings, and
`setVariable` throws a `ReferenceError`.
## Function Properties of the Debugger.Environment Prototype Object

Просмотреть файл

@ -7259,6 +7259,22 @@ DebuggerEnv_getInspectable(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static bool
DebuggerEnv_getOptimizedOut(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
NativeObject *envobj = DebuggerEnv_checkThis(cx, args, "get optimizedOut", false);
if (!envobj)
return false;
Rooted<Env*> env(cx, static_cast<Env *>(envobj->getPrivate()));
MOZ_ASSERT(env);
MOZ_ASSERT(!env->is<ScopeObject>());
args.rval().setBoolean(env->is<DebugScopeObject>() &&
env->as<DebugScopeObject>().isOptimizedOut());
return true;
}
static bool
DebuggerEnv_names(JSContext *cx, unsigned argc, Value *vp)
{
@ -7404,6 +7420,7 @@ static const JSPropertySpec DebuggerEnv_properties[] = {
JS_PSG("parent", DebuggerEnv_getParent, 0),
JS_PSG("callee", DebuggerEnv_getCallee, 0),
JS_PSG("inspectable", DebuggerEnv_getInspectable, 0),
JS_PSG("optimizedOut", DebuggerEnv_getOptimizedOut, 0),
JS_PS_END
};