Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / mochitest / test_bug390488.html
blobca4bc4024b79d9c0ed2c67f5240ab0ae1a789c21
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=390488
5 -->
6 <head>
7 <title>Test for Bug 390488</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=390488">Mozilla Bug 390488</a>
13 <p id="display">
14 <div id="testdiv" onclick="checkForStacks();" style="visibility:hidden">
15 </div>
16 </p>
17 <div id="content" style="display: none">
19 </div>
20 <pre id="test">
21 <script class="testbody" type="text/javascript">
23 /** Test for Bug 390488 **/
24 function getStack1() {
25 var func = arguments.callee.caller;
26 var stack = "";
27 for (var i = 1; func && i < 8; i++) {
28 stack += " " + i + ". " + func.name;
29 func = func.caller;
31 return stack;
34 function getStack2() {
35 var stack = new Error().stack;
36 // Remove the two lines due to calling this
37 return stack.substring(stack.indexOf("\n", stack.indexOf("\n")+1)+1);
40 function simulateClick() {
41 var evt = document.createEvent("MouseEvents");
42 evt.initMouseEvent("click", true, true, window,
43 0, 0, 0, 0, 0, false, false, false, false, 0, null);
44 $("testdiv").dispatchEvent(evt);
47 function matches(s, p, name) {
48 ok(s.match(p) != null,
49 name + " - got " + s + ", expected a string matching " + p);
52 function checkForStacks() {
53 matches(getStack1(), /checkForStacks .* onclick .* simulateClick/,
54 "Stack from walking caller chain should be correct");
55 isnot(getStack2().indexOf("simulateClick@"), -1,
56 "Stack from |new Error().stack| should include simulateClick");
59 simulateClick();
60 </script>
61 </pre>
62 </body>
63 </html>