From b70d1da23af12f30e65cdd5efe9f722d09c425d9 Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Fri, 6 Aug 2010 17:13:14 -0700 Subject: [PATCH] Bug 585228 - Make the outer window not have an outerObject hook and the inner window not have an innerObject hook. r=jst --- dom/base/nsDOMClassInfo.cpp | 18 +++++++++--------- dom/base/nsDOMClassInfo.h | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 056da248fc26..46acaae0b704 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -503,15 +503,15 @@ static const char kDOMStringBundleURL[] = nsIXPCScriptable::WANT_DELPROPERTY | \ nsIXPCScriptable::WANT_FINALIZE | \ nsIXPCScriptable::WANT_EQUALITY | \ - nsIXPCScriptable::WANT_OUTER_OBJECT | \ - nsIXPCScriptable::WANT_INNER_OBJECT | \ nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE) #define INNER_WINDOW_SCRIPTABLE_FLAGS \ - (COMMON_WINDOW_SCRIPTABLE_FLAGS) \ + (COMMON_WINDOW_SCRIPTABLE_FLAGS | \ + nsIXPCScriptable::WANT_OUTER_OBJECT) \ #define OUTER_WINDOW_SCRIPTABLE_FLAGS \ (COMMON_WINDOW_SCRIPTABLE_FLAGS | \ + nsIXPCScriptable::WANT_INNER_OBJECT | \ nsIXPCScriptable::WANT_NEWENUMERATE) #define NODE_SCRIPTABLE_FLAGS \ @@ -7276,8 +7276,8 @@ nsCommonWindowSH::Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx, } NS_IMETHODIMP -nsCommonWindowSH::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, - JSObject * obj, JSObject * *_retval) +nsInnerWindowSH::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, + JSObject * obj, JSObject * *_retval) { nsGlobalWindow *origWin = nsGlobalWindow::FromWrapper(wrapper); nsGlobalWindow *win = origWin->GetOuterWindowInternal(); @@ -7304,12 +7304,12 @@ nsCommonWindowSH::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx } NS_IMETHODIMP -nsCommonWindowSH::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, - JSObject * obj, JSObject * *_retval) +nsOuterWindowSH::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, + JSObject * obj, JSObject * *_retval) { nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper); - if (win->IsInnerWindow() || win->IsFrozen()) { + if (win->IsFrozen()) { // Return the inner window, or the outer if we're dealing with a // frozen outer. @@ -7321,7 +7321,7 @@ nsCommonWindowSH::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx if (!inner) { // Yikes! No inner window! Instead of leaking the outer window into the // scope chain, let's return an error. - + NS_ERROR("using an outer that doesn't have an inner?"); *_retval = nsnull; return NS_ERROR_UNEXPECTED; diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index a61d43bcb8aa..e950d55d2657 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -555,10 +555,6 @@ public: JSObject *obj); NS_IMETHOD Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, const jsval &val, PRBool *bp); - NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, - JSObject * obj, JSObject * *_retval); - NS_IMETHOD InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, - JSObject * obj, JSObject * *_retval); static JSBool GlobalScopePolluterNewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, @@ -587,6 +583,8 @@ public: NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, PRUint32 enum_op, jsval *statep, jsid *idp, PRBool *_retval); + NS_IMETHOD InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, + JSObject * obj, JSObject * *_retval); static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) { @@ -606,6 +604,9 @@ protected: } public: + NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, + JSObject * obj, JSObject * *_retval); + static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) { return new nsInnerWindowSH(aData);