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
7var test = function()
8{
9 var setup =
10 "var div = document.createElement('div');\n" +
11 "var deliveryCount = 0;\n" +
12 "var observer = new WebKitMutationObserver(function(records) {\n" +
13 " deliveryCount++;\n" +
14 "});\n" +
15 "observer.observe(div, { attributes: true });";
16
17 var mutateAndPause =
18 "function mutateAndPause() {\n" +
19 " div.setAttribute('foo', 'baz');\n" +
20 " debugger;\n" +
21 "};\n" +
22 "setTimeout(mutateAndPause, 0);";
23
24 InspectorTest.startDebuggerTest(step1);
25
26 function step1()
27 {
28 InspectorTest.evaluateInConsole(setup, function() {
29 InspectorTest.addResult("DIV and observer setup.");
30 InspectorTest.evaluateInConsoleAndDump("deliveryCount", step2);
31 });
32 }
33
34 function step2()
35 {
36 InspectorTest.evaluateInConsole("div.setAttribute('foo', 'bar')", function() {
37 InspectorTest.addResult("setAttribute should have triggered delivery.");
38 InspectorTest.evaluateInConsoleAndDump("deliveryCount", step3);
39 });
40 }
41
42 function step3()
43 {
44 InspectorTest.evaluateInConsole(mutateAndPause, InspectorTest.addResult.bind(InspectorTest, "mutateAndPause invoked."));
45 InspectorTest.waitUntilPaused(step4);
46 }
47
48 function step4() {
49 InspectorTest.addResult("Delivery should not have taken place.");
50 InspectorTest.evaluateInConsoleAndDump("deliveryCount", function() {
51 InspectorTest.resumeExecution(step5);
52 });
53 }
54
55 function step5() {
56 InspectorTest.addResult("Second delivery should now have happened.");
57 InspectorTest.evaluateInConsoleAndDump("deliveryCount", InspectorTest.completeDebuggerTest);
58 }
59}
60
61</script>
62</head>
63
64<body onload="runTest()">
65<p>
66Tests that DOM Mutation Observers do not attempt to deliver mutation records while the debugger is paused.<a href="https://bugs.webkit.org/show_bug.cgi?id=105810">Bug 105810</a>
67</p>
68
69</body>
70</html>