903389 - Fix uses of ClassMethodIsNative.

This commit is contained in:
Gaming4JC 2019-06-08 17:11:49 -04:00 committed by Roy Tam
commit 2391e18681
8 changed files with 73 additions and 71 deletions

View file

@ -7478,10 +7478,10 @@ HasPureCoercion(JSContext* cx, HandleValue v)
// coercions are not observable and coercion via ToNumber/ToInt32
// definitely produces NaN/0. We should remove this special case later once
// most apps have been built with newer Emscripten.
jsid toString = NameToId(cx->names().toString);
if (v.toObject().is<JSFunction>() &&
HasObjectValueOf(&v.toObject(), cx) &&
ClassMethodIsNative(cx, &v.toObject().as<JSFunction>(), &JSFunction::class_, toString, fun_toString))
HasNoToPrimitiveMethodPure(&v.toObject(), cx) &&
HasNativeMethodPure(&v.toObject(), cx->names().valueOf, obj_valueOf, cx) &&
HasNativeMethodPure(&v.toObject(), cx->names().toString, fun_toString, cx))
{
return true;
}