mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-28 18:28:38 +09:00
1320408 - Part 14: Change some GlobalObject methods to static method.
This commit is contained in:
parent
b237ae6437
commit
cc8cb910dd
37 changed files with 287 additions and 259 deletions
|
|
@ -337,7 +337,7 @@ GlobalObject::createInternal(JSContext* cx, const Class* clasp)
|
|||
return global;
|
||||
}
|
||||
|
||||
GlobalObject*
|
||||
/* static */ GlobalObject*
|
||||
GlobalObject::new_(JSContext* cx, const Class* clasp, JSPrincipals* principals,
|
||||
JS::OnNewGlobalHookOption hookOption,
|
||||
const JS::CompartmentOptions& options)
|
||||
|
|
@ -398,7 +398,7 @@ GlobalObject::emptyGlobalScope() const
|
|||
GlobalObject::getOrCreateEval(JSContext* cx, Handle<GlobalObject*> global,
|
||||
MutableHandleObject eval)
|
||||
{
|
||||
if (!global->getOrCreateObjectPrototype(cx))
|
||||
if (!getOrCreateObjectPrototype(cx, global))
|
||||
return false;
|
||||
eval.set(&global->getSlot(EVAL).toObject());
|
||||
return true;
|
||||
|
|
@ -573,7 +573,7 @@ GlobalObject::warnOnceAbout(JSContext* cx, HandleObject obj, WarnOnceFlag flag,
|
|||
return true;
|
||||
}
|
||||
|
||||
JSFunction*
|
||||
/* static */ JSFunction*
|
||||
GlobalObject::createConstructor(JSContext* cx, Native ctor, JSAtom* nameArg, unsigned length,
|
||||
gc::AllocKind kind, const JSJitInfo* jitInfo)
|
||||
{
|
||||
|
|
@ -601,22 +601,21 @@ CreateBlankProto(JSContext* cx, const Class* clasp, HandleObject proto, HandleOb
|
|||
return blankProto;
|
||||
}
|
||||
|
||||
NativeObject*
|
||||
GlobalObject::createBlankPrototype(JSContext* cx, const Class* clasp)
|
||||
/* static */ NativeObject*
|
||||
GlobalObject::createBlankPrototype(JSContext* cx, Handle<GlobalObject*> global, const Class* clasp)
|
||||
{
|
||||
Rooted<GlobalObject*> self(cx, this);
|
||||
RootedObject objectProto(cx, getOrCreateObjectPrototype(cx));
|
||||
RootedObject objectProto(cx, getOrCreateObjectPrototype(cx, global));
|
||||
if (!objectProto)
|
||||
return nullptr;
|
||||
|
||||
return CreateBlankProto(cx, clasp, objectProto, self);
|
||||
return CreateBlankProto(cx, clasp, objectProto, global);
|
||||
}
|
||||
|
||||
NativeObject*
|
||||
GlobalObject::createBlankPrototypeInheriting(JSContext* cx, const Class* clasp, HandleObject proto)
|
||||
/* static */ NativeObject*
|
||||
GlobalObject::createBlankPrototypeInheriting(JSContext* cx, Handle<GlobalObject*> global,
|
||||
const Class* clasp, HandleObject proto)
|
||||
{
|
||||
Rooted<GlobalObject*> self(cx, this);
|
||||
return CreateBlankProto(cx, clasp, proto, self);
|
||||
return CreateBlankProto(cx, clasp, proto, global);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -729,21 +728,20 @@ GlobalObject::hasRegExpStatics() const
|
|||
return !getSlot(REGEXP_STATICS).isUndefined();
|
||||
}
|
||||
|
||||
RegExpStatics*
|
||||
GlobalObject::getRegExpStatics(ExclusiveContext* cx) const
|
||||
/* static */ RegExpStatics*
|
||||
GlobalObject::getRegExpStatics(ExclusiveContext* cx, Handle<GlobalObject*> global)
|
||||
{
|
||||
MOZ_ASSERT(cx);
|
||||
Rooted<GlobalObject*> self(cx, const_cast<GlobalObject*>(this));
|
||||
|
||||
RegExpStaticsObject* resObj = nullptr;
|
||||
const Value& val = this->getSlot(REGEXP_STATICS);
|
||||
const Value& val = global->getSlot(REGEXP_STATICS);
|
||||
if (!val.isObject()) {
|
||||
MOZ_ASSERT(val.isUndefined());
|
||||
resObj = RegExpStatics::create(cx, self);
|
||||
resObj = RegExpStatics::create(cx, global);
|
||||
if (!resObj)
|
||||
return nullptr;
|
||||
|
||||
self->initSlot(REGEXP_STATICS, ObjectValue(*resObj));
|
||||
global->initSlot(REGEXP_STATICS, ObjectValue(*resObj));
|
||||
} else {
|
||||
resObj = &val.toObject().as<RegExpStaticsObject>();
|
||||
}
|
||||
|
|
@ -866,7 +864,7 @@ GlobalObject::addIntrinsicValue(JSContext* cx, Handle<GlobalObject*> global,
|
|||
/* static */ bool
|
||||
GlobalObject::ensureModulePrototypesCreated(JSContext *cx, Handle<GlobalObject*> global)
|
||||
{
|
||||
return global->getOrCreateObject(cx, MODULE_PROTO, initModuleProto) &&
|
||||
global->getOrCreateObject(cx, IMPORT_ENTRY_PROTO, initImportEntryProto) &&
|
||||
global->getOrCreateObject(cx, EXPORT_ENTRY_PROTO, initExportEntryProto);
|
||||
return getOrCreateObject(cx, global, MODULE_PROTO, initModuleProto) &&
|
||||
getOrCreateObject(cx, global, IMPORT_ENTRY_PROTO, initImportEntryProto) &&
|
||||
getOrCreateObject(cx, global, EXPORT_ENTRY_PROTO, initExportEntryProto);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue