Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / mutation-observer-suspend-while-paused.html
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/console-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
6 <script>
7
8 var test = function()
9 {
10     var setup =
11         "window.testDiv = document.createElement('div');\n" +
12         "window.deliveryCount = 0;\n" +
13         "var observer = new WebKitMutationObserver(function(records) {\n" +
14         "    window.deliveryCount++;\n" +
15         "});\n" +
16         "observer.observe(window.testDiv, { attributes: true });";
17     
18     var mutateAndPause = 
19         "function mutateAndPause() {\n" +
20         "    window.testDiv.setAttribute('foo', 'baz');\n" +
21         "    debugger;\n" +
22         "};\n" +
23         "setTimeout(mutateAndPause, 0);";
24
25     InspectorTest.startDebuggerTest(step1);
26
27     function step1()
28     {
29         InspectorTest.evaluateInPage(setup, function() {
30             InspectorTest.addResult("DIV and observer setup.");
31             InspectorTest.evaluateInConsoleAndDump("deliveryCount", step2);
32         });
33     }
34
35     function step2()
36     {
37         InspectorTest.evaluateInPage("window.testDiv.setAttribute('foo', 'bar')", function() {
38             InspectorTest.addResult("setAttribute should have triggered delivery.");
39             InspectorTest.evaluateInConsoleAndDump("deliveryCount", step3); 
40         });
41     }
42
43     function step3()
44     {
45         InspectorTest.evaluateInPage(mutateAndPause, InspectorTest.addResult.bind(InspectorTest, "mutateAndPause invoked."));
46         InspectorTest.waitUntilPaused(step4);
47     }
48
49     function step4() {
50         InspectorTest.addResult("Delivery should not have taken place.");
51         InspectorTest.evaluateInConsoleAndDump("deliveryCount", function() {
52             InspectorTest.resumeExecution(step5);
53         });
54     }
55
56     function step5() {
57         InspectorTest.addResult("Second delivery should now have happened.");
58         InspectorTest.evaluateInConsoleAndDump("deliveryCount", InspectorTest.completeDebuggerTest);
59     }
60 }
61
62 </script>
63 </head>
64
65 <body onload="runTest()">
66 <p>
67 Tests 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>
68 </p>
69
70 </body>
71 </html>