Bug 828462 - Root Proxy/Wrapper in the browser. r=terrence,bz
This commit is contained in:
@@ -533,46 +533,53 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
|
virtual JSString *obj_toString(JSContext *cx,
|
||||||
|
JS::Handle<JSObject*> wrapper) MOZ_OVERRIDE;
|
||||||
virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE;
|
virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE;
|
||||||
|
|
||||||
// Fundamental traps
|
// Fundamental traps
|
||||||
virtual bool getPropertyDescriptor(JSContext* cx,
|
virtual bool getPropertyDescriptor(JSContext* cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc,
|
JSPropertyDescriptor* desc,
|
||||||
unsigned flags) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
virtual bool getOwnPropertyDescriptor(JSContext* cx,
|
virtual bool getOwnPropertyDescriptor(JSContext* cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc,
|
JSPropertyDescriptor* desc,
|
||||||
unsigned flags) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
virtual bool defineProperty(JSContext* cx,
|
virtual bool defineProperty(JSContext* cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx,
|
virtual bool getOwnPropertyNames(JSContext *cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
virtual bool delete_(JSContext *cx, JS::Handle<JSObject *> proxy,
|
virtual bool delete_(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
bool *bp) MOZ_OVERRIDE;
|
bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *proxy,
|
virtual bool enumerate(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
|
||||||
// Derived traps
|
// Derived traps
|
||||||
virtual bool has(JSContext *cx, JSObject *proxy, jsid id,
|
virtual bool has(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
bool *bp) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id,
|
virtual bool hasOwn(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
bool *bp) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
virtual bool get(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
jsid id, JS::Value *vp) MOZ_OVERRIDE;
|
JS::Handle<JSObject*> receiver,
|
||||||
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
JS::Handle<jsid> id,
|
||||||
jsid id, bool strict, JS::Value *vp) MOZ_OVERRIDE;
|
JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
virtual bool keys(JSContext *cx, JS::Handle<JSObject *> proxy,
|
virtual bool set(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
|
JS::Handle<JSObject*> receiver,
|
||||||
|
JS::Handle<jsid> id,
|
||||||
|
bool strict,
|
||||||
|
JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
|
virtual bool keys(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags,
|
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::Value *vp) MOZ_OVERRIDE;
|
unsigned flags,
|
||||||
|
JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
|
|
||||||
static nsOuterWindowProxy singleton;
|
static nsOuterWindowProxy singleton;
|
||||||
|
|
||||||
@@ -600,7 +607,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
JSString *
|
JSString *
|
||||||
nsOuterWindowProxy::obj_toString(JSContext *cx, JSObject *proxy)
|
nsOuterWindowProxy::obj_toString(JSContext *cx, JS::Handle<JSObject*> proxy)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(js::IsProxy(proxy));
|
MOZ_ASSERT(js::IsProxy(proxy));
|
||||||
|
|
||||||
@@ -618,7 +625,7 @@ nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx,
|
nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc,
|
JSPropertyDescriptor* desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
@@ -640,7 +647,7 @@ nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx,
|
nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc,
|
JSPropertyDescriptor* desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
@@ -660,7 +667,7 @@ nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::defineProperty(JSContext* cx,
|
nsOuterWindowProxy::defineProperty(JSContext* cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc)
|
JSPropertyDescriptor* desc)
|
||||||
{
|
{
|
||||||
@@ -677,7 +684,8 @@ nsOuterWindowProxy::defineProperty(JSContext* cx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> proxy,
|
nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx,
|
||||||
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::AutoIdVector &props)
|
JS::AutoIdVector &props)
|
||||||
{
|
{
|
||||||
// Just our indexed stuff followed by our "normal" own property names.
|
// Just our indexed stuff followed by our "normal" own property names.
|
||||||
@@ -693,7 +701,7 @@ nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle<JSObject *> proxy,
|
nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id, bool *bp)
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
||||||
@@ -714,7 +722,7 @@ nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle<JSObject *> proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::enumerate(JSContext *cx, JSObject *proxy,
|
nsOuterWindowProxy::enumerate(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::AutoIdVector &props)
|
JS::AutoIdVector &props)
|
||||||
{
|
{
|
||||||
// Just our indexed stuff followed by our "normal" own property names.
|
// Just our indexed stuff followed by our "normal" own property names.
|
||||||
@@ -730,7 +738,8 @@ nsOuterWindowProxy::enumerate(JSContext *cx, JSObject *proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::has(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
nsOuterWindowProxy::has(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
||||||
*bp = true;
|
*bp = true;
|
||||||
@@ -741,7 +750,8 @@ nsOuterWindowProxy::has(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
nsOuterWindowProxy::hasOwn(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
||||||
*bp = true;
|
*bp = true;
|
||||||
@@ -752,17 +762,19 @@ nsOuterWindowProxy::hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
nsOuterWindowProxy::get(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
jsid id, JS::Value *vp)
|
JS::Handle<JSObject*> receiver,
|
||||||
|
JS::Handle<jsid> id,
|
||||||
|
JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
if (id == nsDOMClassInfo::sWrappedJSObject_id &&
|
if (id == nsDOMClassInfo::sWrappedJSObject_id &&
|
||||||
xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) {
|
xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) {
|
||||||
*vp = JS::ObjectValue(*wrapper);
|
vp.set(JS::ObjectValue(*proxy));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool found;
|
bool found;
|
||||||
if (!GetSubframeWindow(cx, wrapper, id, vp, found)) {
|
if (!GetSubframeWindow(cx, proxy, id, vp.address(), found)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
@@ -770,12 +782,15 @@ nsOuterWindowProxy::get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
|||||||
}
|
}
|
||||||
// Else fall through to js::Wrapper
|
// Else fall through to js::Wrapper
|
||||||
|
|
||||||
return js::Wrapper::get(cx, wrapper, receiver, id, vp);
|
return js::Wrapper::get(cx, proxy, receiver, id, vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::set(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
nsOuterWindowProxy::set(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
jsid id, bool strict, JS::Value *vp)
|
JS::Handle<JSObject*> receiver,
|
||||||
|
JS::Handle<jsid> id,
|
||||||
|
bool strict,
|
||||||
|
JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
int32_t index = GetArrayIndexFromId(cx, id);
|
int32_t index = GetArrayIndexFromId(cx, id);
|
||||||
if (IsArrayIndex(index)) {
|
if (IsArrayIndex(index)) {
|
||||||
@@ -790,7 +805,7 @@ nsOuterWindowProxy::set(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::keys(JSContext *cx, JS::Handle<JSObject *> proxy,
|
nsOuterWindowProxy::keys(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::AutoIdVector &props)
|
JS::AutoIdVector &props)
|
||||||
{
|
{
|
||||||
// BaseProxyHandler::keys seems to do what we want here: call
|
// BaseProxyHandler::keys seems to do what we want here: call
|
||||||
@@ -799,8 +814,8 @@ nsOuterWindowProxy::keys(JSContext *cx, JS::Handle<JSObject *> proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::iterate(JSContext *cx, JSObject *proxy, unsigned flags,
|
nsOuterWindowProxy::iterate(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::Value *vp)
|
unsigned flags, JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
// BaseProxyHandler::iterate seems to do what we want here: fall
|
// BaseProxyHandler::iterate seems to do what we want here: fall
|
||||||
// back on the property names returned from keys() and enumerate().
|
// back on the property names returned from keys() and enumerate().
|
||||||
@@ -870,13 +885,14 @@ class nsChromeOuterWindowProxy : public nsOuterWindowProxy
|
|||||||
public:
|
public:
|
||||||
nsChromeOuterWindowProxy() : nsOuterWindowProxy() {}
|
nsChromeOuterWindowProxy() : nsOuterWindowProxy() {}
|
||||||
|
|
||||||
virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper);
|
virtual JSString *obj_toString(JSContext *cx, JS::Handle<JSObject*> wrapper);
|
||||||
|
|
||||||
static nsChromeOuterWindowProxy singleton;
|
static nsChromeOuterWindowProxy singleton;
|
||||||
};
|
};
|
||||||
|
|
||||||
JSString *
|
JSString *
|
||||||
nsChromeOuterWindowProxy::obj_toString(JSContext *cx, JSObject *proxy)
|
nsChromeOuterWindowProxy::obj_toString(JSContext *cx,
|
||||||
|
JS::Handle<JSObject*> proxy)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(js::IsProxy(proxy));
|
MOZ_ASSERT(js::IsProxy(proxy));
|
||||||
|
|
||||||
|
|||||||
@@ -1328,9 +1328,11 @@ ConcatJSString(JSContext* cx, const char* pre, JSString* str, const char* post)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
NativeToString(JSContext* cx, JSObject* wrapper, JSObject* obj, const char* pre,
|
NativeToString(JSContext* cx, JSObject* wrapper, JSObject* object, const char* pre,
|
||||||
const char* post, JS::Value* v)
|
const char* post, JS::Value* v)
|
||||||
{
|
{
|
||||||
|
JS::Rooted<JSObject*> obj(cx, object);
|
||||||
|
|
||||||
JSPropertyDescriptor toStringDesc;
|
JSPropertyDescriptor toStringDesc;
|
||||||
toStringDesc.obj = nullptr;
|
toStringDesc.obj = nullptr;
|
||||||
toStringDesc.attrs = 0;
|
toStringDesc.attrs = 0;
|
||||||
|
|||||||
@@ -5819,7 +5819,7 @@ class CGEnumerateOwnProperties(CGAbstractMethod):
|
|||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
return """ // We rely on getOwnPropertyNames not shadowing prototype properties by named
|
return """ // We rely on getOwnPropertyNames not shadowing prototype properties by named
|
||||||
// properties. If that changes we'll need to filter here.
|
// properties. If that changes we'll need to filter here.
|
||||||
JS::Rooted<JSObject *> wrapper(cx, wrapper_);
|
JS::Rooted<JSObject*> wrapper(cx, wrapper_);
|
||||||
return js::GetProxyHandler(obj)->getOwnPropertyNames(cx, wrapper, props);
|
return js::GetProxyHandler(obj)->getOwnPropertyNames(cx, wrapper, props);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -6162,7 +6162,7 @@ return true;"""
|
|||||||
|
|
||||||
class CGDOMJSProxyHandler_defineProperty(ClassMethod):
|
class CGDOMJSProxyHandler_defineProperty(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject *>', 'proxy'),
|
args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'proxy'),
|
||||||
Argument('JS::Handle<jsid>', 'id'),
|
Argument('JS::Handle<jsid>', 'id'),
|
||||||
Argument('JSPropertyDescriptor*', 'desc')]
|
Argument('JSPropertyDescriptor*', 'desc')]
|
||||||
ClassMethod.__init__(self, "defineProperty", "bool", args)
|
ClassMethod.__init__(self, "defineProperty", "bool", args)
|
||||||
@@ -6212,7 +6212,7 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod):
|
|||||||
|
|
||||||
class CGDOMJSProxyHandler_delete(ClassMethod):
|
class CGDOMJSProxyHandler_delete(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject *>', 'proxy'),
|
args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'proxy'),
|
||||||
Argument('JS::Handle<jsid>', 'id'),
|
Argument('JS::Handle<jsid>', 'id'),
|
||||||
Argument('bool*', 'bp')]
|
Argument('bool*', 'bp')]
|
||||||
ClassMethod.__init__(self, "delete_", "bool", args)
|
ClassMethod.__init__(self, "delete_", "bool", args)
|
||||||
@@ -6281,7 +6281,7 @@ class CGDOMJSProxyHandler_delete(ClassMethod):
|
|||||||
class CGDOMJSProxyHandler_getOwnPropertyNames(ClassMethod):
|
class CGDOMJSProxyHandler_getOwnPropertyNames(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'),
|
args = [Argument('JSContext*', 'cx'),
|
||||||
Argument('JS::Handle<JSObject *>', 'proxy'),
|
Argument('JS::Handle<JSObject*>', 'proxy'),
|
||||||
Argument('JS::AutoIdVector&', 'props')]
|
Argument('JS::AutoIdVector&', 'props')]
|
||||||
ClassMethod.__init__(self, "getOwnPropertyNames", "bool", args)
|
ClassMethod.__init__(self, "getOwnPropertyNames", "bool", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
@@ -6321,8 +6321,10 @@ return true;"""
|
|||||||
|
|
||||||
class CGDOMJSProxyHandler_hasOwn(ClassMethod):
|
class CGDOMJSProxyHandler_hasOwn(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy'),
|
args = [Argument('JSContext*', 'cx'),
|
||||||
Argument('jsid', 'id'), Argument('bool*', 'bp')]
|
Argument('JS::Handle<JSObject*>', 'proxy'),
|
||||||
|
Argument('JS::Handle<jsid>', 'id'),
|
||||||
|
Argument('bool*', 'bp')]
|
||||||
ClassMethod.__init__(self, "hasOwn", "bool", args)
|
ClassMethod.__init__(self, "hasOwn", "bool", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
@@ -6363,9 +6365,11 @@ return true;"""
|
|||||||
|
|
||||||
class CGDOMJSProxyHandler_get(ClassMethod):
|
class CGDOMJSProxyHandler_get(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy'),
|
args = [Argument('JSContext*', 'cx'),
|
||||||
Argument('JSObject*', 'receiver'), Argument('jsid', 'id'),
|
Argument('JS::Handle<JSObject*>', 'proxy'),
|
||||||
Argument('JS::Value*', 'vp')]
|
Argument('JS::Handle<JSObject*>', 'receiver'),
|
||||||
|
Argument('JS::Handle<jsid>', 'id'),
|
||||||
|
Argument('JS::MutableHandle<JS::Value>', 'vp')]
|
||||||
ClassMethod.__init__(self, "get", "bool", args)
|
ClassMethod.__init__(self, "get", "bool", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
@@ -6377,11 +6381,11 @@ if (expando) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasProp) {
|
if (hasProp) {
|
||||||
return JS_GetPropertyById(cx, expando, id, vp);
|
return JS_GetPropertyById(cx, expando, id, vp.address());
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
templateValues = {'jsvalRef': '*vp', 'jsvalPtr': 'vp', 'obj': 'proxy'}
|
templateValues = {'jsvalRef': '*vp.address()', 'jsvalPtr': 'vp.address()', 'obj': 'proxy'}
|
||||||
|
|
||||||
if self.descriptor.supportsIndexedProperties():
|
if self.descriptor.supportsIndexedProperties():
|
||||||
getIndexedOrExpando = ("int32_t index = GetArrayIndexFromId(cx, id);\n" +
|
getIndexedOrExpando = ("int32_t index = GetArrayIndexFromId(cx, id);\n" +
|
||||||
@@ -6411,7 +6415,7 @@ if (expando) {
|
|||||||
%s
|
%s
|
||||||
{ // Scope for this "found" so it doesn't leak to things below
|
{ // Scope for this "found" so it doesn't leak to things below
|
||||||
bool found;
|
bool found;
|
||||||
if (!GetPropertyOnPrototype(cx, proxy, id, &found, vp)) {
|
if (!GetPropertyOnPrototype(cx, proxy, id, &found, vp.address())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6420,12 +6424,12 @@ if (expando) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
%s
|
%s
|
||||||
vp->setUndefined();
|
vp.setUndefined();
|
||||||
return true;""" % (getIndexedOrExpando, getNamed)
|
return true;""" % (getIndexedOrExpando, getNamed)
|
||||||
|
|
||||||
class CGDOMJSProxyHandler_obj_toString(ClassMethod):
|
class CGDOMJSProxyHandler_obj_toString(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy')]
|
args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject*>', 'proxy')]
|
||||||
ClassMethod.__init__(self, "obj_toString", "JSString*", args)
|
ClassMethod.__init__(self, "obj_toString", "JSString*", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
@@ -6450,16 +6454,18 @@ class CGDOMJSProxyHandler_finalize(ClassMethod):
|
|||||||
|
|
||||||
class CGDOMJSProxyHandler_getElementIfPresent(ClassMethod):
|
class CGDOMJSProxyHandler_getElementIfPresent(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy'),
|
args = [Argument('JSContext*', 'cx'),
|
||||||
Argument('JSObject*', 'receiver'),
|
Argument('JS::Handle<JSObject*>', 'proxy'),
|
||||||
|
Argument('JS::Handle<JSObject*>', 'receiver'),
|
||||||
Argument('uint32_t', 'index'),
|
Argument('uint32_t', 'index'),
|
||||||
Argument('JS::Value*', 'vp'), Argument('bool*', 'present')]
|
Argument('JS::MutableHandle<JS::Value>', 'vp'),
|
||||||
|
Argument('bool*', 'present')]
|
||||||
ClassMethod.__init__(self, "getElementIfPresent", "bool", args)
|
ClassMethod.__init__(self, "getElementIfPresent", "bool", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
successCode = ("*present = found;\n"
|
successCode = ("*present = found;\n"
|
||||||
"return true;")
|
"return true;")
|
||||||
templateValues = {'jsvalRef': '*vp', 'jsvalPtr': 'vp',
|
templateValues = {'jsvalRef': '*vp.address()', 'jsvalPtr': 'vp.address()',
|
||||||
'obj': 'proxy', 'successCode': successCode}
|
'obj': 'proxy', 'successCode': successCode}
|
||||||
if self.descriptor.supportsIndexedProperties():
|
if self.descriptor.supportsIndexedProperties():
|
||||||
get = (CGProxyIndexedGetter(self.descriptor, templateValues).define() + "\n"
|
get = (CGProxyIndexedGetter(self.descriptor, templateValues).define() + "\n"
|
||||||
@@ -6475,7 +6481,7 @@ class CGDOMJSProxyHandler_getElementIfPresent(ClassMethod):
|
|||||||
JSObject* expando = GetExpandoObject(proxy);
|
JSObject* expando = GetExpandoObject(proxy);
|
||||||
if (expando) {
|
if (expando) {
|
||||||
JSBool isPresent;
|
JSBool isPresent;
|
||||||
if (!JS_GetElementIfPresent(cx, expando, index, expando, vp, &isPresent)) {
|
if (!JS_GetElementIfPresent(cx, expando, index, expando, vp.address(), &isPresent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isPresent) {
|
if (isPresent) {
|
||||||
@@ -6495,7 +6501,7 @@ if (!js::GetObjectProto(cx, proxy, &proto)) {
|
|||||||
}
|
}
|
||||||
if (proto) {
|
if (proto) {
|
||||||
JSBool isPresent;
|
JSBool isPresent;
|
||||||
if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp, &isPresent)) {
|
if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp.address(), &isPresent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*present = isPresent;
|
*present = isPresent;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JSObject* obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMProxyHandler::getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
DOMProxyHandler::getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc, unsigned flags)
|
JSPropertyDescriptor* desc, unsigned flags)
|
||||||
{
|
{
|
||||||
if (!getOwnPropertyDescriptor(cx, proxy, id, desc, flags)) {
|
if (!getOwnPropertyDescriptor(cx, proxy, id, desc, flags)) {
|
||||||
@@ -99,7 +99,7 @@ DOMProxyHandler::getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject *> pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc)
|
JSPropertyDescriptor* desc)
|
||||||
{
|
{
|
||||||
if ((desc->attrs & JSPROP_GETTER) && desc->setter == JS_StrictPropertyStub) {
|
if ((desc->attrs & JSPROP_GETTER) && desc->setter == JS_StrictPropertyStub) {
|
||||||
@@ -124,7 +124,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject *> proxy, JS:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject *> proxy,
|
DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id, bool* bp)
|
JS::Handle<jsid> id, bool* bp)
|
||||||
{
|
{
|
||||||
JSBool b = true;
|
JSBool b = true;
|
||||||
@@ -142,10 +142,8 @@ DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject *> proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMProxyHandler::enumerate(JSContext* cx, JSObject* proxy_, AutoIdVector& props)
|
DOMProxyHandler::enumerate(JSContext* cx, JS::Handle<JSObject*> proxy, AutoIdVector& props)
|
||||||
{
|
{
|
||||||
JS::Rooted<JSObject *> proxy(cx, proxy_);
|
|
||||||
|
|
||||||
JSObject* proto;
|
JSObject* proto;
|
||||||
if (!JS_GetPrototype(cx, proxy, &proto)) {
|
if (!JS_GetPrototype(cx, proxy, &proto)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -155,14 +153,7 @@ DOMProxyHandler::enumerate(JSContext* cx, JSObject* proxy_, AutoIdVector& props)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMProxyHandler::fix(JSContext* cx, JSObject* proxy, Value* vp)
|
DOMProxyHandler::has(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp)
|
||||||
{
|
|
||||||
vp->setUndefined();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
DOMProxyHandler::has(JSContext* cx, JSObject* proxy, jsid id, bool* bp)
|
|
||||||
{
|
{
|
||||||
if (!hasOwn(cx, proxy, id, bp)) {
|
if (!hasOwn(cx, proxy, id, bp)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -36,15 +36,14 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id, JSPropertyDescriptor* desc,
|
bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
|
||||||
unsigned flags) MOZ_OVERRIDE;
|
JSPropertyDescriptor* desc, unsigned flags) MOZ_OVERRIDE;
|
||||||
bool defineProperty(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
bool defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
||||||
bool delete_(JSContext* cx, JS::Handle<JSObject *> proxy,
|
bool delete_(JSContext* cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id, bool* bp) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, bool* bp) MOZ_OVERRIDE;
|
||||||
bool enumerate(JSContext* cx, JSObject* proxy, JS::AutoIdVector& props) MOZ_OVERRIDE;
|
bool enumerate(JSContext* cx, JS::Handle<JSObject*> proxy, JS::AutoIdVector& props) MOZ_OVERRIDE;
|
||||||
bool fix(JSContext* cx, JSObject* proxy, JS::Value* vp);
|
bool has(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) MOZ_OVERRIDE;
|
||||||
bool has(JSContext* cx, JSObject* proxy, jsid id, bool* bp) MOZ_OVERRIDE;
|
|
||||||
using js::BaseProxyHandler::obj_toString;
|
using js::BaseProxyHandler::obj_toString;
|
||||||
|
|
||||||
static JSObject* GetExpandoObject(JSObject* obj)
|
static JSObject* GetExpandoObject(JSObject* obj)
|
||||||
@@ -118,7 +117,7 @@ FillPropertyDescriptor(JSPropertyDescriptor* desc, JSObject* obj, jsval v, bool
|
|||||||
FillPropertyDescriptor(desc, obj, readonly);
|
FillPropertyDescriptor(desc, obj, readonly);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
EnsureExpandoObject(JSContext* cx, JSObject* obj);
|
EnsureExpandoObject(JSContext* cx, JSObject* obj);
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|||||||
@@ -455,8 +455,9 @@ XPCLazyCallContext::AssertContextIsTopOfStack(JSContext* cx)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
XPCWrappedNative*
|
XPCWrappedNative*
|
||||||
XPCCallContext::UnwrapThisIfAllowed(JSObject *obj, JSObject *fun, unsigned argc)
|
XPCCallContext::UnwrapThisIfAllowed(JSObject *object, JSObject *fun, unsigned argc)
|
||||||
{
|
{
|
||||||
|
JS::Rooted<JSObject *> obj(mJSContext, object);
|
||||||
// We should only get here for objects that aren't safe to unwrap.
|
// We should only get here for objects that aren't safe to unwrap.
|
||||||
MOZ_ASSERT(!js::UnwrapObjectChecked(obj));
|
MOZ_ASSERT(!js::UnwrapObjectChecked(obj));
|
||||||
MOZ_ASSERT(js::IsObjectInContextCompartment(obj, mJSContext));
|
MOZ_ASSERT(js::IsObjectInContextCompartment(obj, mJSContext));
|
||||||
@@ -501,7 +502,8 @@ XPCCallContext::UnwrapThisIfAllowed(JSObject *obj, JSObject *fun, unsigned argc)
|
|||||||
js::Wrapper::Action act = set ? js::Wrapper::SET : js::Wrapper::GET;
|
js::Wrapper::Action act = set ? js::Wrapper::SET : js::Wrapper::GET;
|
||||||
js::Wrapper *handler = js::Wrapper::wrapperHandler(obj);
|
js::Wrapper *handler = js::Wrapper::wrapperHandler(obj);
|
||||||
bool ignored;
|
bool ignored;
|
||||||
if (!handler->enter(mJSContext, obj, member->GetName(), act, &ignored))
|
JS::Rooted<jsid> id(mJSContext, member->GetName());
|
||||||
|
if (!handler->enter(mJSContext, obj, id, act, &ignored))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Ok, this call is safe.
|
// Ok, this call is safe.
|
||||||
|
|||||||
@@ -3047,7 +3047,7 @@ NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_utils_Sandbox)
|
|||||||
xpc::SandboxProxyHandler xpc::sandboxProxyHandler;
|
xpc::SandboxProxyHandler xpc::sandboxProxyHandler;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxCallableProxyHandler::call(JSContext *cx, JSObject *proxy,
|
xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
unsigned argc, Value *vp)
|
unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
// We forward the call to our underlying callable. The callable to forward
|
// We forward the call to our underlying callable. The callable to forward
|
||||||
@@ -3160,7 +3160,7 @@ XPC_WN_Helper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBo
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx,
|
xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
PropertyDescriptor *desc,
|
PropertyDescriptor *desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
@@ -3208,7 +3208,7 @@ xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx,
|
xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
PropertyDescriptor *desc,
|
PropertyDescriptor *desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
@@ -3228,41 +3228,47 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::has(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
xpc::SandboxProxyHandler::has(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
return BaseProxyHandler::has(cx, proxy, id, bp);
|
return BaseProxyHandler::has(cx, proxy, id, bp);
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::hasOwn(JSContext *cx, JSObject *proxy, jsid id,
|
xpc::SandboxProxyHandler::hasOwn(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
bool *bp)
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
return BaseProxyHandler::hasOwn(cx, proxy, id, bp);
|
return BaseProxyHandler::hasOwn(cx, proxy, id, bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::get(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
xpc::SandboxProxyHandler::get(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
jsid id, Value *vp)
|
JS::Handle<JSObject*> receiver,
|
||||||
|
JS::Handle<jsid> id,
|
||||||
|
JS::MutableHandle<Value> vp)
|
||||||
{
|
{
|
||||||
return BaseProxyHandler::get(cx, proxy, receiver, id, vp);
|
return BaseProxyHandler::get(cx, proxy, receiver, id, vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
xpc::SandboxProxyHandler::set(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
jsid id, bool strict, Value *vp)
|
JS::Handle<JSObject*> receiver,
|
||||||
|
JS::Handle<jsid> id,
|
||||||
|
bool strict,
|
||||||
|
JS::MutableHandle<Value> vp)
|
||||||
{
|
{
|
||||||
return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp);
|
return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::keys(JSContext *cx, JS::Handle<JSObject *> proxy,
|
xpc::SandboxProxyHandler::keys(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
AutoIdVector &props)
|
AutoIdVector &props)
|
||||||
{
|
{
|
||||||
return BaseProxyHandler::keys(cx, proxy, props);
|
return BaseProxyHandler::keys(cx, proxy, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
xpc::SandboxProxyHandler::iterate(JSContext *cx, JSObject *proxy, unsigned flags,
|
xpc::SandboxProxyHandler::iterate(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
Value *vp)
|
unsigned flags, JS::MutableHandle<Value> vp)
|
||||||
{
|
{
|
||||||
return BaseProxyHandler::iterate(cx, proxy, flags, vp);
|
return BaseProxyHandler::iterate(cx, proxy, flags, vp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ ChromeObjectWrapper ChromeObjectWrapper::singleton;
|
|||||||
using js::assertEnteredPolicy;
|
using js::assertEnteredPolicy;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
AllowedByBase(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act)
|
AllowedByBase(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
|
js::Wrapper::Action act)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) ==
|
MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) ==
|
||||||
&ChromeObjectWrapper::singleton);
|
&ChromeObjectWrapper::singleton);
|
||||||
@@ -40,11 +41,9 @@ PropIsFromStandardPrototype(JSContext *cx, JSPropertyDescriptor *desc)
|
|||||||
// This lets us determine whether the property we would have found (given a
|
// This lets us determine whether the property we would have found (given a
|
||||||
// transparent wrapper) would have come off a standard prototype.
|
// transparent wrapper) would have come off a standard prototype.
|
||||||
static bool
|
static bool
|
||||||
PropIsFromStandardPrototype(JSContext *cx, JSObject *wrapperArg, jsid idArg)
|
PropIsFromStandardPrototype(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
JS::Handle<jsid> id)
|
||||||
{
|
{
|
||||||
JS::Rooted<JSObject *> wrapper(cx, wrapperArg);
|
|
||||||
JS::Rooted<jsid> id(cx, idArg);
|
|
||||||
|
|
||||||
MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) ==
|
MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) ==
|
||||||
&ChromeObjectWrapper::singleton);
|
&ChromeObjectWrapper::singleton);
|
||||||
JSPropertyDescriptor desc;
|
JSPropertyDescriptor desc;
|
||||||
@@ -60,7 +59,7 @@ PropIsFromStandardPrototype(JSContext *cx, JSObject *wrapperArg, jsid idArg)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
|
ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
|
||||||
JS::Handle<JSObject *> wrapper,
|
JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
js::PropertyDescriptor *desc,
|
js::PropertyDescriptor *desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
@@ -93,7 +92,8 @@ ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ChromeObjectWrapper::has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
|
ChromeObjectWrapper::has(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, id);
|
assertEnteredPolicy(cx, wrapper, id);
|
||||||
// Try the lookup on the base wrapper if permitted.
|
// Try the lookup on the base wrapper if permitted.
|
||||||
@@ -120,11 +120,12 @@ ChromeObjectWrapper::has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ChromeObjectWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
ChromeObjectWrapper::get(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
jsid id, js::Value *vp)
|
JS::Handle<JSObject*> receiver, JS::Handle<jsid> id,
|
||||||
|
JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, id);
|
assertEnteredPolicy(cx, wrapper, id);
|
||||||
vp->setUndefined();
|
vp.setUndefined();
|
||||||
JSPropertyDescriptor desc;
|
JSPropertyDescriptor desc;
|
||||||
// Only call through to the get trap on the underlying object if we're
|
// Only call through to the get trap on the underlying object if we're
|
||||||
// allowed to see the property, and if what we'll find is not on a standard
|
// allowed to see the property, and if what we'll find is not on a standard
|
||||||
@@ -136,7 +137,7 @@ ChromeObjectWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
|||||||
if (!ChromeObjectWrapperBase::get(cx, wrapper, receiver, id, vp))
|
if (!ChromeObjectWrapperBase::get(cx, wrapper, receiver, id, vp))
|
||||||
return false;
|
return false;
|
||||||
// If we found something, we're done.
|
// If we found something, we're done.
|
||||||
if (!vp->isUndefined())
|
if (!vp.isUndefined())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,14 +150,14 @@ ChromeObjectWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
|||||||
|
|
||||||
// Try the prototype.
|
// Try the prototype.
|
||||||
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
|
||||||
return js::GetGeneric(cx, wrapperProto, receiver, id, vp);
|
return js::GetGeneric(cx, wrapperProto, receiver, id, vp.address());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecurityWrapper categorically returns false for objectClassIs, but the
|
// SecurityWrapper categorically returns false for objectClassIs, but the
|
||||||
// contacts API depends on Array.isArray returning true for COW-implemented
|
// contacts API depends on Array.isArray returning true for COW-implemented
|
||||||
// contacts. This isn't really ideal, but make it work for now.
|
// contacts. This isn't really ideal, but make it work for now.
|
||||||
bool
|
bool
|
||||||
ChromeObjectWrapper::objectClassIs(JSObject *obj, js::ESClassValue classValue,
|
ChromeObjectWrapper::objectClassIs(JS::Handle<JSObject*> obj, js::ESClassValue classValue,
|
||||||
JSContext *cx)
|
JSContext *cx)
|
||||||
{
|
{
|
||||||
return CrossCompartmentWrapper::objectClassIs(obj, classValue, cx);
|
return CrossCompartmentWrapper::objectClassIs(obj, classValue, cx);
|
||||||
@@ -167,8 +168,8 @@ ChromeObjectWrapper::objectClassIs(JSObject *obj, js::ESClassValue classValue,
|
|||||||
// enforcement or COWs isn't cheap. But it results in the cleanest code, and this
|
// enforcement or COWs isn't cheap. But it results in the cleanest code, and this
|
||||||
// whole proto remapping thing for COWs is going to be phased out anyway.
|
// whole proto remapping thing for COWs is going to be phased out anyway.
|
||||||
bool
|
bool
|
||||||
ChromeObjectWrapper::enter(JSContext *cx, JSObject *wrapper, jsid id,
|
ChromeObjectWrapper::enter(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::Wrapper::Action act, bool *bp)
|
JS::Handle<jsid> id, js::Wrapper::Action act, bool *bp)
|
||||||
{
|
{
|
||||||
if (AllowedByBase(cx, wrapper, id, act))
|
if (AllowedByBase(cx, wrapper, id, act))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -29,18 +29,18 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase
|
|||||||
ChromeObjectWrapper() : ChromeObjectWrapperBase(0) {}
|
ChromeObjectWrapper() : ChromeObjectWrapperBase(0) {}
|
||||||
|
|
||||||
/* Custom traps. */
|
/* Custom traps. */
|
||||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
unsigned flags) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
virtual bool has(JSContext *cx, JSObject *wrapper, jsid id,
|
virtual bool has(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
bool *bp) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
virtual bool get(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,
|
||||||
jsid id, js::Value *vp) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool objectClassIs(JSObject *obj, js::ESClassValue classValue,
|
virtual bool objectClassIs(JS::Handle<JSObject*> obj, js::ESClassValue classValue,
|
||||||
JSContext *cx) MOZ_OVERRIDE;
|
JSContext *cx) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id,
|
virtual bool enter(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE;
|
js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE;
|
||||||
|
|
||||||
// NB: One might think we'd need to implement enumerate(), keys(), iterate(),
|
// NB: One might think we'd need to implement enumerate(), keys(), iterate(),
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ FilteringWrapper<Base, Policy>::isSafeToUnwrap()
|
|||||||
|
|
||||||
template <typename Policy>
|
template <typename Policy>
|
||||||
static bool
|
static bool
|
||||||
Filter(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
|
Filter(JSContext *cx, JS::Handle<JSObject*> wrapper, AutoIdVector &props)
|
||||||
{
|
{
|
||||||
size_t w = 0;
|
size_t w = 0;
|
||||||
for (size_t n = 0; n < props.length(); ++n) {
|
for (size_t n = 0; n < props.length(); ++n) {
|
||||||
@@ -67,7 +67,7 @@ FilterSetter(JSContext *cx, JSObject *wrapper, jsid id, js::PropertyDescriptor *
|
|||||||
|
|
||||||
template <typename Base, typename Policy>
|
template <typename Base, typename Policy>
|
||||||
bool
|
bool
|
||||||
FilteringWrapper<Base, Policy>::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
FilteringWrapper<Base, Policy>::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
js::PropertyDescriptor *desc, unsigned flags)
|
js::PropertyDescriptor *desc, unsigned flags)
|
||||||
{
|
{
|
||||||
@@ -79,7 +79,7 @@ FilteringWrapper<Base, Policy>::getPropertyDescriptor(JSContext *cx, JS::Handle<
|
|||||||
|
|
||||||
template <typename Base, typename Policy>
|
template <typename Base, typename Policy>
|
||||||
bool
|
bool
|
||||||
FilteringWrapper<Base, Policy>::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
FilteringWrapper<Base, Policy>::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
js::PropertyDescriptor *desc,
|
js::PropertyDescriptor *desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
@@ -92,7 +92,7 @@ FilteringWrapper<Base, Policy>::getOwnPropertyDescriptor(JSContext *cx, JS::Hand
|
|||||||
|
|
||||||
template <typename Base, typename Policy>
|
template <typename Base, typename Policy>
|
||||||
bool
|
bool
|
||||||
FilteringWrapper<Base, Policy>::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
FilteringWrapper<Base, Policy>::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
AutoIdVector &props)
|
AutoIdVector &props)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
@@ -102,7 +102,8 @@ FilteringWrapper<Base, Policy>::getOwnPropertyNames(JSContext *cx, JS::Handle<JS
|
|||||||
|
|
||||||
template <typename Base, typename Policy>
|
template <typename Base, typename Policy>
|
||||||
bool
|
bool
|
||||||
FilteringWrapper<Base, Policy>::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
|
FilteringWrapper<Base, Policy>::enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
AutoIdVector &props)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
return Base::enumerate(cx, wrapper, props) &&
|
return Base::enumerate(cx, wrapper, props) &&
|
||||||
@@ -111,7 +112,7 @@ FilteringWrapper<Base, Policy>::enumerate(JSContext *cx, JSObject *wrapper, Auto
|
|||||||
|
|
||||||
template <typename Base, typename Policy>
|
template <typename Base, typename Policy>
|
||||||
bool
|
bool
|
||||||
FilteringWrapper<Base, Policy>::keys(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
FilteringWrapper<Base, Policy>::keys(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
AutoIdVector &props)
|
AutoIdVector &props)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
@@ -121,7 +122,8 @@ FilteringWrapper<Base, Policy>::keys(JSContext *cx, JS::Handle<JSObject *> wrapp
|
|||||||
|
|
||||||
template <typename Base, typename Policy>
|
template <typename Base, typename Policy>
|
||||||
bool
|
bool
|
||||||
FilteringWrapper<Base, Policy>::iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *vp)
|
FilteringWrapper<Base, Policy>::iterate(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
unsigned flags, JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
// We refuse to trigger the iterator hook across chrome wrappers because
|
// We refuse to trigger the iterator hook across chrome wrappers because
|
||||||
@@ -143,8 +145,8 @@ FilteringWrapper<Base, Policy>::nativeCall(JSContext *cx, JS::IsAcceptableThis t
|
|||||||
|
|
||||||
template <typename Base, typename Policy>
|
template <typename Base, typename Policy>
|
||||||
bool
|
bool
|
||||||
FilteringWrapper<Base, Policy>::enter(JSContext *cx, JSObject *wrapper, jsid id,
|
FilteringWrapper<Base, Policy>::enter(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
Wrapper::Action act, bool *bp)
|
JS::Handle<jsid> id, Wrapper::Action act, bool *bp)
|
||||||
{
|
{
|
||||||
// This is a super ugly hacky to get around Xray Resolve wonkiness.
|
// This is a super ugly hacky to get around Xray Resolve wonkiness.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -22,16 +22,25 @@ class FilteringWrapper : public Base {
|
|||||||
// This is potentially dynamic until XBL scopes are no longer behind a pref.
|
// This is potentially dynamic until XBL scopes are no longer behind a pref.
|
||||||
virtual bool isSafeToUnwrap();
|
virtual bool isSafeToUnwrap();
|
||||||
|
|
||||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> wrapper, js::AutoIdVector &props) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props) MOZ_OVERRIDE;
|
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
virtual bool keys(JSContext *cx, JS::Handle<JSObject *> wrapper, js::AutoIdVector &props) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, js::Value *vp) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
|
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
js::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
virtual bool enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
js::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
virtual bool keys(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
js::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned flags,
|
||||||
|
JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl,
|
virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl,
|
||||||
JS::CallArgs args) MOZ_OVERRIDE;
|
JS::CallArgs args) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE;
|
virtual bool enter(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
|
js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE;
|
||||||
|
|
||||||
static FilteringWrapper singleton;
|
static FilteringWrapper singleton;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ WaiveXrayWrapper::~WaiveXrayWrapper()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *>wrapper,
|
WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*>wrapper,
|
||||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@ WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *>wra
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
{
|
{
|
||||||
@@ -42,26 +42,28 @@ WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *>
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WaiveXrayWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
WaiveXrayWrapper::get(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::Value *vp)
|
JS::Handle<JSObject*> receiver, JS::Handle<jsid> id,
|
||||||
|
JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) &&
|
return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) &&
|
||||||
WrapperFactory::WaiveXrayAndWrap(cx, vp);
|
WrapperFactory::WaiveXrayAndWrap(cx, vp.address());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WaiveXrayWrapper::call(JSContext *cx, JSObject *wrapper, unsigned argc, js::Value *vp)
|
WaiveXrayWrapper::call(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc,
|
||||||
|
js::Value *vp)
|
||||||
{
|
{
|
||||||
return CrossCompartmentWrapper::call(cx, wrapper, argc, vp) &&
|
return CrossCompartmentWrapper::call(cx, wrapper, argc, vp) &&
|
||||||
WrapperFactory::WaiveXrayAndWrap(cx, vp);
|
WrapperFactory::WaiveXrayAndWrap(cx, vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WaiveXrayWrapper::construct(JSContext *cx, JSObject *wrapper,
|
WaiveXrayWrapper::construct(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
unsigned argc, js::Value *argv, js::Value *rval)
|
unsigned argc, js::Value *argv, JS::MutableHandle<JS::Value> rval)
|
||||||
{
|
{
|
||||||
return CrossCompartmentWrapper::construct(cx, wrapper, argc, argv, rval) &&
|
return CrossCompartmentWrapper::construct(cx, wrapper, argc, argv, rval) &&
|
||||||
WrapperFactory::WaiveXrayAndWrap(cx, rval);
|
WrapperFactory::WaiveXrayAndWrap(cx, rval.address());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,15 +20,21 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper {
|
|||||||
WaiveXrayWrapper(unsigned flags);
|
WaiveXrayWrapper(unsigned flags);
|
||||||
virtual ~WaiveXrayWrapper();
|
virtual ~WaiveXrayWrapper();
|
||||||
|
|
||||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id, js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id,
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::Value *vp) MOZ_OVERRIDE;
|
JS::Handle<jsid> id,
|
||||||
|
js::PropertyDescriptor *desc,
|
||||||
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
|
virtual bool get(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,
|
||||||
|
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, js::Value *vp) MOZ_OVERRIDE;
|
virtual bool call(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc,
|
||||||
virtual bool construct(JSContext *cx, JSObject *wrapper,
|
js::Value *vp) MOZ_OVERRIDE;
|
||||||
unsigned argc, js::Value *argv, js::Value *rval) MOZ_OVERRIDE;
|
virtual bool construct(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
unsigned argc, js::Value *argv,
|
||||||
|
JS::MutableHandle<JS::Value> rval) MOZ_OVERRIDE;
|
||||||
|
|
||||||
static WaiveXrayWrapper singleton;
|
static WaiveXrayWrapper singleton;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -135,12 +135,12 @@ public:
|
|||||||
JSObject *wrapper, JSObject *holder,
|
JSObject *wrapper, JSObject *holder,
|
||||||
jsid id, JSPropertyDescriptor *desc, unsigned flags);
|
jsid id, JSPropertyDescriptor *desc, unsigned flags);
|
||||||
|
|
||||||
static bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp)
|
static bool call(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
MOZ_NOT_REACHED("Call trap currently implemented only for XPCWNs");
|
MOZ_NOT_REACHED("Call trap currently implemented only for XPCWNs");
|
||||||
}
|
}
|
||||||
static bool construct(JSContext *cx, JSObject *wrapper, unsigned argc,
|
static bool construct(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc,
|
||||||
Value *argv, Value *rval)
|
Value *argv, JS::MutableHandle<Value> rval)
|
||||||
{
|
{
|
||||||
MOZ_NOT_REACHED("Call trap currently implemented only for XPCWNs");
|
MOZ_NOT_REACHED("Call trap currently implemented only for XPCWNs");
|
||||||
}
|
}
|
||||||
@@ -182,16 +182,16 @@ public:
|
|||||||
virtual bool resolveOwnProperty(JSContext *cx, js::Wrapper &jsWrapper, JSObject *wrapper,
|
virtual bool resolveOwnProperty(JSContext *cx, js::Wrapper &jsWrapper, JSObject *wrapper,
|
||||||
JSObject *holder, jsid id, JSPropertyDescriptor *desc,
|
JSObject *holder, jsid id, JSPropertyDescriptor *desc,
|
||||||
unsigned flags);
|
unsigned flags);
|
||||||
static bool defineProperty(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
static bool defineProperty(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid>,
|
JS::Handle<jsid>,
|
||||||
PropertyDescriptor *desc,
|
PropertyDescriptor *desc,
|
||||||
PropertyDescriptor &existingDesc,
|
PropertyDescriptor &existingDesc,
|
||||||
bool *defined);
|
bool *defined);
|
||||||
static bool enumerateNames(JSContext *cx, JSObject *wrapper, unsigned flags,
|
static bool enumerateNames(JSContext *cx, JSObject *wrapper, unsigned flags,
|
||||||
JS::AutoIdVector &props);
|
JS::AutoIdVector &props);
|
||||||
static bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp);
|
static bool call(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc, Value *vp);
|
||||||
static bool construct(JSContext *cx, JSObject *wrapper, unsigned argc,
|
static bool construct(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc,
|
||||||
Value *argv, Value *rval);
|
Value *argv, JS::MutableHandle<JS::Value> rval);
|
||||||
|
|
||||||
static bool isResolving(JSContext *cx, JSObject *holder, jsid id);
|
static bool isResolving(JSContext *cx, JSObject *holder, jsid id);
|
||||||
|
|
||||||
@@ -233,9 +233,9 @@ public:
|
|||||||
bool *defined);
|
bool *defined);
|
||||||
static bool enumerateNames(JSContext *cx, JSObject *wrapper, unsigned flags,
|
static bool enumerateNames(JSContext *cx, JSObject *wrapper, unsigned flags,
|
||||||
JS::AutoIdVector &props);
|
JS::AutoIdVector &props);
|
||||||
static bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp);
|
static bool call(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc, Value *vp);
|
||||||
static bool construct(JSContext *cx, JSObject *wrapper, unsigned argc,
|
static bool construct(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc,
|
||||||
Value *argv, Value *rval);
|
Value *argv, JS::MutableHandle<JS::Value> rval);
|
||||||
|
|
||||||
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
|
static bool isResolving(JSContext *cx, JSObject *holder, jsid id)
|
||||||
{
|
{
|
||||||
@@ -1109,7 +1109,7 @@ XPCWrappedNativeXrayTraits::createHolder(JSContext *cx, JSObject *wrapper)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XPCWrappedNativeXrayTraits::call(JSContext *cx, JSObject *wrapper,
|
XPCWrappedNativeXrayTraits::call(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
unsigned argc, Value *vp)
|
unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
// Run the resolve hook of the wrapped native.
|
// Run the resolve hook of the wrapped native.
|
||||||
@@ -1134,18 +1134,20 @@ XPCWrappedNativeXrayTraits::call(JSContext *cx, JSObject *wrapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XPCWrappedNativeXrayTraits::construct(JSContext *cx, JSObject *wrapper,
|
XPCWrappedNativeXrayTraits::construct(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
unsigned argc, Value *argv, Value *rval)
|
unsigned argc, Value *argv,
|
||||||
|
JS::MutableHandle<JS::Value> rval)
|
||||||
{
|
{
|
||||||
// Run the resolve hook of the wrapped native.
|
// Run the resolve hook of the wrapped native.
|
||||||
XPCWrappedNative *wn = getWN(wrapper);
|
XPCWrappedNative *wn = getWN(wrapper);
|
||||||
if (NATIVE_HAS_FLAG(wn, WantConstruct)) {
|
if (NATIVE_HAS_FLAG(wn, WantConstruct)) {
|
||||||
XPCCallContext ccx(JS_CALLER, cx, wrapper, nullptr, JSID_VOID, argc, argv, rval);
|
XPCCallContext ccx(JS_CALLER, cx, wrapper, nullptr, JSID_VOID, argc, argv, rval.address());
|
||||||
if (!ccx.IsValid())
|
if (!ccx.IsValid())
|
||||||
return false;
|
return false;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
nsresult rv = wn->GetScriptableInfo()->GetCallback()->Construct(wn, cx, wrapper,
|
nsresult rv = wn->GetScriptableInfo()->GetCallback()->Construct(wn, cx, wrapper,
|
||||||
argc, argv, rval, &ok);
|
argc, argv, rval.address(),
|
||||||
|
&ok);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
if (ok)
|
if (ok)
|
||||||
XPCThrower::Throw(rv, cx);
|
XPCThrower::Throw(rv, cx);
|
||||||
@@ -1218,7 +1220,7 @@ DOMXrayTraits::enumerateNames(JSContext *cx, JSObject *wrapper, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMXrayTraits::call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp)
|
DOMXrayTraits::call(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
JSObject *obj = getTargetObject(wrapper);
|
JSObject *obj = getTargetObject(wrapper);
|
||||||
AutoValueRooter rval(cx);
|
AutoValueRooter rval(cx);
|
||||||
@@ -1241,8 +1243,8 @@ DOMXrayTraits::call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMXrayTraits::construct(JSContext *cx, JSObject *wrapper, unsigned argc,
|
DOMXrayTraits::construct(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc,
|
||||||
Value *argv, Value *rval)
|
Value *argv, JS::MutableHandle<JS::Value> rval)
|
||||||
{
|
{
|
||||||
JSObject *obj = getTargetObject(wrapper);
|
JSObject *obj = getTargetObject(wrapper);
|
||||||
MOZ_ASSERT(mozilla::dom::HasConstructor(obj));
|
MOZ_ASSERT(mozilla::dom::HasConstructor(obj));
|
||||||
@@ -1257,7 +1259,7 @@ DOMXrayTraits::construct(JSContext *cx, JSObject *wrapper, unsigned argc,
|
|||||||
}
|
}
|
||||||
if (!newObj || !JS_WrapObject(cx, &newObj))
|
if (!newObj || !JS_WrapObject(cx, &newObj))
|
||||||
return false;
|
return false;
|
||||||
rval->setObject(*newObj);
|
rval.setObject(*newObj);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1415,7 +1417,7 @@ DEBUG_CheckXBLLookup(JSContext *cx, JSPropertyDescriptor *desc)
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
js::PropertyDescriptor *desc, unsigned flags)
|
js::PropertyDescriptor *desc, unsigned flags)
|
||||||
{
|
{
|
||||||
@@ -1558,7 +1560,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JS::Handle<JSObj
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id,
|
JS::Handle<jsid> id,
|
||||||
PropertyDescriptor *desc, unsigned flags)
|
PropertyDescriptor *desc, unsigned flags)
|
||||||
{
|
{
|
||||||
@@ -1606,8 +1608,8 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JS
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
|
XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::PropertyDescriptor *desc)
|
HandleId id, js::PropertyDescriptor *desc)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, id);
|
assertEnteredPolicy(cx, wrapper, id);
|
||||||
// Redirect access straight to the wrapper if we should be transparent.
|
// Redirect access straight to the wrapper if we should be transparent.
|
||||||
@@ -1659,7 +1661,7 @@ XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, HandleObject wrapper, H
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
XrayWrapper<Base, Traits>::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::AutoIdVector &props)
|
JS::AutoIdVector &props)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
@@ -1668,7 +1670,7 @@ XrayWrapper<Base, Traits>::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObjec
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::delete_(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
XrayWrapper<Base, Traits>::delete_(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id, bool *bp)
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, id);
|
assertEnteredPolicy(cx, wrapper, id);
|
||||||
@@ -1705,7 +1707,7 @@ XrayWrapper<Base, Traits>::delete_(JSContext *cx, JS::Handle<JSObject *> wrapper
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::enumerate(JSContext *cx, JSObject *wrapper, unsigned flags,
|
XrayWrapper<Base, Traits>::enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned flags,
|
||||||
JS::AutoIdVector &props)
|
JS::AutoIdVector &props)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
@@ -1738,15 +1740,17 @@ XrayWrapper<Base, Traits>::enumerate(JSContext *cx, JSObject *wrapper, unsigned
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::enumerate(JSContext *cx, JSObject *wrapper, JS::AutoIdVector &props)
|
XrayWrapper<Base, Traits>::enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
JS::AutoIdVector &props)
|
||||||
{
|
{
|
||||||
return enumerate(cx, wrapper, 0, props);
|
return enumerate(cx, wrapper, 0, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
XrayWrapper<Base, Traits>::get(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::Value *vp)
|
JS::Handle<JSObject*> receiver, JS::Handle<jsid> id,
|
||||||
|
JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
// Skip our Base if it isn't already ProxyHandler.
|
// Skip our Base if it isn't already ProxyHandler.
|
||||||
// NB: None of the functions we call are prepared for the receiver not
|
// NB: None of the functions we call are prepared for the receiver not
|
||||||
@@ -1756,8 +1760,9 @@ XrayWrapper<Base, Traits>::get(JSContext *cx, JSObject *wrapper, JSObject *recei
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
XrayWrapper<Base, Traits>::set(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
bool strict, js::Value *vp)
|
JS::Handle<JSObject*> receiver, JS::Handle<jsid> id,
|
||||||
|
bool strict, JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
// Skip our Base if it isn't already BaseProxyHandler.
|
// Skip our Base if it isn't already BaseProxyHandler.
|
||||||
// NB: None of the functions we call are prepared for the receiver not
|
// NB: None of the functions we call are prepared for the receiver not
|
||||||
@@ -1767,7 +1772,8 @@ XrayWrapper<Base, Traits>::set(JSContext *cx, JSObject *wrapper, JSObject *recei
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
|
XrayWrapper<Base, Traits>::has(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
// Skip our Base if it isn't already ProxyHandler.
|
// Skip our Base if it isn't already ProxyHandler.
|
||||||
return BaseProxyHandler::has(cx, wrapper, id, bp);
|
return BaseProxyHandler::has(cx, wrapper, id, bp);
|
||||||
@@ -1775,7 +1781,8 @@ XrayWrapper<Base, Traits>::has(JSContext *cx, JSObject *wrapper, jsid id, bool *
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
|
XrayWrapper<Base, Traits>::hasOwn(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
// Skip our Base if it isn't already ProxyHandler.
|
// Skip our Base if it isn't already ProxyHandler.
|
||||||
return BaseProxyHandler::hasOwn(cx, wrapper, id, bp);
|
return BaseProxyHandler::hasOwn(cx, wrapper, id, bp);
|
||||||
@@ -1783,7 +1790,7 @@ XrayWrapper<Base, Traits>::hasOwn(JSContext *cx, JSObject *wrapper, jsid id, boo
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::keys(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
XrayWrapper<Base, Traits>::keys(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::AutoIdVector &props)
|
JS::AutoIdVector &props)
|
||||||
{
|
{
|
||||||
// Skip our Base if it isn't already ProxyHandler.
|
// Skip our Base if it isn't already ProxyHandler.
|
||||||
@@ -1792,8 +1799,8 @@ XrayWrapper<Base, Traits>::keys(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::iterate(JSContext *cx, JSObject *wrapper, unsigned flags,
|
XrayWrapper<Base, Traits>::iterate(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::Value *vp)
|
unsigned flags, JS::MutableHandle<JS::Value> vp)
|
||||||
{
|
{
|
||||||
// Skip our Base if it isn't already ProxyHandler.
|
// Skip our Base if it isn't already ProxyHandler.
|
||||||
return BaseProxyHandler::iterate(cx, wrapper, flags, vp);
|
return BaseProxyHandler::iterate(cx, wrapper, flags, vp);
|
||||||
@@ -1801,7 +1808,8 @@ XrayWrapper<Base, Traits>::iterate(JSContext *cx, JSObject *wrapper, unsigned fl
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::call(JSContext *cx, JSObject *wrapper, unsigned argc, js::Value *vp)
|
XrayWrapper<Base, Traits>::call(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
unsigned argc, js::Value *vp)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
return Traits::call(cx, wrapper, argc, vp);
|
return Traits::call(cx, wrapper, argc, vp);
|
||||||
@@ -1809,8 +1817,9 @@ XrayWrapper<Base, Traits>::call(JSContext *cx, JSObject *wrapper, unsigned argc,
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::construct(JSContext *cx, JSObject *wrapper, unsigned argc,
|
XrayWrapper<Base, Traits>::construct(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::Value *argv, js::Value *rval)
|
unsigned argc, JS::Value *argv,
|
||||||
|
JS::MutableHandle<JS::Value> rval)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||||
return Traits::construct(cx, wrapper, argc, argv, rval);
|
return Traits::construct(cx, wrapper, argc, argv, rval);
|
||||||
|
|||||||
@@ -66,37 +66,43 @@ class XrayWrapper : public Base {
|
|||||||
virtual ~XrayWrapper();
|
virtual ~XrayWrapper();
|
||||||
|
|
||||||
/* Fundamental proxy traps. */
|
/* Fundamental proxy traps. */
|
||||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id,
|
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
js::PropertyDescriptor *desc, unsigned flags);
|
||||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id,
|
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
js::PropertyDescriptor *desc,
|
js::PropertyDescriptor *desc,
|
||||||
unsigned flags) MOZ_OVERRIDE;
|
unsigned flags);
|
||||||
virtual bool defineProperty(JSContext *cx, JS::Handle<JSObject *> wrapper, JS::Handle<jsid> id,
|
virtual bool defineProperty(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
js::PropertyDescriptor *desc);
|
js::PropertyDescriptor *desc);
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
js::AutoIdVector &props);
|
js::AutoIdVector &props);
|
||||||
virtual bool delete_(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
virtual bool delete_(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
JS::Handle<jsid> id, bool *bp);
|
JS::Handle<jsid> id, bool *bp);
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props);
|
virtual bool enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper, js::AutoIdVector &props);
|
||||||
|
|
||||||
/* Derived proxy traps. */
|
/* Derived proxy traps. */
|
||||||
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
virtual bool get(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,
|
||||||
js::Value *vp);
|
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp);
|
||||||
virtual bool set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id,
|
virtual bool set(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,
|
||||||
bool strict, js::Value *vp);
|
JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp);
|
||||||
virtual bool has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp);
|
virtual bool has(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
virtual bool hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp);
|
bool *bp);
|
||||||
virtual bool keys(JSContext *cx, JS::Handle<JSObject *> wrapper, js::AutoIdVector &props);
|
virtual bool hasOwn(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
|
||||||
virtual bool iterate(JSContext *cx, JSObject *wrapper, unsigned flags, js::Value *vp);
|
bool *bp);
|
||||||
|
virtual bool keys(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
js::AutoIdVector &props);
|
||||||
|
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned flags,
|
||||||
|
JS::MutableHandle<JS::Value> vp);
|
||||||
|
|
||||||
virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, js::Value *vp);
|
virtual bool call(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned argc,
|
||||||
virtual bool construct(JSContext *cx, JSObject *wrapper,
|
js::Value *vp);
|
||||||
unsigned argc, js::Value *argv, js::Value *rval);
|
virtual bool construct(JSContext *cx, JS::Handle<JSObject*> wrapper,
|
||||||
|
unsigned argc, js::Value *argv,
|
||||||
|
JS::MutableHandle<JS::Value> rval);
|
||||||
|
|
||||||
static XrayWrapper singleton;
|
static XrayWrapper singleton;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool enumerate(JSContext *cx, JSObject *wrapper, unsigned flags,
|
bool enumerate(JSContext *cx, JS::Handle<JSObject*> wrapper, unsigned flags,
|
||||||
JS::AutoIdVector &props);
|
JS::AutoIdVector &props);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,24 +120,27 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
js::PropertyDescriptor *desc, unsigned flags) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject *> proxy,
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
|
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
JS::Handle<jsid> id, js::PropertyDescriptor *desc,
|
||||||
unsigned flags) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
|
|
||||||
// We just forward the derived traps to the BaseProxyHandler versions which
|
// We just forward the derived traps to the BaseProxyHandler versions which
|
||||||
// implement them in terms of the fundamental traps.
|
// implement them in terms of the fundamental traps.
|
||||||
virtual bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp) MOZ_OVERRIDE;
|
virtual bool has(JSContext *cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
|
||||||
virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp) MOZ_OVERRIDE;
|
bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
virtual bool hasOwn(JSContext *cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
|
||||||
jsid id, JS::Value *vp) MOZ_OVERRIDE;
|
bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
virtual bool get(JSContext *cx, JS::Handle<JSObject*> proxy, JS::Handle<JSObject*> receiver,
|
||||||
jsid id, bool strict, JS::Value *vp) MOZ_OVERRIDE;
|
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
virtual bool keys(JSContext *cx, JS::Handle<JSObject *> proxy,
|
virtual bool set(JSContext *cx, JS::Handle<JSObject*> proxy, JS::Handle<JSObject*> receiver,
|
||||||
|
JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
|
virtual bool keys(JSContext *cx, JS::Handle<JSObject*> proxy,
|
||||||
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags,
|
virtual bool iterate(JSContext *cx, JS::Handle<JSObject*> proxy, unsigned flags,
|
||||||
JS::Value *vp) MOZ_OVERRIDE;
|
JS::MutableHandle<JS::Value> vp) MOZ_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SandboxProxyHandler sandboxProxyHandler;
|
extern SandboxProxyHandler sandboxProxyHandler;
|
||||||
@@ -145,7 +154,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc,
|
virtual bool call(JSContext *cx, JS::Handle<JSObject*> proxy, unsigned argc,
|
||||||
JS::Value *vp);
|
JS::Value *vp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user