Bug 823225. Move .wrappedJSObject from nsWindowSH::GetProperty to the outer window get hook. r=mrbkap

This commit is contained in:
Boris Zbarsky 2013-01-02 22:03:41 -05:00
parent 9e58bd1f8f
commit 71e5c36a75
2 changed files with 23 additions and 9 deletions

View File

@ -5169,13 +5169,6 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
}
}
if (id == sWrappedJSObject_id &&
xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) {
obj = JS_ObjectToOuterObject(cx, obj);
*vp = OBJECT_TO_JSVAL(obj);
return NS_SUCCESS_I_DID_SOMETHING;
}
return NS_OK;
}

View File

@ -227,6 +227,12 @@
#include "nsPISocketTransportService.h"
#include "mozilla/dom/AudioContext.h"
// Apple system headers seem to have a check() macro. <sigh>
#ifdef check
#undef check
#endif // check
#include "AccessCheck.h"
#ifdef ANDROID
#include <android/log.h>
#endif
@ -525,8 +531,10 @@ public:
virtual bool isOuterWindow() {
return true;
}
JSString *obj_toString(JSContext *cx, JSObject *wrapper);
void finalize(JSFreeOp *fop, JSObject *proxy);
virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE;
virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
jsid id, js::Value *vp) MOZ_OVERRIDE;
static nsOuterWindowProxy singleton;
};
@ -552,6 +560,19 @@ nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy)
}
}
bool
nsOuterWindowProxy::get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
jsid id, js::Value *vp)
{
if (id == nsDOMClassInfo::sWrappedJSObject_id &&
xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) {
*vp = JS::ObjectValue(*wrapper);
return true;
}
return js::Wrapper::get(cx, wrapper, receiver, id, vp);
}
nsOuterWindowProxy
nsOuterWindowProxy::singleton;