mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 858101 - Run the DefaultValue algorithm directly on the wrapper for Xrays. r=mrbkap
This commit is contained in:
parent
9755fce1d6
commit
c72d0f8113
@ -1717,6 +1717,11 @@ SetObjectMetadata(JSContext *cx, JSHandleObject obj, JSHandleObject metadata);
|
||||
JS_FRIEND_API(JSObject *)
|
||||
GetObjectMetadata(JSObject *obj);
|
||||
|
||||
/* ES5 8.12.8. */
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp);
|
||||
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
|
@ -4609,7 +4609,7 @@ MaybeCallMethod(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue
|
||||
return Invoke(cx, ObjectValue(*obj), vp, 0, NULL, vp.address());
|
||||
}
|
||||
|
||||
JSBool
|
||||
JS_FRIEND_API(JSBool)
|
||||
js::DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp)
|
||||
{
|
||||
JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
|
||||
|
@ -203,10 +203,6 @@ DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, JSBool *succeeded);
|
||||
|
||||
} /* namespace js::baseops */
|
||||
|
||||
/* ES5 8.12.8. */
|
||||
extern JSBool
|
||||
DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp);
|
||||
|
||||
extern Class ArrayClass;
|
||||
extern Class ArrayBufferClass;
|
||||
extern Class BlockClass;
|
||||
|
@ -1885,6 +1885,20 @@ XrayWrapper<Base, Traits>::construct(JSContext *cx, HandleObject wrapper, const
|
||||
return Traits::construct(cx, wrapper, args, Base::singleton);
|
||||
}
|
||||
|
||||
template <typename Base, typename Traits>
|
||||
bool
|
||||
XrayWrapper<Base, Traits>::defaultValue(JSContext *cx, HandleObject wrapper,
|
||||
JSType hint, MutableHandleValue vp)
|
||||
{
|
||||
// Even if this isn't a security wrapper, Xray semantics dictate that we
|
||||
// run the DefaultValue algorithm directly on the Xray wrapper.
|
||||
//
|
||||
// NB: We don't have to worry about things with special [[DefaultValue]]
|
||||
// behavior like Date because we'll never have an XrayWrapper to them.
|
||||
return js::DefaultValue(cx, wrapper, hint, vp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The Permissive / Security variants should be used depending on whether the
|
||||
* compartment of the wrapper is guranteed to subsume the compartment of the
|
||||
|
@ -103,6 +103,10 @@ class XrayWrapper : public Base {
|
||||
virtual bool construct(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||
const JS::CallArgs &args) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool defaultValue(JSContext *cx, JS::HandleObject wrapper,
|
||||
JSType hint, JS::MutableHandleValue vp)
|
||||
MOZ_OVERRIDE;
|
||||
|
||||
static XrayWrapper singleton;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user