Fix for bug 717009 (Inline ListBase<LC>::instanceIsListObject and ListBase<LC>::getListObject). r=bz.

--HG--
extra : rebase_source : 661d5fc98c76506ab6abccd057a0ce1e8cf6b0f8
This commit is contained in:
Peter Van der Beken 2011-11-09 11:37:47 +01:00
parent 4f1d6f1a15
commit 56a33403d0
2 changed files with 19 additions and 11 deletions

View File

@ -306,19 +306,27 @@ ListBase<LC>::setProtoShape(JSObject *obj, js::Shape *shape)
js::SetProxyExtra(obj, JSPROXYSLOT_PROTOSHAPE, PrivateValue(shape));
}
static JSBool
UnwrapSecurityWrapper(JSContext *cx, JSObject *obj, JSObject *callee, JSObject **unwrapped)
{
JS_ASSERT(XPCWrapper::IsSecurityWrapper(obj));
if (callee && JS_GetGlobalForObject(cx, obj) == JS_GetGlobalForObject(cx, callee)) {
*unwrapped = js::UnwrapObject(obj);
} else {
*unwrapped = XPCWrapper::Unwrap(cx, obj);
if (!*unwrapped)
return Throw(cx, NS_ERROR_XPC_SECURITY_MANAGER_VETO);
}
return true;
}
template<class LC>
bool
ListBase<LC>::instanceIsListObject(JSContext *cx, JSObject *obj, JSObject *callee)
{
if (XPCWrapper::IsSecurityWrapper(obj)) {
if (callee && JS_GetGlobalForObject(cx, obj) == JS_GetGlobalForObject(cx, callee)) {
obj = js::UnwrapObject(obj);
} else {
obj = XPCWrapper::Unwrap(cx, obj);
if (!obj)
return Throw(cx, NS_ERROR_XPC_SECURITY_MANAGER_VETO);
}
}
if (XPCWrapper::IsSecurityWrapper(obj) && !UnwrapSecurityWrapper(cx, obj, callee, &obj))
return false;
if (!objIsList(obj)) {
// FIXME: Throw a proper DOM exception.

View File

@ -246,12 +246,12 @@ public:
static bool objIsList(JSObject *obj) {
return js::IsProxy(obj) && proxyHandlerIsList(js::GetProxyHandler(obj));
}
static bool instanceIsListObject(JSContext *cx, JSObject *obj, JSObject *callee);
static inline bool instanceIsListObject(JSContext *cx, JSObject *obj, JSObject *callee);
virtual bool isInstanceOf(JSObject *prototype)
{
return js::GetObjectClass(prototype) == &sInterfaceClass;
}
static ListType *getListObject(JSObject *obj);
static inline ListType *getListObject(JSObject *obj);
static JSObject *getPrototype(JSContext *cx, XPCWrappedNativeScope *scope);
static inline bool protoIsClean(JSContext *cx, JSObject *proto, bool *isClean);