summaryrefslogtreecommitdiffstats
path: root/toolkit/components/prompts/test/test_bug619644.html
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/prompts/test/test_bug619644.html')
-rw-r--r--toolkit/components/prompts/test/test_bug619644.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/toolkit/components/prompts/test/test_bug619644.html b/toolkit/components/prompts/test/test_bug619644.html
new file mode 100644
index 000000000..9f61eb18b
--- /dev/null
+++ b/toolkit/components/prompts/test/test_bug619644.html
@@ -0,0 +1,76 @@
+<!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>
+ <script type="text/javascript" src="prompt_common.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">
+// 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>";
+
+if (!isTabModal) {
+ todo(false, "Test disabled when tab modal prompts are not enabled.");
+} else {
+ inittest();
+}
+
+var promptDone;
+
+function inittest() {
+ window.addEventListener("message", runtest, false);
+ window.open("bug619644_inner.html", "619644");
+
+ SimpleTest.waitForExplicitFinish();
+}
+
+function runtest(e) {
+ window.removeEventListener("message", runtest, false);
+ window.addEventListener("message", checktest, false);
+
+ let state = {
+ msg : "Message",
+ iconClass : "question-icon",
+ titleHidden : true,
+ textHidden : true,
+ passHidden : true,
+ checkHidden : true,
+ textValue : "",
+ passValue : "",
+ checkMsg : "",
+ checked : false,
+ focused : "button0",
+ defButton : "button0",
+ };
+ let action = {
+ buttonClick: "ESC",
+ };
+
+ promptDone = handlePrompt(state, action);
+}
+
+function checktest(e) {
+ is(e.data, expectedFinalDoc, "ESC press should not abort document load");
+ e.source.close();
+ promptDone.then(endtest);
+}
+
+function endtest() {
+ info("Ending test");
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>