From 54ca1d9bd6a659d8eda56b62d3e3fda188e5d3ae Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Fri, 28 May 2010 15:40:29 -0700 Subject: [PATCH] Bug 545314 - Force an inner window here so that we return a working location object. r=peterv --- dom/base/nsDOMClassInfo.cpp | 6 ++++ dom/tests/mochitest/bugs/Makefile.in | 1 + dom/tests/mochitest/bugs/test_bug545314.html | 30 ++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 dom/tests/mochitest/bugs/test_bug545314.html diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 6034de46a4b..5a6d8ba877b 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -6590,6 +6590,12 @@ 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. + + win->EnsureInnerWindow(); + nsCOMPtr location; rv = win->GetLocation(getter_AddRefs(location)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/tests/mochitest/bugs/Makefile.in b/dom/tests/mochitest/bugs/Makefile.in index 5cbd7246eb1..8e4ebcb1c1f 100644 --- a/dom/tests/mochitest/bugs/Makefile.in +++ b/dom/tests/mochitest/bugs/Makefile.in @@ -114,6 +114,7 @@ _TEST_FILES = \ test_bug534149.html \ test_bug558973.html \ test_bug563487.html \ + test_bug545314.html \ test_bug548828.html \ $(NULL) diff --git a/dom/tests/mochitest/bugs/test_bug545314.html b/dom/tests/mochitest/bugs/test_bug545314.html new file mode 100644 index 00000000000..b9076e7cc00 --- /dev/null +++ b/dom/tests/mochitest/bugs/test_bug545314.html @@ -0,0 +1,30 @@ + + + + + Test for Bug 545314 + + + + + +Mozilla Bug 545314 +

+ + +
+
+
+ +