From c04f74fe32d66b9992b2e625192d0bdd9ecabd5a Mon Sep 17 00:00:00 2001 From: "Olli.Pettay%helsinki.fi" Date: Tue, 25 Aug 2009 13:50:06 +0000 Subject: [PATCH] Bug 503226, r=jonas,sr=jst,a=dveditz git-svn-id: svn://10.0.0.236/trunk@258226 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/document/src/nsHTMLDocument.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 1ac2f3a6c55..17e072e93de 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -3027,8 +3027,13 @@ nsHTMLDocument::GetSelection(nsAString& aReturn) consoleService->LogStringMessage(NS_LITERAL_STRING("Deprecated method document.getSelection() called. Please use window.getSelection() instead.").get()); } - nsIDOMWindow *window = GetWindow(); - NS_ENSURE_TRUE(window, NS_OK); + nsCOMPtr window = do_QueryInterface(GetScopeObject()); + nsCOMPtr pwin = do_QueryInterface(window); + NS_ENSURE_TRUE(pwin, NS_OK); + NS_ASSERTION(pwin->IsInnerWindow(), "Should have inner window here!"); + NS_ENSURE_TRUE(pwin->GetOuterWindow() && + pwin->GetOuterWindow()->GetCurrentInnerWindow() == pwin, + NS_OK); nsCOMPtr selection; nsresult rv = window->GetSelection(getter_AddRefs(selection));