Bug 862918 - Only create nsGlobalModalWindow for the primary content shell. r=bz

This commit is contained in:
Bobby Holley 2013-04-19 09:49:56 -04:00
Родитель cd50434ab7
Коммит 39ba7461e7
1 изменённых файлов: 9 добавлений и 0 удалений

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

@ -11418,6 +11418,15 @@ nsDocShell::EnsureScriptEnvironment()
bool isModalContentWindow = (mItemType == typeContent) &&
(chromeFlags & nsIWebBrowserChrome::CHROME_MODAL);
// There can be various other content docshells associated with the
// top-level window, like sidebars. Make sure that we only create an
// nsGlobalModalWindow for the primary content shell.
if (isModalContentWindow) {
nsCOMPtr<nsIDocShellTreeItem> primaryItem;
nsresult rv = mTreeOwner->GetPrimaryContentShell(getter_AddRefs(primaryItem));
NS_ENSURE_SUCCESS(rv, rv);
isModalContentWindow = (primaryItem == this);
}
// If our window is modal and we're not opened as chrome, make
// this window a modal content window.