bug 310458: [splitwindow] edit commands not available to extensions window (cut, copy, paste, select all, arrow keys navigation). Patch from bzbarsky. r=mrbkap sr=jst

This commit is contained in:
mrbkap%gmail.com 2005-10-04 05:44:45 +00:00
Родитель 2f585832b3
Коммит ffbaaa7ee4
1 изменённых файлов: 25 добавлений и 1 удалений

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

@ -3443,8 +3443,32 @@ nsGlobalWindow::Focus()
nsCOMPtr<nsIPresShell> presShell;
if (mDocShell) {
// Don't look for a presshell if we're a root chrome window that's got
// about:blank loaded. We don't want to focus our widget in that case.
PRBool lookForPresShell = PR_TRUE;
PRInt32 itemType = nsIDocShellTreeItem::typeContent;
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(mDocShell));
NS_ASSERTION(treeItem, "What happened?");
treeItem->GetItemType(&itemType);
if (itemType == nsIDocShellTreeItem::typeChrome &&
GetPrivateRoot() == NS_STATIC_CAST(nsIDOMWindowInternal*, this) &&
mDocument) {
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
NS_ASSERTION(doc, "Bogus doc?");
nsIURI* ourURI = doc->GetDocumentURI();
PRBool isAbout;
if (ourURI && NS_SUCCEEDED(ourURI->SchemeIs("about", &isAbout)) &&
isAbout) {
nsCAutoString spec;
ourURI->GetSpec(spec);
lookForPresShell = !spec.EqualsLiteral("about:blank");
}
}
if (lookForPresShell) {
mDocShell->GetEldestPresShell(getter_AddRefs(presShell));
}
}
nsresult result = NS_OK;
if (presShell && (canFocus || isActive)) {