Bug 585228 - Make the outer window not have an outerObject hook and the inner window not have an innerObject hook. r=jst

This commit is contained in:
Blake Kaplan 2010-08-06 17:13:14 -07:00
parent 4240b7bbb9
commit b70d1da23a
2 changed files with 14 additions and 13 deletions

View File

@ -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;

View File

@ -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);