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
parent f84ce86cc0
commit 7171c4b7f7

View File

@ -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.