Additional test for Bug 666604, r=volkmar

--HG--
extra : rebase_source : 3ff98e5bb1ab594db111e81501abb5cf2b43d60d
This commit is contained in:
Olli Pettay 2011-07-06 16:02:26 +03:00
parent 8a6109fd2c
commit 1e52239020

View File

@ -23,6 +23,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=666604
SimpleTest.waitForExplicitFinish();
function hitEventLoop(times, next)
{
if (times == 0) {
next();
return;
}
SimpleTest.executeSoon(function() {
hitEventLoop(times - 1, next);
});
}
var activationListener;
function dispatchClick(target, ctrl) {
@ -71,7 +83,7 @@ function test3() {
test4();
}
dispatchClick(testlink, true);
setTimeout(test4, 1000);
hitEventLoop(10, test4);
}
function test4() {
@ -81,7 +93,7 @@ function test4() {
test5();
}
dispatchReturn(testlink, true);
setTimeout(test5, 1000);
hitEventLoop(10, test5);
}
function test5() {
@ -102,18 +114,36 @@ function test6() {
dispatchDOMActivate(testlink);
}
var oldPref;
function test7() {
oldPref = SpecialPowers.getBoolPref("dom.disable_open_during_load");
SpecialPowers.setBoolPref("dom.disable_open_during_load", false);
testlink.href = "javascript:opener.activationListener(); window.close();";
testlink.target = "_blank";
activationListener =
function() {
ok(true, "Click() should activate a link");
setTimeout(test9, 0);
setTimeout(test8, 0);
}
testlink.click();
}
function test8() {
SpecialPowers.setBoolPref("dom.disable_open_during_load", true);
testlink.href = "javascript:opener.activationListener(); window.close();";
testlink.target = "_blank";
activationListener =
function() {
ok(false, "Click() should not activate a link");
setTimeout(test9, 0);
}
testlink.click();
hitEventLoop(10, test9);
}
function test9() {
SpecialPowers.setBoolPref("dom.disable_open_during_load", oldPref);
SimpleTest.finish();
}