1320408 - Part 5: Change JSObject::constructorDisplayAtom to static method.

This commit is contained in:
Gaming4JC 2019-06-08 19:23:13 -04:00 • committed by Roy Tam
commit 6a21912a94
4 changed files with 8 additions and 7 deletions

View file

@ -3319,7 +3319,8 @@ GetConstructorName(JSContext* cx, unsigned argc, Value* vp)
}
RootedAtom name(cx);
if (!args[0].toObject().constructorDisplayAtom(cx, &name))
RootedObject obj(cx, &args[0].toObject());
if (!JSObject::constructorDisplayAtom(cx, obj, &name))
return false;
if (name) {

View file

@ -3849,11 +3849,10 @@ displayAtomFromObjectGroup(ObjectGroup& group)
return script->function()->displayAtom();
}
bool
JSObject::constructorDisplayAtom(JSContext* cx, js::MutableHandleAtom name)
/* static */ bool
JSObject::constructorDisplayAtom(JSContext* cx, js::HandleObject obj, js::MutableHandleAtom name)
{
RootedObject self(cx, this); // Temporary change.
ObjectGroup *g = JSObject::getGroup(cx, self);
ObjectGroup *g = JSObject::getGroup(cx, obj);
if (!g)
return false;

View file

@ -288,7 +288,8 @@ class JSObject : public js::gc::Cell
* If this object was instantiated with `new Ctor`, return the constructor's
* display atom. Otherwise, return nullptr.
*/
bool constructorDisplayAtom(JSContext* cx, js::MutableHandleAtom name);
static bool constructorDisplayAtom(JSContext* cx, js::HandleObject obj,
js::MutableHandleAtom name);
/*
* The same as constructorDisplayAtom above, however if this object has a

View file

@ -2234,7 +2234,7 @@ Debugger::appendAllocationSite(JSContext* cx, HandleObject obj, HandleSavedFrame
RootedAtom ctorName(cx);
{
AutoCompartment ac(cx, obj);
if (!obj->constructorDisplayAtom(cx, &ctorName))
if (!JSObject::constructorDisplayAtom(cx, obj, &ctorName))
return false;
}