| OLD | NEW |
| (Empty) |
| 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> | |
| 6 | |
| 7 var node = document.createElement("div"); | |
| 8 var nestedNode = document.createElement("div"); | |
| 9 | |
| 10 var observer = new MutationObserver(mutationCallback); | |
| 11 var nestedObserver = new MutationObserver(nestedMutationCallback); | |
| 12 | |
| 13 var timeoutFromMutationCallback; | |
| 14 var timeoutFromNestedMutationCallback; | |
| 15 var lastDoMutationsFunc; | |
| 16 | |
| 17 function mutationCallback(mutations) | |
| 18 { | |
| 19 if (lastDoMutationsFunc == doMutations1) | |
| 20 doMutations1(nestedNode); | |
| 21 debugger; | |
| 22 if (!timeoutFromMutationCallback) | |
| 23 timeoutFromMutationCallback = setTimeout(timeoutFromMutation, 0); | |
| 24 } | |
| 25 | |
| 26 function nestedMutationCallback(mutations) | |
| 27 { | |
| 28 debugger; | |
| 29 if (!timeoutFromNestedMutationCallback) | |
| 30 timeoutFromNestedMutationCallback = setTimeout(timeoutFromNestedMutation
, 0); | |
| 31 } | |
| 32 | |
| 33 function testFunction() | |
| 34 { | |
| 35 setTimeout(timeout1, 0); | |
| 36 var config = { attributes: true, childList: true, characterData: true }; | |
| 37 observer.observe(node, config); | |
| 38 nestedObserver.observe(nestedNode, config); | |
| 39 } | |
| 40 | |
| 41 function timeout1() | |
| 42 { | |
| 43 setTimeout(timeout2, 0); | |
| 44 doMutations1(node); | |
| 45 } | |
| 46 | |
| 47 function doMutations1(node) | |
| 48 { | |
| 49 lastDoMutationsFunc = doMutations1; | |
| 50 node.setAttribute("foo", "bar"); | |
| 51 node.className = "c1 c2"; | |
| 52 node.textContent = "text"; | |
| 53 } | |
| 54 | |
| 55 function timeout2() | |
| 56 { | |
| 57 doMutations2(node); | |
| 58 } | |
| 59 | |
| 60 function doMutations2(node) | |
| 61 { | |
| 62 lastDoMutationsFunc = doMutations2; | |
| 63 var child = document.createElement("span"); | |
| 64 node.appendChild(child); | |
| 65 node.textContent = ""; | |
| 66 } | |
| 67 | |
| 68 function timeoutFromMutation() | |
| 69 { | |
| 70 debugger; | |
| 71 } | |
| 72 | |
| 73 function timeoutFromNestedMutation() | |
| 74 { | |
| 75 debugger; | |
| 76 doMutations2(nestedNode); | |
| 77 } | |
| 78 | |
| 79 var test = function() | |
| 80 { | |
| 81 var totalDebuggerStatements = 6; | |
| 82 var maxAsyncCallStackDepth = 4; | |
| 83 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt
ackDepth); | |
| 84 } | |
| 85 | |
| 86 </script> | |
| 87 </head> | |
| 88 | |
| 89 <body onload="runTest()"> | |
| 90 <p> | |
| 91 Tests asynchronous call stacks for MutationObserver. | |
| 92 </p> | |
| 93 | |
| 94 </body> | |
| 95 </html> | |
| OLD | NEW |