Bug 694225, nsWebShellWindow::GetNamedDOMDoc can be removed and simplified, r-bsmedberg

This commit is contained in:
Neil Deakin 2011-10-14 09:06:41 -04:00
Родитель 90f42cf310
Коммит 8bd76da7e1
2 изменённых файлов: 7 добавлений и 36 удалений

Просмотреть файл

@ -581,9 +581,13 @@ nsWebShellWindow::OnStateChange(nsIWebProgress *aProgress,
///////////////////////////////
// Find the Menubar DOM and Load the menus, hooking them up to the loaded commands
///////////////////////////////
nsCOMPtr<nsIDOMDocument> menubarDOMDoc(GetNamedDOMDoc(NS_LITERAL_STRING("this"))); // XXX "this" is a small kludge for code reused
if (menubarDOMDoc)
LoadNativeMenus(menubarDOMDoc, mWindow);
nsCOMPtr<nsIContentViewer> cv;
mDocShell->GetContentViewer(getter_AddRefs(cv));
if (cv) {
nsCOMPtr<nsIDOMDocument> menubarDOMDoc(do_QueryInterface(cv->GetDocument()));
if (menubarDOMDoc)
LoadNativeMenus(menubarDOMDoc, mWindow);
}
#endif // USE_NATIVE_MENUS
OnChromeLoaded();
@ -621,37 +625,6 @@ nsWebShellWindow::OnSecurityChange(nsIWebProgress *aWebProgress,
}
//----------------------------------------
nsCOMPtr<nsIDOMDocument> nsWebShellWindow::GetNamedDOMDoc(const nsAString & aDocShellName)
{
nsCOMPtr<nsIDOMDocument> domDoc; // result == nsnull;
// first get the toolbar child docShell
nsCOMPtr<nsIDocShell> childDocShell;
if (aDocShellName.EqualsLiteral("this")) { // XXX small kludge for code reused
childDocShell = mDocShell;
} else {
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem;
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(mDocShell));
docShellAsNode->FindChildWithName(PromiseFlatString(aDocShellName).get(),
PR_TRUE, PR_FALSE, nsnull, nsnull, getter_AddRefs(docShellAsItem));
childDocShell = do_QueryInterface(docShellAsItem);
if (!childDocShell)
return domDoc;
}
nsCOMPtr<nsIContentViewer> cv;
childDocShell->GetContentViewer(getter_AddRefs(cv));
if (!cv)
return domDoc;
nsIDocument* doc = cv->GetDocument();
if (doc)
return nsCOMPtr<nsIDOMDocument>(do_QueryInterface(doc));
return domDoc;
} // nsWebShellWindow::GetNamedDOMDoc
//----------------------------------------
// if the main document URL specified URLs for any content areas, start them loading

Просмотреть файл

@ -80,8 +80,6 @@ protected:
virtual ~nsWebShellWindow();
nsCOMPtr<nsIDOMDocument> GetNamedDOMDoc(const nsAString & aWebShellName);
void LoadContentAreas();
bool ExecuteCloseHandler();
void ConstrainToOpenerScreen(PRInt32* aX, PRInt32* aY);