mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 499912, crash activating window with no root element, r+sr=smaug
This commit is contained in:
parent
65d8462672
commit
29905dad37
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user