mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
1333143 - Self-host Object.prototype.valueOf.
This commit is contained in:
parent
5d929d8c47
commit
337cdbd0ce
7 changed files with 26 additions and 19 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include "frontend/Parser.h"
|
||||
#include "gc/Policy.h"
|
||||
#include "js/MemoryMetrics.h"
|
||||
#include "vm/SelfHosting.h"
|
||||
#include "vm/StringBuffer.h"
|
||||
#include "vm/Time.h"
|
||||
#include "vm/TypedArrayObject.h"
|
||||
|
|
@ -7464,6 +7465,20 @@ GetDataProperty(JSContext* cx, HandleValue objVal, ImmutablePropertyNamePtr fiel
|
|||
return GetDataProperty(cx, objVal, fieldHandle, v);
|
||||
}
|
||||
|
||||
static bool
|
||||
HasObjectValueOfMethodPure(JSObject* obj, JSContext* cx)
|
||||
{
|
||||
Value v;
|
||||
if (!GetPropertyPure(cx, obj, NameToId(cx->names().valueOf), &v))
|
||||
return false;
|
||||
|
||||
JSFunction* fun;
|
||||
if (!IsFunctionObject(v, &fun))
|
||||
return false;
|
||||
|
||||
return IsSelfHostedFunctionWithName(fun, cx->names().Object_valueOf);
|
||||
}
|
||||
|
||||
static bool
|
||||
HasPureCoercion(JSContext* cx, HandleValue v)
|
||||
{
|
||||
|
|
@ -7480,7 +7495,7 @@ HasPureCoercion(JSContext* cx, HandleValue v)
|
|||
// most apps have been built with newer Emscripten.
|
||||
if (v.toObject().is<JSFunction>() &&
|
||||
HasNoToPrimitiveMethodPure(&v.toObject(), cx) &&
|
||||
HasNativeMethodPure(&v.toObject(), cx->names().valueOf, obj_valueOf, cx) &&
|
||||
HasObjectValueOfMethodPure(&v.toObject(), cx) &&
|
||||
HasNativeMethodPure(&v.toObject(), cx->names().toString, fun_toString, cx))
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue