Bug 1941128 - Turn off network.dns.native_https_query on Mac again
[gecko.git] / dom / bindings / test / test_async_stacks.html
blobfe761e783bba98a4ab4b762cfc87c3d1bcfca7f2
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1148593
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 1148593</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <script type="application/javascript">
12 /* global noSuchFunction */
14 /** Test for Bug 1148593 **/
16 SimpleTest.waitForExplicitFinish();
18 var TESTS;
20 function nextTest() {
21 var t = TESTS.pop();
22 if (t) {
23 t();
24 } else {
25 SimpleTest.finish();
29 function checkStack(functionName) {
30 try {
31 noSuchFunction();
32 } catch (e) {
33 ok(e.stack.includes(functionName), "stack includes " + functionName);
35 nextTest();
38 function eventListener() {
39 checkStack("registerEventListener");
41 function registerEventListener(link) {
42 link.onload = eventListener;
44 function eventTest() {
45 var link = document.createElement("link");
46 link.rel = "stylesheet";
47 link.href = "data:text/css,";
48 registerEventListener(link);
49 document.body.appendChild(link);
52 function xhrListener() {
53 checkStack("xhrTest");
55 function xhrTest() {
56 var ourFile = location.href;
57 var x = new XMLHttpRequest();
58 x.onload = xhrListener;
59 x.open("get", ourFile, true);
60 x.send();
63 function rafListener() {
64 checkStack("rafTest");
66 function rafTest() {
67 requestAnimationFrame(rafListener);
70 var intervalId;
71 function intervalHandler() {
72 clearInterval(intervalId);
73 checkStack("intervalTest");
75 function intervalTest() {
76 intervalId = setInterval(intervalHandler, 5);
79 function postMessageHandler(ev) {
80 ev.stopPropagation();
81 checkStack("postMessageTest");
83 function postMessageTest() {
84 window.addEventListener("message", postMessageHandler, true);
85 window.postMessage("whatever", "*");
88 function runTests() {
89 TESTS = [postMessageTest, intervalTest, rafTest, xhrTest, eventTest];
90 nextTest();
93 addLoadEvent(function() {
94 SpecialPowers.pushPrefEnv(
95 {"set": [["javascript.options.asyncstack_capture_debuggee_only", false]]},
96 runTests);
97 });
98 </script>
99 </head>
100 <body>
101 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1148593">Mozilla Bug 1148593</a>
102 <p id="display"></p>
103 <div id="content" style="display: none">
105 </div>
106 <pre id="test">
107 </pre>
108 </body>
109 </html>