Bug 772823 - Focus the main test window before closing the newly opened window in order to work around an unknown focus manager bug; r=gavin

This commit is contained in:
Ehsan Akhgari 2014-04-17 10:59:10 -04:00
parent 22b3e73265
commit dce67ec86b

View File

@ -33,20 +33,23 @@
"iframe with mozFrameType='content' in chrome document is typeContent");
SimpleTest.executeSoon(function () {
// Wait for the window to be closed before finishing the test
let ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
ww.registerNotification(function windowObs(subject, topic, data) {
if (topic == "domwindowclosed") {
ww.unregisterNotification(windowObs);
// First focus the parent window and then close this one.
SimpleTest.waitForFocus(function() {
let ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
ww.registerNotification(function windowObs(subject, topic, data) {
if (topic == "domwindowclosed") {
ww.unregisterNotification(windowObs);
SimpleTest.waitForFocus(function() {
SimpleTest.finish();
}, opener);
}
});
// Don't start the next test synchronously!
SimpleTest.executeSoon(function() {
SimpleTest.finish();
});
}
});
window.close();
window.close();
}, opener);
});
}
]]></script>