dom/events/test/test_bug593959.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=593959
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 593959</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 <style>
michael@0 12 body:active {
michael@0 13 background: red;
michael@0 14 }
michael@0 15 </style>
michael@0 16 </head>
michael@0 17 <body>
michael@0 18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=593959">Mozilla Bug 593959</a>
michael@0 19 <p id="display"></p>
michael@0 20 <div id="content" style="display: none">
michael@0 21
michael@0 22 </div>
michael@0 23 <pre id="test">
michael@0 24 <script type="application/javascript">
michael@0 25
michael@0 26 /** Test for Bug 593959 **/
michael@0 27
michael@0 28 function doTest() {
michael@0 29 var utils = SpecialPowers.getDOMWindowUtils(window);
michael@0 30 var e = document.createEvent("MouseEvent");
michael@0 31 e.initEvent("mousedown", false, false, window, 0, 1, 1, 1, 1,
michael@0 32 false, false, false, false, 0, null);
michael@0 33 utils.dispatchDOMEventViaPresShell(document.body, e, true);
michael@0 34
michael@0 35 is(document.querySelector("body:active"), document.body, "body should be active!")
michael@0 36
michael@0 37 var ifrwindow = document.getElementById("ifr").contentWindow;
michael@0 38
michael@0 39 var utils2 = SpecialPowers.getDOMWindowUtils(ifrwindow);
michael@0 40
michael@0 41 var e2 = ifrwindow.document.createEvent("MouseEvent");
michael@0 42 e2.initEvent("mouseup", false, false, ifrwindow, 0, 1, 1, 1, 1,
michael@0 43 false, false, false, false, 0, null);
michael@0 44 utils2.dispatchDOMEventViaPresShell(ifrwindow.document.body, e2, true);
michael@0 45
michael@0 46 isnot(document.querySelector("body:active"), document.body, "body shouldn't be active!")
michael@0 47
michael@0 48 SimpleTest.finish();
michael@0 49 }
michael@0 50
michael@0 51 SimpleTest.waitForExplicitFinish();
michael@0 52 addLoadEvent(doTest);
michael@0 53
michael@0 54
michael@0 55
michael@0 56 </script>
michael@0 57 </pre>
michael@0 58 <iframe id="ifr"></iframe>
michael@0 59 </body>
michael@0 60 </html>

mercurial