Bug 807926 - Don't handle outer windows in nsWindowSH::NewResolve; r=bholley

This commit is contained in:
Ms2ger 2012-11-04 09:00:06 +01:00
parent 782b383397
commit 3856428adf

View File

@ -7015,6 +7015,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
js::RootedId id(cx, id_);
nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
MOZ_ASSERT(win->IsInnerWindow());
if (!JSID_IS_STRING(id)) {
if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0 && !(flags & JSRESOLVE_ASSIGNING)) {
@ -7126,32 +7127,13 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
// here) since we must define window.location to prevent the
// getter from being overriden (for security reasons).
// Note: Because we explicitly don't forward to the inner window
// above, we have to ensure here that our window has a current
// inner window so that the location object we return will work.
if (win->IsOuterWindow()) {
win->EnsureInnerWindow();
}
nsCOMPtr<nsIDOMLocation> location;
rv = win->GetLocation(getter_AddRefs(location));
NS_ENSURE_SUCCESS(rv, rv);
// Make sure we wrap the location object in the inner window's
// scope if we've got an inner window.
// Make sure we wrap the location object in the window's scope.
JSObject *scope = nullptr;
if (win->IsOuterWindow()) {
nsGlobalWindow *innerWin = win->GetCurrentInnerWindowInternal();
if (innerWin) {
scope = innerWin->GetGlobalJSObject();
}
}
if (!scope) {
wrapper->GetJSObject(&scope);
}
wrapper->GetJSObject(&scope);
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
jsval v;