Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / rethrow-error-from-bindings-crash.html
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 src="../../../http/tests/inspector/console-test.js"></script>
6 <script>
7 var functions;
8
9 function testFunction()
10 {
11     console.clear();
12     // This used to be a racy crash. Test some sequence of functions.
13     functions = [f2, f1, f2, f1, f2, f1, f2, f1];
14     functions.push(function() {});
15     functions.shift()();
16 }
17
18 function f1() {
19     setTimeout(functions.shift(), 0);
20     document.body.appendChild("<throw_exception>");
21 }
22
23 function f2() {
24     setTimeout(functions.shift(), 0);
25     new Range().compareBoundaryPoints(1, 2);
26 }
27
28 var test = function()
29 {
30     var expectedErrorsCount = 8;
31
32     InspectorTest.setQuiet(true);
33     InspectorTest.startDebuggerTest(step1);
34
35     function step1()
36     {
37         DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
38         InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
39     }
40
41     function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
42     {
43         --expectedErrorsCount;
44         if (!expectedErrorsCount) {
45             InspectorTest.waitUntilNthMessageReceived(1, step2);
46             InspectorTest.resumeExecution();
47         } else {
48             InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(InspectorTest, didPause));
49         }
50     }
51
52     function step2()
53     {
54         InspectorTest.dumpConsoleMessages();
55         completeTest();
56     }
57
58     function completeTest()
59     {
60         DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions);
61         InspectorTest.completeDebuggerTest();
62     }
63 }
64
65 </script>
66 </head>
67 <body onload="window.testRunner ? runTest() : testFunction()">
68 <p>
69 Tests that pausing on uncaught exceptions thrown from C++ bindings will not crash.
70 </p>
71 </body>
72 </html>