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

--HG--
extra : rebase_source : 368514fa942cb31751e5c6b4ff9d206c1bb609bc
This commit is contained in:
Peter Van der Beken 2011-11-09 11:37:47 +01:00
parent 85e454d39a
commit 801dbb695f
2 changed files with 19 additions and 11 deletions

View File

@ -304,19 +304,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);