Bug 499912, crash activating window with no root element, r+sr=smaug

This commit is contained in:
Neil Deakin 2009-06-24 13:12:37 -04:00
Родитель 65d8462672
Коммит 29905dad37
2 изменённых файлов: 23 добавлений и 5 удалений

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

@ -6654,11 +6654,13 @@ nsGlobalWindow::ActivateOrDeactivate(PRBool aActivate)
nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(topLevelWindow);
if (xulDoc && chromeWin) {
nsCOMPtr<nsIContent> rootElem = doc->GetRootContent();
if (aActivate)
rootElem->SetAttr(kNameSpaceID_None, nsGkAtoms::active,
NS_LITERAL_STRING("true"), PR_TRUE);
else
rootElem->UnsetAttr(kNameSpaceID_None, nsGkAtoms::active, PR_TRUE);
if (rootElem) {
if (aActivate)
rootElem->SetAttr(kNameSpaceID_None, nsGkAtoms::active,
NS_LITERAL_STRING("true"), PR_TRUE);
else
rootElem->UnsetAttr(kNameSpaceID_None, nsGkAtoms::active, PR_TRUE);
}
}
}
}

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

@ -1119,13 +1119,29 @@ function switchWindowTest(otherWindow, framesetWindow)
otherWindow.close();
framesetWindow.close();
gRefocusCallback = doWindowNoRootTest;
}
// open a window with no root element
var noRootWindow = null;
function doWindowNoRootTest()
{
var data = "data:application/vnd.mozilla.xul+xml," + unescape(
"<window onfocus='dostuff()' xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" style='-moz-user-focus: normal;'>" +
"<script>function dostuff() { setTimeout(function() { " +
"document.documentElement.focus(); document.removeChild(document.documentElement);" +
"window.opener.focus(); }, 100); }</script></window>");
gRefocusCallback = doFrameSwitchingTests;
noRootWindow = window.open(data, "_blank", "chrome,width=100,height=100");
}
// these tests check when focus is moved between a tree of frames to ensure
// that the focus is in the right place at each event step.
function doFrameSwitchingTests()
{
noRootWindow.close();
gRefocusCallback = null;
var framea = document.getElementById("ifa");