Bug 1131805 part 2. Remove remaining js::GetObjectParent and JS_GetParent uses in SpiderMonkey. r=waldo

This commit is contained in:
Boris Zbarsky 2015-03-06 16:33:31 -05:00
parent 641311e52c
commit b79a81341e
6 changed files with 1 additions and 62 deletions

View File

@ -18,10 +18,3 @@ BEGIN_TEST(selfTest_NaNsAreSame)
return true;
}
END_TEST(selfTest_NaNsAreSame)
BEGIN_TEST(selfTest_globalHasNoParent)
{
CHECK(JS_GetParent(global) == nullptr);
return true;
}
END_TEST(selfTest_globalHasNoParent)

View File

@ -33,8 +33,6 @@ BEGIN_TEST(testTypedArrays)
RootedObject proto(cx);
JS_GetPrototype(cx, buffer, &proto);
CHECK(!JS_IsArrayBufferObject(proto));
RootedObject dummy(cx, JS_GetParent(proto));
CHECK(!JS_IsArrayBufferObject(dummy));
{
JS::AutoCheckCannotGC nogc;
@ -72,8 +70,6 @@ TestPlainTypedArray(JSContext *cx)
RootedObject proto(cx);
JS_GetPrototype(cx, array, &proto);
CHECK(!JS_IsTypedArrayObject(proto));
RootedObject dummy(cx, JS_GetParent(proto));
CHECK(!JS_IsTypedArrayObject(dummy));
CHECK_EQUAL(JS_GetTypedArrayLength(array), 7u);
CHECK_EQUAL(JS_GetTypedArrayByteOffset(array), 0u);

View File

@ -1807,13 +1807,6 @@ JS_PreventExtensions(JSContext *cx, JS::HandleObject obj, ObjectOpResult &result
return PreventExtensions(cx, obj, result);
}
JS_PUBLIC_API(JSObject *)
JS_GetParent(JSObject *obj)
{
MOZ_ASSERT(!obj->is<ScopeObject>());
return obj->getParent();
}
JS_PUBLIC_API(JSObject *)
JS_GetConstructor(JSContext *cx, HandleObject proto)
{

View File

@ -2242,9 +2242,6 @@ JS_GetPrototype(JSContext *cx, JS::HandleObject obj, JS::MutableHandleObject pro
extern JS_PUBLIC_API(bool)
JS_SetPrototype(JSContext *cx, JS::HandleObject obj, JS::HandleObject proto);
extern JS_PUBLIC_API(JSObject *)
JS_GetParent(JSObject *obj);
extern JS_PUBLIC_API(JSObject *)
JS_GetConstructor(JSContext *cx, JS::Handle<JSObject*> proto);

View File

@ -689,14 +689,6 @@ IsCallObject(JSObject *obj);
JS_FRIEND_API(bool)
CanAccessObjectShape(JSObject *obj);
inline JSObject *
GetObjectParent(JSObject *obj)
{
MOZ_ASSERT(!IsScopeObject(obj));
MOZ_ASSERT(CanAccessObjectShape(obj));
return reinterpret_cast<shadow::Object*>(obj)->shape->base->parent;
}
static MOZ_ALWAYS_INLINE JSCompartment *
GetObjectCompartment(JSObject *obj)
{

View File

@ -2584,7 +2584,7 @@ Clone(JSContext *cx, unsigned argc, jsval *vp)
if (!JS_ValueToObject(cx, args[1], &parent))
return false;
} else {
parent = JS_GetParent(&args.callee());
parent = js::GetGlobalForObjectCrossCompartment(&args.callee());
}
// Should it worry us that we might be getting with wrappers
@ -3237,34 +3237,6 @@ Elapsed(JSContext *cx, unsigned argc, jsval *vp)
return false;
}
static bool
Parent(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() != 1) {
JS_ReportError(cx, "Wrong number of arguments");
return false;
}
Value v = args[0];
if (v.isPrimitive()) {
JS_ReportError(cx, "Only objects have parents!");
return false;
}
Rooted<JSObject*> parent(cx, JS_GetParent(&v.toObject()));
/* Outerize if necessary. */
if (parent) {
parent = GetOuterObject(cx, parent);
if (!parent)
return false;
}
args.rval().setObjectOrNull(parent);
return true;
}
static bool
Compile(JSContext *cx, unsigned argc, jsval *vp)
{
@ -4932,10 +4904,6 @@ static const JSFunctionSpecWithHelp fuzzing_unsafe_functions[] = {
" Get a self-hosted value by its name. Note that these values don't get \n"
" cached, so repeatedly getting the same value creates multiple distinct clones."),
JS_FN_HELP("parent", Parent, 1, 0,
"parent(obj)",
" Returns the parent of obj."),
JS_FN_HELP("line2pc", LineToPC, 0, 0,
"line2pc([fun,] line)",
" Map line number to PC."),