Bug 503226, r=jonas,sr=jst,a=dveditz

git-svn-id: svn://10.0.0.236/trunk@258226 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi
2009-08-25 13:50:06 +00:00
parent 23a9d066f9
commit c04f74fe32

View File

@@ -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<nsIDOMWindow> window = do_QueryInterface(GetScopeObject());
nsCOMPtr<nsPIDOMWindow> 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<nsISelection> selection;
nsresult rv = window->GetSelection(getter_AddRefs(selection));