mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 828462 - Root Proxy/Wrapper get(Own)PropertyDescriptor. r=terrence
This commit is contained in:
parent
99fc0ee5a5
commit
b67362a266
@ -537,11 +537,15 @@ public:
|
||||
virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE;
|
||||
|
||||
// Fundamental traps
|
||||
virtual bool getPropertyDescriptor(JSContext* cx, JSObject* proxy,
|
||||
jsid id, JSPropertyDescriptor* desc,
|
||||
virtual bool getPropertyDescriptor(JSContext* cx,
|
||||
JS::Handle<JSObject *> proxy,
|
||||
JS::Handle<jsid> id,
|
||||
JSPropertyDescriptor* desc,
|
||||
unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext* cx, JSObject* proxy,
|
||||
jsid id, JSPropertyDescriptor* desc,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext* cx,
|
||||
JS::Handle<JSObject *> proxy,
|
||||
JS::Handle<jsid> id,
|
||||
JSPropertyDescriptor* desc,
|
||||
unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool defineProperty(JSContext* cx, JSObject* proxy,
|
||||
jsid id, JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
||||
@ -609,8 +613,9 @@ nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy)
|
||||
}
|
||||
|
||||
bool
|
||||
nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx, JSObject* proxy,
|
||||
jsid id,
|
||||
nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx,
|
||||
JS::Handle<JSObject *> proxy,
|
||||
JS::Handle<jsid> id,
|
||||
JSPropertyDescriptor* desc,
|
||||
unsigned flags)
|
||||
{
|
||||
@ -630,8 +635,9 @@ nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx, JSObject* proxy,
|
||||
}
|
||||
|
||||
bool
|
||||
nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx, JSObject* proxy,
|
||||
jsid id,
|
||||
nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx,
|
||||
JS::Handle<JSObject *> proxy,
|
||||
JS::Handle<jsid> id,
|
||||
JSPropertyDescriptor* desc,
|
||||
unsigned flags)
|
||||
{
|
||||
@ -10168,10 +10174,10 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
||||
TimeStamp deadline;
|
||||
|
||||
if (aTimeout && aTimeout->mWhen > now) {
|
||||
// The OS timer fired early (which can happen due to the timers
|
||||
// having lower precision than TimeStamp does). Set |deadline| to
|
||||
// be the time when the OS timer *should* have fired so that any
|
||||
// timers that *should* have fired before aTimeout *will* be fired
|
||||
// The OS timer fired early (which can happen due to the timers
|
||||
// having lower precision than TimeStamp does). Set |deadline| to
|
||||
// be the time when the OS timer *should* have fired so that any
|
||||
// timers that *should* have fired before aTimeout *will* be fired
|
||||
// now.
|
||||
|
||||
deadline = aTimeout->mWhen;
|
||||
|
@ -5797,14 +5797,16 @@ class CGClass(CGThing):
|
||||
|
||||
class CGResolveOwnProperty(CGAbstractMethod):
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'wrapper'),
|
||||
Argument('JSObject*', 'obj'), Argument('jsid', 'id'),
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'wrapper_'),
|
||||
Argument('JSObject*', 'obj'), Argument('jsid', 'id_'),
|
||||
Argument('JSPropertyDescriptor*', 'desc'), Argument('unsigned', 'flags'),
|
||||
]
|
||||
CGAbstractMethod.__init__(self, descriptor, "ResolveOwnProperty", "bool", args)
|
||||
def definition_body(self):
|
||||
return """ // We rely on getOwnPropertyDescriptor not shadowing prototype properties by named
|
||||
// properties. If that changes we'll need to filter here.
|
||||
js::RootedObject wrapper(cx, wrapper_);
|
||||
js::RootedId id(cx, id_);
|
||||
return js::GetProxyHandler(obj)->getOwnPropertyDescriptor(cx, wrapper, id, desc, flags);
|
||||
"""
|
||||
|
||||
@ -6069,8 +6071,8 @@ class CGDOMJSProxyHandler_CGDOMJSProxyHandler(ClassConstructor):
|
||||
|
||||
class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy'),
|
||||
Argument('jsid', 'id'),
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'proxy'),
|
||||
Argument('JS::Handle<jsid>', 'id'),
|
||||
Argument('JSPropertyDescriptor*', 'desc'), Argument('unsigned', 'flags')]
|
||||
ClassMethod.__init__(self, "getOwnPropertyDescriptor", "bool", args)
|
||||
self.descriptor = descriptor
|
||||
|
@ -76,7 +76,7 @@ DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JSObject* obj)
|
||||
}
|
||||
|
||||
bool
|
||||
DOMProxyHandler::getPropertyDescriptor(JSContext* cx, JSObject* proxy, jsid id,
|
||||
DOMProxyHandler::getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
||||
JSPropertyDescriptor* desc, unsigned flags)
|
||||
{
|
||||
if (!getOwnPropertyDescriptor(cx, proxy, id, desc, flags)) {
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool getPropertyDescriptor(JSContext* cx, JSObject* proxy, jsid id, JSPropertyDescriptor* desc,
|
||||
bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id, JSPropertyDescriptor* desc,
|
||||
unsigned flags) MOZ_OVERRIDE;
|
||||
bool defineProperty(JSContext* cx, JSObject* proxy, jsid id,
|
||||
JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
||||
|
@ -3477,7 +3477,7 @@ LookupPropertyById(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
#define AUTO_NAMELEN(s,n) (((n) == (size_t)-1) ? js_strlen(s) : (n))
|
||||
|
||||
static JSBool
|
||||
LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, jsid id,
|
||||
LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, HandleId id,
|
||||
HandleShape shape, Value *vp)
|
||||
{
|
||||
if (!shape) {
|
||||
|
@ -141,9 +141,10 @@ BaseProxyHandler::hasOwn(JSContext *cx, JSObject *proxy_, jsid id_, bool *bp)
|
||||
}
|
||||
|
||||
bool
|
||||
BaseProxyHandler::get(JSContext *cx, JSObject *proxy, JSObject *receiver_, jsid id_, Value *vp)
|
||||
BaseProxyHandler::get(JSContext *cx, JSObject *proxy_, JSObject *receiver_, jsid id_, Value *vp)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, id_);
|
||||
assertEnteredPolicy(cx, proxy_, id_);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
RootedObject receiver(cx, receiver_);
|
||||
RootedId id(cx, id_);
|
||||
|
||||
@ -289,10 +290,11 @@ BaseProxyHandler::keys(JSContext *cx, JSObject *proxyArg, AutoIdVector &props)
|
||||
|
||||
/* Select only the enumerable properties through in-place iteration. */
|
||||
AutoPropertyDescriptorRooter desc(cx);
|
||||
RootedId id(cx);
|
||||
size_t i = 0;
|
||||
for (size_t j = 0, len = props.length(); j < len; j++) {
|
||||
JS_ASSERT(i <= j);
|
||||
RootedId id(cx, props[j]);
|
||||
id = props[j];
|
||||
AutoWaivePolicy policy(cx, proxy, id);
|
||||
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc, 0))
|
||||
return false;
|
||||
@ -443,8 +445,8 @@ BaseProxyHandler::getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **prot
|
||||
|
||||
|
||||
bool
|
||||
DirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
jsid id, PropertyDescriptor *desc, unsigned flags)
|
||||
DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, id);
|
||||
JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
||||
@ -453,7 +455,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
}
|
||||
|
||||
static bool
|
||||
GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, jsid id, unsigned flags,
|
||||
GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
JSPropertyDescriptor *desc)
|
||||
{
|
||||
// If obj is a proxy, we can do better than just guessing. This is
|
||||
@ -469,8 +471,8 @@ GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, jsid id, unsigned flag
|
||||
}
|
||||
|
||||
bool
|
||||
DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
jsid id, PropertyDescriptor *desc, unsigned flags)
|
||||
DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
|
||||
HandleId id, PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, id);
|
||||
RootedObject target(cx, GetProxyTargetObject(proxy));
|
||||
@ -803,9 +805,9 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler {
|
||||
virtual ~ScriptedIndirectProxyHandler();
|
||||
|
||||
/* ES5 Harmony fundamental proxy traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
|
||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||
@ -864,11 +866,9 @@ GetIndirectProxyHandlerObject(JSObject *proxy)
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_,
|
||||
ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
RootedId id(cx, id_);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
|
||||
RootedValue fval(cx), value(cx);
|
||||
return GetFundamentalTrap(cx, handler, cx->names().getPropertyDescriptor, &fval) &&
|
||||
@ -879,11 +879,9 @@ ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *pro
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_,
|
||||
ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
RootedId id(cx, id_);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
|
||||
RootedValue fval(cx), value(cx);
|
||||
return GetFundamentalTrap(cx, handler, cx->names().getOwnPropertyDescriptor, &fval) &&
|
||||
@ -1069,9 +1067,9 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler {
|
||||
virtual ~ScriptedDirectProxyHandler();
|
||||
|
||||
/* ES5 Harmony fundamental proxy traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
|
||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||
@ -1638,12 +1636,11 @@ ScriptedDirectProxyHandler::~ScriptedDirectProxyHandler()
|
||||
|
||||
// FIXME: Move to Proxy::getPropertyDescriptor once ScriptedIndirectProxy is removed
|
||||
bool
|
||||
ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_,
|
||||
ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
Rooted<JSObject*> proxy(cx, proxy_);
|
||||
Rooted<jsid> id(cx, id_);
|
||||
|
||||
if (!GetOwnPropertyDescriptor(cx, proxy, id, desc))
|
||||
return false;
|
||||
if (desc->obj)
|
||||
@ -1659,12 +1656,9 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_,
|
||||
ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
RootedObject proxy(cx, proxy_);
|
||||
RootedId id(cx, id_);
|
||||
|
||||
// step 1
|
||||
RootedValue v(cx);
|
||||
if (!TrapGetOwnProperty(cx, proxy, id, &v))
|
||||
@ -2264,12 +2258,10 @@ ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton;
|
||||
JS_END_MACRO \
|
||||
|
||||
bool
|
||||
Proxy::getPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_, PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
RootedId id(cx, id_);
|
||||
BaseProxyHandler *handler = GetProxyHandler(proxy);
|
||||
desc->obj = NULL; // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
|
||||
@ -2286,28 +2278,23 @@ Proxy::getPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_, Property
|
||||
}
|
||||
|
||||
bool
|
||||
Proxy::getPropertyDescriptor(JSContext *cx, JSObject *proxy_, unsigned flags, jsid id, Value *vp)
|
||||
Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags,
|
||||
HandleId id, MutableHandleValue vp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
|
||||
AutoPropertyDescriptorRooter desc(cx);
|
||||
if (!Proxy::getPropertyDescriptor(cx, proxy, id, &desc, flags))
|
||||
return false;
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!NewPropertyDescriptorObject(cx, &desc, &value))
|
||||
return false;
|
||||
*vp = value;
|
||||
return true;
|
||||
return NewPropertyDescriptorObject(cx, &desc, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
Proxy::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_, PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
RootedId id(cx, id_);
|
||||
|
||||
BaseProxyHandler *handler = GetProxyHandler(proxy);
|
||||
desc->obj = NULL; // default result if we refuse to perform this action
|
||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
|
||||
@ -2317,20 +2304,15 @@ Proxy::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_, Prope
|
||||
}
|
||||
|
||||
bool
|
||||
Proxy::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy_, unsigned flags, jsid id,
|
||||
Value *vp)
|
||||
Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags, HandleId id,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
|
||||
AutoPropertyDescriptorRooter desc(cx);
|
||||
if (!Proxy::getOwnPropertyDescriptor(cx, proxy, id, &desc, flags))
|
||||
return false;
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!NewPropertyDescriptorObject(cx, &desc, &value))
|
||||
return false;
|
||||
*vp = value;
|
||||
return true;
|
||||
return NewPropertyDescriptorObject(cx, &desc, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -104,10 +104,11 @@ class JS_FRIEND_API(BaseProxyHandler) {
|
||||
bool *bp);
|
||||
|
||||
/* ES5 Harmony fundamental proxy traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) = 0;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
jsid id, PropertyDescriptor *desc, unsigned flags) = 0;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
|
||||
HandleId id, PropertyDescriptor *desc,
|
||||
unsigned flags) = 0;
|
||||
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
|
||||
PropertyDescriptor *desc) = 0;
|
||||
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *proxy,
|
||||
@ -157,10 +158,10 @@ public:
|
||||
explicit DirectProxyHandler(void *family);
|
||||
|
||||
/* ES5 Harmony fundamental proxy traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
jsid id, PropertyDescriptor *desc,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
|
||||
HandleId id, PropertyDescriptor *desc,
|
||||
unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
|
||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||
@ -206,14 +207,14 @@ public:
|
||||
class Proxy {
|
||||
public:
|
||||
/* ES5 Harmony fundamental proxy traps. */
|
||||
static bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags);
|
||||
static bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, unsigned flags, jsid id,
|
||||
Value *vp);
|
||||
static bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags, HandleId id,
|
||||
MutableHandleValue vp);
|
||||
static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags);
|
||||
static bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, unsigned flags, jsid id,
|
||||
Value *vp);
|
||||
static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, unsigned flags, HandleId id,
|
||||
MutableHandleValue vp);
|
||||
static bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, PropertyDescriptor *desc);
|
||||
static bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, const Value &v);
|
||||
static bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, AutoIdVector &props);
|
||||
|
@ -231,24 +231,25 @@ bool CrossCompartmentWrapper::finalizeInBackground(HandleValue priv)
|
||||
#define NOTHING (true)
|
||||
|
||||
bool
|
||||
CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapperArg, jsid id,
|
||||
CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
RootedObject wrapper(cx, wrapperArg);
|
||||
RootedId idCopy(cx, id);
|
||||
PIERCE(cx, wrapper,
|
||||
cx->compartment->wrapId(cx, &id),
|
||||
Wrapper::getPropertyDescriptor(cx, wrapper, id, desc, flags),
|
||||
cx->compartment->wrapId(cx, idCopy.address()),
|
||||
Wrapper::getPropertyDescriptor(cx, wrapper, idCopy, desc, flags),
|
||||
cx->compartment->wrap(cx, desc));
|
||||
}
|
||||
|
||||
bool
|
||||
CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapperArg, jsid id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper,
|
||||
HandleId id, PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
{
|
||||
RootedObject wrapper(cx, wrapperArg);
|
||||
RootedId idCopy(cx, id);
|
||||
PIERCE(cx, wrapper,
|
||||
cx->compartment->wrapId(cx, &id),
|
||||
Wrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc, flags),
|
||||
cx->compartment->wrapId(cx, idCopy.address()),
|
||||
Wrapper::getOwnPropertyDescriptor(cx, wrapper, idCopy, desc, flags),
|
||||
cx->compartment->wrap(cx, desc));
|
||||
}
|
||||
|
||||
@ -702,7 +703,7 @@ DeadObjectProxy::DeadObjectProxy()
|
||||
}
|
||||
|
||||
bool
|
||||
DeadObjectProxy::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEAD_OBJECT);
|
||||
@ -710,7 +711,7 @@ DeadObjectProxy::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id
|
||||
}
|
||||
|
||||
bool
|
||||
DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEAD_OBJECT);
|
||||
|
@ -86,9 +86,9 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
|
||||
virtual bool finalizeInBackground(HandleValue priv) MOZ_OVERRIDE;
|
||||
|
||||
/* ES5 Harmony fundamental wrapper traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||
@ -162,9 +162,9 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler
|
||||
explicit DeadObjectProxy();
|
||||
|
||||
/* ES5 Harmony fundamental wrapper traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||
|
@ -1305,18 +1305,17 @@ class DebugScopeProxy : public BaseProxyHandler
|
||||
|
||||
DebugScopeProxy() : BaseProxyHandler(&family) {}
|
||||
|
||||
bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, PropertyDescriptor *desc,
|
||||
bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, PropertyDescriptor *desc,
|
||||
unsigned flags) MOZ_OVERRIDE
|
||||
{
|
||||
return getOwnPropertyDescriptor(cx, proxy, id, desc, flags);
|
||||
}
|
||||
|
||||
bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid idArg,
|
||||
bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
|
||||
PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE
|
||||
{
|
||||
Rooted<DebugScopeObject*> debugScope(cx, &proxy->asDebugScope());
|
||||
Rooted<ScopeObject*> scope(cx, &debugScope->scope());
|
||||
RootedId id(cx, idArg);
|
||||
|
||||
ArgumentsObject *maybeArgsObj;
|
||||
if (!checkForMissingArguments(cx, id, *scope, &maybeArgsObj))
|
||||
|
@ -3159,13 +3159,13 @@ extern JSBool
|
||||
XPC_WN_Helper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
|
||||
|
||||
bool
|
||||
xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
jsid id_,
|
||||
xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx,
|
||||
JS::Handle<JSObject *> proxy,
|
||||
JS::Handle<jsid> id,
|
||||
PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
{
|
||||
JS::RootedObject obj(cx, wrappedObject(proxy));
|
||||
JS::RootedId id(cx, id_);
|
||||
|
||||
MOZ_ASSERT(js::GetObjectCompartment(obj) == js::GetObjectCompartment(proxy));
|
||||
if (!JS_GetPropertyDescriptorById(cx, obj, id,
|
||||
@ -3208,8 +3208,8 @@ xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
|
||||
bool
|
||||
xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx,
|
||||
JSObject *proxy,
|
||||
jsid id,
|
||||
JS::Handle<JSObject *> proxy,
|
||||
JS::Handle<jsid> id,
|
||||
PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
{
|
||||
|
@ -40,8 +40,11 @@ PropIsFromStandardPrototype(JSContext *cx, JSPropertyDescriptor *desc)
|
||||
// This lets us determine whether the property we would have found (given a
|
||||
// transparent wrapper) would have come off a standard prototype.
|
||||
static bool
|
||||
PropIsFromStandardPrototype(JSContext *cx, JSObject *wrapper, jsid id)
|
||||
PropIsFromStandardPrototype(JSContext *cx, JSObject *wrapperArg, jsid idArg)
|
||||
{
|
||||
JS::Rooted<JSObject *> wrapper(cx, wrapperArg);
|
||||
JS::Rooted<jsid> id(cx, idArg);
|
||||
|
||||
MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) ==
|
||||
&ChromeObjectWrapper::singleton);
|
||||
JSPropertyDescriptor desc;
|
||||
@ -56,8 +59,10 @@ PropIsFromStandardPrototype(JSContext *cx, JSObject *wrapper, jsid id)
|
||||
}
|
||||
|
||||
bool
|
||||
ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
|
||||
jsid id, js::PropertyDescriptor *desc,
|
||||
ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
|
||||
JS::Handle<JSObject *> wrapper,
|
||||
JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, id);
|
||||
|
@ -29,8 +29,8 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase
|
||||
ChromeObjectWrapper() : ChromeObjectWrapperBase(0) {}
|
||||
|
||||
/* Custom traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
|
||||
jsid id, js::PropertyDescriptor *desc,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||
unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool has(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
bool *bp) MOZ_OVERRIDE;
|
||||
|
@ -67,7 +67,8 @@ FilterSetter(JSContext *cx, JSObject *wrapper, jsid id, js::PropertyDescriptor *
|
||||
|
||||
template <typename Base, typename Policy>
|
||||
bool
|
||||
FilteringWrapper<Base, Policy>::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
FilteringWrapper<Base, Policy>::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||
JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, id);
|
||||
@ -78,7 +79,8 @@ FilteringWrapper<Base, Policy>::getPropertyDescriptor(JSContext *cx, JSObject *w
|
||||
|
||||
template <typename Base, typename Policy>
|
||||
bool
|
||||
FilteringWrapper<Base, Policy>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
FilteringWrapper<Base, Policy>::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||
JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
{
|
||||
|
@ -22,8 +22,8 @@ class FilteringWrapper : public Base {
|
||||
// This is potentially dynamic until XBL scopes are no longer behind a pref.
|
||||
virtual bool isSafeToUnwrap();
|
||||
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props) MOZ_OVERRIDE;
|
||||
virtual bool enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props) MOZ_OVERRIDE;
|
||||
virtual bool keys(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props) MOZ_OVERRIDE;
|
||||
|
@ -24,16 +24,18 @@ WaiveXrayWrapper::~WaiveXrayWrapper()
|
||||
}
|
||||
|
||||
bool
|
||||
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
js::PropertyDescriptor *desc, unsigned flags)
|
||||
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *>wrapper,
|
||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
{
|
||||
return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc, flags) &&
|
||||
WrapperFactory::WaiveXrayAndWrap(cx, &desc->value);
|
||||
}
|
||||
|
||||
bool
|
||||
WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
js::PropertyDescriptor *desc, unsigned flags)
|
||||
WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||
unsigned flags)
|
||||
{
|
||||
return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc, flags) &&
|
||||
WrapperFactory::WaiveXrayAndWrap(cx, &desc->value);
|
||||
|
@ -20,9 +20,8 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper {
|
||||
WaiveXrayWrapper(unsigned flags);
|
||||
virtual ~WaiveXrayWrapper();
|
||||
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
||||
js::Value *vp) MOZ_OVERRIDE;
|
||||
|
@ -1414,7 +1414,8 @@ DEBUG_CheckXBLLookup(JSContext *cx, JSPropertyDescriptor *desc)
|
||||
|
||||
template <typename Base, typename Traits>
|
||||
bool
|
||||
XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||
JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, id);
|
||||
@ -1556,7 +1557,8 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
|
||||
template <typename Base, typename Traits>
|
||||
bool
|
||||
XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||
JS::Handle<jsid> id,
|
||||
PropertyDescriptor *desc, unsigned flags)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, id);
|
||||
@ -1579,7 +1581,7 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wra
|
||||
return false;
|
||||
}
|
||||
|
||||
desc->obj = (desc->obj == obj) ? wrapper : nullptr;
|
||||
desc->obj = (desc->obj == obj) ? wrapper.get() : nullptr; // XXX
|
||||
return JS_WrapPropertyDescriptor(cx, desc);
|
||||
}
|
||||
|
||||
@ -1603,9 +1605,12 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wra
|
||||
|
||||
template <typename Base, typename Traits>
|
||||
bool
|
||||
XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, JSObject *wrapperArg, jsid idArg,
|
||||
js::PropertyDescriptor *desc)
|
||||
{
|
||||
JS::Rooted<JSObject *> wrapper(cx, wrapperArg);
|
||||
JS::Rooted<jsid> id(cx, idArg);
|
||||
|
||||
assertEnteredPolicy(cx, wrapper, id);
|
||||
// Redirect access straight to the wrapper if we should be transparent.
|
||||
if (XrayUtils::IsTransparent(cx, wrapper, id)) {
|
||||
|
@ -66,9 +66,9 @@ class XrayWrapper : public Base {
|
||||
virtual ~XrayWrapper();
|
||||
|
||||
/* Fundamental proxy traps. */
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc,
|
||||
unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
@ -113,10 +113,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id,
|
||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
||||
js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
jsid id, js::PropertyDescriptor *desc,
|
||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> proxy,
|
||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||
unsigned flags) MOZ_OVERRIDE;
|
||||
|
||||
// We just forward the derived traps to the BaseProxyHandler versions which
|
||||
|
Loading…
Reference in New Issue
Block a user