Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / editor / libeditor / tests / test_bug1332876.html
blob1234b53f62f3db0cb171de9028449c630ac2a50b
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1332876
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 1332876</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script src="/tests/SimpleTest/EventUtils.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1332876">Mozilla Bug 1332876</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
17 </div>
19 <iframe srcdoc="<html><body><span>Edit me!</span>"></iframe>
21 <pre id="test">
23 <script type="application/javascript">
25 /** Test for Bug 1332876 **/
26 SimpleTest.waitForExplicitFinish();
27 SimpleTest.waitForFocus(function() {
28 let iframe = document.querySelector("iframe");
29 iframe.contentDocument.designMode = "on";
31 iframe.contentWindow.addEventListener("keypress", function() {
32 info("Hiding the iframe...");
33 iframe.style.display = "none";
34 document.body.offsetHeight;
35 ok(true, "did not crash");
36 SimpleTest.finish();
37 }, {once: true});
39 iframe.contentWindow.addEventListener("click", function() {
40 info("Waiting keypress event...");
41 // Use another macro task for avoiding impossible event nesting.
42 SimpleTest.executeSoon(() => {
43 synthesizeKey("a", {}, iframe.contentWindow);
44 });
45 }, {once: true});
47 let span = iframe.contentDocument.querySelector("span");
48 ok(span != null, "The span element should've been loaded in the iframe");
49 info("Waiting click event to focus the iframe...");
50 synthesizeMouseAtCenter(span, {}, iframe.contentWindow);
51 });
53 </script>
55 </pre>
56 </body>
57 </html>