Backed out changeset 448365b11e37 (bug 1271653) for bustage on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2016-06-07 14:03:26 +02:00
Родитель 3cd506d57a
Коммит 829d111d40
5 изменённых файлов: 47 добавлений и 96 удалений

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

@ -15,7 +15,7 @@ checkIsArrow(true, '(a) => { bleh; }');
checkIsArrow(false, 'Object.getPrototypeOf(() => { })');
checkIsArrow(false, '(function () { })');
checkIsArrow(false, 'function f() { } f');
checkIsArrow((void 0), '({})');
checkIsArrow(false, '({})');
checkIsArrow(false, 'Math.atan2');
checkIsArrow(false, 'Function.prototype');
checkIsArrow(false, 'Function("")');

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

@ -43,7 +43,6 @@ var hDO = g2w.getOwnPropertyDescriptor('h').value;
assertEq(hDO.global, g2w);
assertEq(hDO.unwrap().global === g2w, false);
assertEq(hDO.unwrap().isBoundFunction, undefined);
assertEq(hDO.unwrap().isArrowFunction, undefined);
assertEq(hDO.unwrap().boundTargetFunction, undefined);
assertEq(hDO.unwrap().boundThis, undefined);
assertEq(hDO.unwrap().boundArguments, undefined);
@ -53,7 +52,6 @@ dbg.addDebuggee(g1);
assertEq(fDO.unwrap().script instanceof Debugger.Script, true);
assertEq(gDO.unwrap().parameterNames instanceof Array, true);
assertEq(hDO.unwrap().isBoundFunction, true);
assertEq(hDO.unwrap().isArrowFunction, false);
assertEq(hDO.unwrap().boundTargetFunction, fDO.unwrap());
assertEq(hDO.unwrap().boundThis, gDO.unwrap());
assertEq(hDO.unwrap().boundArguments.length, 2);

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

@ -222,7 +222,6 @@ typedef AutoVectorRooter<JSObject*> AutoObjectVector;
using ValueVector = JS::GCVector<JS::Value>;
using IdVector = JS::GCVector<jsid>;
using ScriptVector = JS::GCVector<JSScript*>;
using StringVector = JS::GCVector<JSString*>;
template<class Key, class Value>
class MOZ_RAII AutoHashMapRooter : protected AutoGCRooter

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

@ -7898,9 +7898,8 @@ DebuggerObject_getClass(JSContext* cx, unsigned argc, Value* vp)
static bool
DebuggerObject_getCallable(JSContext* cx, unsigned argc, Value* vp)
{
THIS_DEBUGOBJECT(cx, argc, vp, "get callable", args, object)
args.rval().setBoolean(DebuggerObject::isCallable(cx, object));
THIS_DEBUGOBJECT_REFERENT(cx, argc, vp, "get callable", args, refobj);
args.rval().setBoolean(refobj->isCallable());
return true;
}
@ -7949,32 +7948,50 @@ DebuggerObject_getDisplayName(JSContext* cx, unsigned argc, Value* vp)
static bool
DebuggerObject_getParameterNames(JSContext* cx, unsigned argc, Value* vp)
{
THIS_DEBUGOBJECT(cx, argc, vp, "get parameterNames", args, object)
if (!DebuggerObject::isDebuggeeFunction(cx, object)) {
THIS_DEBUGOBJECT_OWNER_REFERENT(cx, argc, vp, "get parameterNames", args, dbg, obj);
if (!obj->is<JSFunction>()) {
args.rval().setUndefined();
return true;
}
Rooted<StringVector> names(cx, StringVector(cx));
if (!DebuggerObject::parameterNames(cx, object, &names))
return false;
RootedFunction fun(cx, &obj->as<JSFunction>());
RootedArrayObject obj(cx, NewDenseFullyAllocatedArray(cx, names.length()));
if (!obj)
return false;
obj->ensureDenseInitializedLength(cx, 0, names.length());
for (size_t i = 0; i < names.length(); ++i) {
Value v;
if (names[i])
v = StringValue(names[i]);
else
v = UndefinedValue();
obj->setDenseElement(i, v);
/* Only hand out parameter info for debuggee functions. */
if (!dbg->observesGlobal(&fun->global())) {
args.rval().setUndefined();
return true;
}
args.rval().setObject(*obj);
RootedArrayObject result(cx, NewDenseFullyAllocatedArray(cx, fun->nargs()));
if (!result)
return false;
result->ensureDenseInitializedLength(cx, 0, fun->nargs());
if (fun->isInterpreted()) {
RootedScript script(cx, GetOrCreateFunctionScript(cx, fun));
if (!script)
return false;
MOZ_ASSERT(fun->nargs() == script->bindings.numArgs());
if (fun->nargs() > 0) {
BindingIter bi(script);
for (size_t i = 0; i < fun->nargs(); i++, bi++) {
MOZ_ASSERT(bi.argIndex() == i);
Value v;
if (bi->name()->length() == 0)
v = UndefinedValue();
else
v = StringValue(bi->name());
result->setDenseElement(i, v);
}
}
} else {
for (size_t i = 0; i < fun->nargs(); i++)
result->setDenseElement(i, UndefinedValue());
}
args.rval().setObject(*result);
return true;
}
@ -8044,14 +8061,10 @@ DebuggerObject_getEnvironment(JSContext* cx, unsigned argc, Value* vp)
static bool
DebuggerObject_getIsArrowFunction(JSContext* cx, unsigned argc, Value* vp)
{
THIS_DEBUGOBJECT(cx, argc, vp, "get isArrowFunction", args, object)
THIS_DEBUGOBJECT_REFERENT(cx, argc, vp, "get isArrowFunction", args, refobj);
if (!DebuggerObject::isDebuggeeFunction(cx, object)) {
args.rval().setUndefined();
return true;
}
args.rval().setBoolean(DebuggerObject::isArrowFunction(cx, object));
args.rval().setBoolean(refobj->is<JSFunction>()
&& refobj->as<JSFunction>().isArrow());
return true;
}
@ -8849,14 +8862,6 @@ DebuggerObject::create(JSContext* cx, HandleObject proto, HandleObject referent,
return &object;
}
/* static */ bool
DebuggerObject::isCallable(JSContext* cx, Handle<DebuggerObject*> object)
{
RootedObject referent(cx, object->referent());
return referent->isCallable();
}
/* static */ bool
DebuggerObject::isFunction(JSContext* cx, Handle<DebuggerObject*> object)
{
@ -8875,26 +8880,6 @@ DebuggerObject::isDebuggeeFunction(JSContext* cx, Handle<DebuggerObject*> object
dbg->observesGlobal(&referent->as<JSFunction>().global());
}
/* static */ bool
DebuggerObject::isBoundFunction(JSContext* cx, Handle<DebuggerObject*> object)
{
MOZ_ASSERT(isDebuggeeFunction(cx, object));
RootedFunction referent(cx, &object->referent()->as<JSFunction>());
return referent->isBoundFunction();
}
/* static */ bool
DebuggerObject::isArrowFunction(JSContext* cx, Handle<DebuggerObject*> object)
{
MOZ_ASSERT(isDebuggeeFunction(cx, object));
RootedFunction referent(cx, &object->referent()->as<JSFunction>());
return referent->isArrow();
}
/* static */ bool
DebuggerObject::isGlobal(JSContext* cx, Handle<DebuggerObject*> object)
{
@ -8947,39 +8932,13 @@ DebuggerObject::displayName(JSContext* cx, Handle<DebuggerObject*> object,
}
/* static */ bool
DebuggerObject::parameterNames(JSContext* cx, Handle<DebuggerObject*> object,
MutableHandle<StringVector> result)
DebuggerObject::isBoundFunction(JSContext* cx, Handle<DebuggerObject*> object)
{
MOZ_ASSERT(isDebuggeeFunction(cx, object));
RootedFunction referent(cx, &object->referent()->as<JSFunction>());
RootedObject referent(cx, object->referent());
if (!result.growBy(referent->nargs()))
return false;
if (referent->isInterpreted()) {
RootedScript script(cx, GetOrCreateFunctionScript(cx, referent));
if (!script)
return false;
MOZ_ASSERT(referent->nargs() == script->bindings.numArgs());
if (referent->nargs() > 0) {
BindingIter bi(script);
for (size_t i = 0; i < referent->nargs(); i++, bi++) {
MOZ_ASSERT(bi.argIndex() == i);
Value v;
if (bi->name()->length() == 0)
result[i].set(nullptr);
else
result[i].set(bi->name());
}
}
} else {
for (size_t i = 0; i < referent->nargs(); i++)
result[i].set(nullptr);
}
return true;
return referent->isBoundFunction();
}
/* static */ bool

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

@ -1051,20 +1051,15 @@ class DebuggerObject : public NativeObject
static DebuggerObject* create(JSContext* cx, HandleObject proto, HandleObject obj,
HandleNativeObject debugger);
static bool isCallable(JSContext* cx, Handle<DebuggerObject*> object);
static bool isFunction(JSContext* cx, Handle<DebuggerObject*> object);
static bool isDebuggeeFunction(JSContext* cx, Handle<DebuggerObject*> object);
static bool isBoundFunction(JSContext* cx, Handle<DebuggerObject*> object);
static bool isArrowFunction(JSContext* cx, Handle<DebuggerObject*> object);
static bool isGlobal(JSContext* cx, Handle<DebuggerObject*> object);
static bool className(JSContext* cx, Handle<DebuggerObject*> object,
MutableHandleString result);
static bool name(JSContext* cx, Handle<DebuggerObject*> object, MutableHandleString result);
static bool displayName(JSContext* cx, Handle<DebuggerObject*> object,
MutableHandleString result);
static bool parameterNames(JSContext* cx, Handle<DebuggerObject*> object,
MutableHandle<StringVector> result);
static bool isBoundFunction(JSContext* cx, Handle<DebuggerObject*> object);
static bool boundTargetFunction(JSContext* cx, Handle<DebuggerObject*> object,
MutableHandleObject result);
static bool boundThis(JSContext* cx, Handle<DebuggerObject*> object,