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,6 +40,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=561636
/** Test for Bug 561636 **/ /** Test for Bug 561636 **/
SimpleTest.waitForExplicitFinish();
function runTest()
{
var formSubmitted = [ false, false ]; var formSubmitted = [ false, false ];
var invalidHandled = false; var invalidHandled = false;
@ -48,14 +52,13 @@ var os = Components.classes['@mozilla.org/observer-service;1']
.getService(Components.interfaces.nsIObserverService); .getService(Components.interfaces.nsIObserverService);
var observers = os.enumerateObservers("invalidformsubmit"); var observers = os.enumerateObservers("invalidformsubmit");
function runTest()
{
// 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) {
@ -108,7 +111,6 @@ function runTest()
c.focus(); synthesizeKey("VK_RETURN", {type: "keypress"}); c.focus(); synthesizeKey("VK_RETURN", {type: "keypress"});
document.getElementById('s2').click(); document.getElementById('s2').click();
} }
}
</script> </script>
</pre> </pre>