Bug 442125: Attempt to fix focus test failures, add more info to message if it still fails. r=ted

This commit is contained in:
Andrew Schultz 2008-07-22 00:27:57 -04:00
Родитель 9d5badf74d
Коммит 7aec8416db
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -71,6 +71,7 @@ TestRunner._toggle = function(el) {
**/ **/
TestRunner._makeIframe = function (url, retry) { TestRunner._makeIframe = function (url, retry) {
var iframe = $('testframe'); var iframe = $('testframe');
window.scrollTo(0, $('indicator').offsetTop);
if (url != "about:blank" && (!document.hasFocus() || if (url != "about:blank" && (!document.hasFocus() ||
document.activeElement != iframe)) { document.activeElement != iframe)) {
// typically calling ourselves from setTimeout is sufficient // typically calling ourselves from setTimeout is sufficient
@ -84,9 +85,10 @@ TestRunner._makeIframe = function (url, retry) {
var frameWindow = $('testframe').contentWindow.wrappedJSObject || var frameWindow = $('testframe').contentWindow.wrappedJSObject ||
$('testframe').contentWindow; $('testframe').contentWindow;
frameWindow.SimpleTest.ok(false, "Unable to restore focus, expect failures and timeouts."); frameWindow.SimpleTest.ok(false, "Unable to restore focus ("+
(document.hasFocus() ? document.activeElement : "[none]")+
"), expect failures and timeouts.");
} }
window.scrollTo(0, $('indicator').offsetTop);
iframe.src = url; iframe.src = url;
iframe.name = url; iframe.name = url;
iframe.width = "500"; iframe.width = "500";