gecko/toolkit/components/prompts/test/test_bug619644.html

43 lines
1.5 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=619644
-->
<head>
<title>Test for Bug 619644</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.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=619644">Mozilla Bug 619644</a>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
// This is a little yucky, but it works
// The contents of bug619644_inner.html
const expectedFinalDoc =
"<head><\/head><body><p>Original content<\/p>\n<script>\n window.opener.postMessage(\"\", \"*\");\n confirm (\"Message\");\n document.write (\"Extra content\");\n window.opener.postMessage(document.documentElement.innerHTML, \"*\");\n<\/script>Extra content<\/body>";
function runtest(e)
{
window.removeEventListener("message", runtest, false);
window.addEventListener("message", checktest, false);
synthesizeKey("VK_ESCAPE", {}, e.source);
}
function checktest(e) {
is(e.data, expectedFinalDoc, "ESC press should not abort document load");
e.source.close();
SimpleTest.finish();
}
window.addEventListener("message", runtest, false);
window.open("bug619644_inner.html", "619644");
</script>
</pre>
</body>
</html>