mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 12:37:37 +00:00
09a262787c
We are white-listing the existing set of tests that use setTimeout like this. Hopefully these tests will be investigated and fixed in the future, so that we can narrow down the white-list. This check is only turned on for mochitest-plain for now.
186 lines
6.0 KiB
HTML
186 lines
6.0 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=260264
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 260264</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<script type="application/javascript" src="utils_bug260264.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=260264">Mozilla Bug 260264</a>
|
|
<p id="display">
|
|
<a id="link" href="javascript:(function(){})()">link</a>
|
|
</p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 260264 **/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.requestFlakyTimeout("untriaged");
|
|
|
|
var a = $("link"),
|
|
checkOpened = function() { ok(window.open("http://example.com"), "not properly opened") },
|
|
checkBlocked = function() { ok(!window.open("http://example.com"), "not properly blocked") };
|
|
|
|
|
|
function run_tests() {
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
window.open.close();
|
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests2);
|
|
}
|
|
|
|
function run_tests2() {
|
|
for (var count = 0, n = 0; n < 3; n++)
|
|
send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
|
|
send(a, "mouseup", checkBlocked);
|
|
window.open.close(1);
|
|
send(a, "mouseup", checkOpened);
|
|
send(a, "mouseup", checkBlocked);
|
|
send(a, "mouseup", checkBlocked);
|
|
window.open.close();
|
|
ok(count > 0, "Windows left open by previous tests?");
|
|
while (count --> 0)
|
|
send(a, "mouseup", checkOpened);
|
|
send(a, "mouseup", checkBlocked);
|
|
window.open.close();
|
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests3);
|
|
}
|
|
|
|
function run_tests3() {
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close();
|
|
SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests4);
|
|
});
|
|
}
|
|
|
|
function run_tests4() {
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
window.open.close();
|
|
|
|
send(a, "mouseup", checkOpened);
|
|
send(a, "mouseup", checkOpened);
|
|
send(a, "mouseup", checkOpened);
|
|
send(a, "mouseup", checkOpened);
|
|
window.open.close();
|
|
|
|
for (var count = 0, n = 0; n < 3; n++)
|
|
send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close(1);
|
|
send(a, "mouseover", checkOpened);
|
|
send(a, "mouseover", checkBlocked);
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close();
|
|
ok(count > 0, "Windows left open by previous tests?");
|
|
while (count --> 0)
|
|
send(a, "mouseover", checkOpened);
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close();
|
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events", "click"]]}, run_tests5);
|
|
}
|
|
|
|
function run_tests5() {
|
|
SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION, 'context': document}], run_tests6);
|
|
}
|
|
|
|
function run_tests6() {
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
window.open.close();
|
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}, run_tests7);
|
|
}
|
|
|
|
function run_tests7() {
|
|
send(a, "mouseup", checkBlocked);
|
|
window.open.close();
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close();
|
|
|
|
SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}], function() {
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}, run_tests8);
|
|
});
|
|
}
|
|
|
|
function run_tests8() {
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
send(a, "click", checkOpened);
|
|
window.open.close();
|
|
|
|
for (var count = 0, n = 0; n < 3; n++)
|
|
send(a, "mouseup", function() { if (window.open("http://example.com")) count++ });
|
|
send(a, "mouseup", checkBlocked);
|
|
window.open.close(1);
|
|
send(a, "mouseup", checkOpened);
|
|
send(a, "mouseup", checkBlocked);
|
|
send(a, "mouseup", checkBlocked);
|
|
window.open.close();
|
|
ok(count > 0, "Windows left open by previous tests?");
|
|
while (count --> 0)
|
|
send(a, "mouseup", checkOpened);
|
|
send(a, "mouseup", checkBlocked);
|
|
window.open.close();
|
|
|
|
for (var count = 0, n = 0; n < 3; n++)
|
|
send(a, "mouseover", function() { if (window.open("http://example.com")) count++ });
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close(1);
|
|
send(a, "mouseover", checkOpened);
|
|
send(a, "mouseover", checkBlocked);
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close();
|
|
ok(count > 0, "Windows left open by previous tests?");
|
|
while (count --> 0)
|
|
send(a, "mouseover", checkOpened);
|
|
send(a, "mouseover", checkBlocked);
|
|
window.open.close();
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
function check_sanity() {
|
|
ok(SpecialPowers.testPermission('popup', UNKNOWN_ACTION, document), 'popup value should have UNKNOWN permission');
|
|
SpecialPowers.pushPermissions([{'type': 'popup', 'allow': true, 'context': document}], check_sanity2);
|
|
}
|
|
|
|
function check_sanity2() {
|
|
ok(SpecialPowers.testPermission('popup', ALLOW_ACTION, document), 'popup value should have ALLOW permission');
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.disable_open_during_load", true],
|
|
["dom.popup_allowed_events", "click mouseup"],
|
|
["dom.popup_maximum", 3]]}, function() {
|
|
// Note: UNKNOWN_ACTION is the same as DENY_ACTION.
|
|
SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION, 'context': document}], run_tests);
|
|
});
|
|
}
|
|
|
|
setTimeout(function() {
|
|
SpecialPowers.pushPermissions([{'type': 'popup', 'remove': true, 'context': document}], check_sanity);
|
|
}, 200);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|