Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-async / async-callstack-mutation-observer.html
blobe74b27d852c9ea54c581f1f557e65169e6c91048
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script>
7 var node = document.createElement("div");
8 var nestedNode = document.createElement("div");
10 var observer = new MutationObserver(mutationCallback);
11 var nestedObserver = new MutationObserver(nestedMutationCallback);
13 var timeoutFromMutationCallback;
14 var timeoutFromNestedMutationCallback;
15 var lastDoMutationsFunc;
17 function mutationCallback(mutations)
19 if (lastDoMutationsFunc == doMutations1)
20 doMutations1(nestedNode);
21 debugger;
22 if (!timeoutFromMutationCallback)
23 timeoutFromMutationCallback = setTimeout(timeoutFromMutation, 0);
26 function nestedMutationCallback(mutations)
28 debugger;
29 if (!timeoutFromNestedMutationCallback)
30 timeoutFromNestedMutationCallback = setTimeout(timeoutFromNestedMutation, 0);
33 function testFunction()
35 setTimeout(timeout1, 0);
36 var config = { attributes: true, childList: true, characterData: true };
37 observer.observe(node, config);
38 nestedObserver.observe(nestedNode, config);
41 function timeout1()
43 setTimeout(timeout2, 0);
44 doMutations1(node);
47 function doMutations1(node)
49 lastDoMutationsFunc = doMutations1;
50 node.setAttribute("foo", "bar");
51 node.className = "c1 c2";
52 node.textContent = "text";
55 function timeout2()
57 doMutations2(node);
60 function doMutations2(node)
62 lastDoMutationsFunc = doMutations2;
63 var child = document.createElement("span");
64 node.appendChild(child);
65 node.textContent = "";
68 function timeoutFromMutation()
70 debugger;
73 function timeoutFromNestedMutation()
75 debugger;
76 doMutations2(nestedNode);
79 var test = function()
81 var totalDebuggerStatements = 6;
82 var maxAsyncCallStackDepth = 4;
83 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallStackDepth);
86 </script>
87 </head>
89 <body onload="runTest()">
90 <p>
91 Tests asynchronous call stacks for MutationObserver.
92 </p>
94 </body>
95 </html>