Bug 1163520: Make IsInternalFunctionObject take its argument by reference, as it must not be nullptr. r=shu

This commit is contained in:
Jim Blandy 2015-06-04 11:58:10 -07:00
parent a1ffa1355a
commit c7207ac32f
4 changed files with 9 additions and 9 deletions

View File

@ -31,7 +31,7 @@ BEGIN_TEST(testLookup_bug522590)
CHECK(r.isObject());
JSObject* funobj = &r.toObject();
CHECK(funobj->is<JSFunction>());
CHECK(!js::IsInternalFunctionObject(funobj));
CHECK(!js::IsInternalFunctionObject(*funobj));
return true;
}

View File

@ -374,7 +374,7 @@ ResolveInterpretedFunctionPrototype(JSContext* cx, HandleFunction fun, HandleId
// Assert that fun is not a compiler-created function object, which
// must never leak to script or embedding code and then be mutated.
// Also assert that fun is not bound, per the ES5 15.3.4.5 ref above.
MOZ_ASSERT(!IsInternalFunctionObject(fun));
MOZ_ASSERT(!IsInternalFunctionObject(*fun));
MOZ_ASSERT(!fun->isBoundFunction());
// Make the prototype object an instance of Object with the same parent as
@ -461,7 +461,7 @@ fun_resolve(JSContext* cx, HandleObject obj, HandleId id, bool* resolvedp)
bool isLength = JSID_IS_ATOM(id, cx->names().length);
if (isLength || JSID_IS_ATOM(id, cx->names().name)) {
MOZ_ASSERT(!IsInternalFunctionObject(obj));
MOZ_ASSERT(!IsInternalFunctionObject(*obj));
RootedValue v(cx);

View File

@ -593,12 +593,12 @@ ToPrimitive(JSContext* cx, JSType preferredType, MutableHandleValue vp)
* or embedding code.
*/
inline bool
IsInternalFunctionObject(JSObject* funobj)
IsInternalFunctionObject(JSObject& funobj)
{
JSFunction* fun = &funobj->as<JSFunction>();
MOZ_ASSERT_IF(fun->isLambda(),
fun->isInterpreted() || fun->isAsmJSNative());
return fun->isLambda() && fun->isInterpreted() && !fun->environment();
JSFunction& fun = funobj.as<JSFunction>();
MOZ_ASSERT_IF(fun.isLambda(),
fun.isInterpreted() || fun.isAsmJSNative());
return fun.isLambda() && fun.isInterpreted() && !fun.environment();
}
typedef AutoVectorRooter<PropertyDescriptor> AutoPropertyDescriptorVector;

View File

@ -85,7 +85,7 @@ Node::exposeToJS() const
JSObject& obj = *as<JSObject>();
if (obj.is<js::ScopeObject>()) {
v.setUndefined();
} else if (obj.is<JSFunction>() && js::IsInternalFunctionObject(&obj)) {
} else if (obj.is<JSFunction>() && js::IsInternalFunctionObject(obj)) {
v.setUndefined();
} else {
v.setObject(obj);