dom/xbl/test/test_bug403162.xhtml

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 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 2 <!--
michael@0 3 https://bugzilla.mozilla.org/show_bug.cgi?id=403162
michael@0 4 -->
michael@0 5 <head>
michael@0 6 <title>Test for Bug 403162</title>
michael@0 7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 9 <bindings xmlns="http://www.mozilla.org/xbl">
michael@0 10 <binding id="test">
michael@0 11 <handlers>
michael@0 12 <handler event="foo" action="XPCNativeWrapper.unwrap(window).triggerCount++" allowuntrusted="true"/>
michael@0 13 </handlers>
michael@0 14 </binding>
michael@0 15 </bindings>
michael@0 16 </head>
michael@0 17 <body>
michael@0 18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=403162">Mozilla Bug 403162</a>
michael@0 19 <p id="display" style="-moz-binding: url(#test)"></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 class="testbody" type="text/javascript">
michael@0 25 <![CDATA[
michael@0 26 var triggerCount = 0;
michael@0 27
michael@0 28 function dispatchEvent(t) {
michael@0 29 var ev = document.createEvent("Events");
michael@0 30 ev.initEvent("foo", true, true);
michael@0 31 t.dispatchEvent(ev);
michael@0 32 }
michael@0 33
michael@0 34 /** Test for Bug 403162 **/
michael@0 35 SimpleTest.waitForExplicitFinish();
michael@0 36 addLoadEvent(function() {
michael@0 37 var t = $("display");
michael@0 38 is(triggerCount, 0, "Haven't dispatched event");
michael@0 39
michael@0 40 dispatchEvent(t);
michael@0 41 is(triggerCount, 1, "Dispatched once");
michael@0 42
michael@0 43 dispatchEvent(t);
michael@0 44 is(triggerCount, 2, "Dispatched twice");
michael@0 45
michael@0 46 t.parentNode.removeChild(t);
michael@0 47 dispatchEvent(t);
michael@0 48 is(triggerCount, 2, "Listener should be gone now");
michael@0 49
michael@0 50 SimpleTest.finish();
michael@0 51 });
michael@0 52 ]]>
michael@0 53 </script>
michael@0 54 </pre>
michael@0 55 </body>
michael@0 56 </html>
michael@0 57

mercurial