Bug 599628 - Fix test timeout for Gecko consumers without invalidformsubmit observers. r=callek a=test

This commit is contained in:
Mounir Lamouri 2010-09-27 18:19:59 -07:00
Родитель 61bc265749
Коммит a304794495
1 изменённых файлов: 63 добавлений и 61 удалений

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

@ -40,22 +40,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=561636
/** Test for Bug 561636 **/ /** Test for Bug 561636 **/
var formSubmitted = [ false, false ]; SimpleTest.waitForExplicitFinish();
var invalidHandled = false;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var os = Components.classes['@mozilla.org/observer-service;1']
.getService(Components.interfaces.nsIObserverService);
var observers = os.enumerateObservers("invalidformsubmit");
function runTest() function runTest()
{ {
var formSubmitted = [ false, false ];
var invalidHandled = false;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var os = Components.classes['@mozilla.org/observer-service;1']
.getService(Components.interfaces.nsIObserverService);
var observers = os.enumerateObservers("invalidformsubmit");
// The following test should not be done if there is no observer for // The following test should not be done if there is no observer for
// "invalidformsubmit" because the form submission will not be canceled in that // "invalidformsubmit" because the form submission will not be canceled in that
// case. // case.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!observers.hasMoreElements()) {
if (observers.hasMoreElements()) { SimpleTest.finish();
SimpleTest.waitForExplicitFinish(); return;
}
// Initialize // Initialize
document.forms[0].addEventListener('submit', function(aEvent) { document.forms[0].addEventListener('submit', function(aEvent) {
@ -107,7 +110,6 @@ function runTest()
var c = document.getElementById('c'); var c = document.getElementById('c');
c.focus(); synthesizeKey("VK_RETURN", {type: "keypress"}); c.focus(); synthesizeKey("VK_RETURN", {type: "keypress"});
document.getElementById('s2').click(); document.getElementById('s2').click();
}
} }
</script> </script>