summaryrefslogtreecommitdiffstats
path: root/js/src/jsapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r--js/src/jsapi.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index 4e094adff..28282e384 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1022,7 +1022,7 @@ JS_ResolveStandardClass(JSContext* cx, HandleObject obj, HandleId id, bool* reso
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id);
- Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
+ Handle<GlobalObject*> global = obj.as<GlobalObject>();
*resolved = false;
if (!JSID_IS_ATOM(id))
@@ -1066,10 +1066,7 @@ JS_ResolveStandardClass(JSContext* cx, HandleObject obj, HandleId id, bool* reso
// more way: its prototype chain is lazily initialized. That is,
// global->getProto() might be null right now because we haven't created
// Object.prototype yet. Force it now.
- if (!global->getOrCreateObjectPrototype(cx))
- return false;
-
- return true;
+ return GlobalObject::getOrCreateObjectPrototype(cx, global);
}
JS_PUBLIC_API(bool)
@@ -1102,8 +1099,7 @@ JS_EnumerateStandardClasses(JSContext* cx, HandleObject obj)
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj);
- MOZ_ASSERT(obj->is<GlobalObject>());
- Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
+ Handle<GlobalObject*> global = obj.as<GlobalObject>();
return GlobalObject::initStandardClasses(cx, global);
}
@@ -1159,7 +1155,8 @@ JS_GetObjectPrototype(JSContext* cx, HandleObject forObj)
{
CHECK_REQUEST(cx);
assertSameCompartment(cx, forObj);
- return forObj->global().getOrCreateObjectPrototype(cx);
+ Rooted<GlobalObject*> global(cx, &forObj->global());
+ return GlobalObject::getOrCreateObjectPrototype(cx, global);
}
JS_PUBLIC_API(JSObject*)
@@ -1167,7 +1164,8 @@ JS_GetFunctionPrototype(JSContext* cx, HandleObject forObj)
{
CHECK_REQUEST(cx);
assertSameCompartment(cx, forObj);
- return forObj->global().getOrCreateFunctionPrototype(cx);
+ Rooted<GlobalObject*> global(cx, &forObj->global());
+ return GlobalObject::getOrCreateFunctionPrototype(cx, global);
}
JS_PUBLIC_API(JSObject*)
@@ -6015,7 +6013,8 @@ JS_SetRegExpInput(JSContext* cx, HandleObject obj, HandleString input)
CHECK_REQUEST(cx);
assertSameCompartment(cx, input);
- RegExpStatics* res = obj->as<GlobalObject>().getRegExpStatics(cx);
+ Handle<GlobalObject*> global = obj.as<GlobalObject>();
+ RegExpStatics* res = GlobalObject::getRegExpStatics(cx, global);
if (!res)
return false;
@@ -6030,7 +6029,8 @@ JS_ClearRegExpStatics(JSContext* cx, HandleObject obj)
CHECK_REQUEST(cx);
MOZ_ASSERT(obj);
- RegExpStatics* res = obj->as<GlobalObject>().getRegExpStatics(cx);
+ Handle<GlobalObject*> global = obj.as<GlobalObject>();
+ RegExpStatics* res = GlobalObject::getRegExpStatics(cx, global);
if (!res)
return false;
@@ -6045,7 +6045,8 @@ JS_ExecuteRegExp(JSContext* cx, HandleObject obj, HandleObject reobj, char16_t*
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
- RegExpStatics* res = obj->as<GlobalObject>().getRegExpStatics(cx);
+ Handle<GlobalObject*> global = obj.as<GlobalObject>();
+ RegExpStatics* res = GlobalObject::getRegExpStatics(cx, global);
if (!res)
return false;