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

--HG--
extra : rebase_source : 31a5457c85adf992f5ad9c7a384e5cf9aa173d75
This commit is contained in:
Jim Blandy 2015-06-04 11:58:10 -07:00
parent 4bc496d2d3
commit fe79284495
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);