3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></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
);
22 if (!timeoutFromMutationCallback
)
23 timeoutFromMutationCallback
= setTimeout(timeoutFromMutation
, 0);
26 function nestedMutationCallback(mutations
)
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
);
43 setTimeout(timeout2
, 0);
47 function doMutations1(node
)
49 lastDoMutationsFunc
= doMutations1
;
50 node
.setAttribute("foo", "bar");
51 node
.className
= "c1 c2";
52 node
.textContent
= "text";
60 function doMutations2(node
)
62 lastDoMutationsFunc
= doMutations2
;
63 var child
= document
.createElement("span");
64 node
.appendChild(child
);
65 node
.textContent
= "";
68 function timeoutFromMutation()
73 function timeoutFromNestedMutation()
76 doMutations2(nestedNode
);
81 var totalDebuggerStatements
= 6;
82 var maxAsyncCallStackDepth
= 4;
83 InspectorTest
.runAsyncCallStacksTest(totalDebuggerStatements
, maxAsyncCallStackDepth
);
89 <body onload=
"runTest()">
91 Tests asynchronous call stacks for MutationObserver.