Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / console / console-eval-throw.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>
6 function test()
7 {
8     function dumpMessages(next, message)
9     {
10         InspectorTest.dumpConsoleMessages();
11         WebInspector.consoleModel.requestClearMessages();
12         
13         WebInspector.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, afterCleared);
14
15         function afterCleared() {
16             WebInspector.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, afterCleared);
17             next();
18         }
19     }
20
21     InspectorTest.runTestSuite([
22         function testThrowUndefined(next)
23         {
24             InspectorTest.evaluateInConsole('throw undefined', dumpMessages.bind(null, next));
25         },
26
27         function testThrowNumber(next)
28         {
29             InspectorTest.evaluateInConsole('throw 1', dumpMessages.bind(null, next));
30         },
31
32         function testThrowString(next)
33         {
34             InspectorTest.evaluateInConsole('throw \'asdf\'', dumpMessages.bind(null, next));
35         },
36
37         function testThrowObject(next)
38         {
39             InspectorTest.evaluateInConsole('throw {a:42}', dumpMessages.bind(null, next));
40         },
41
42         function testThrowError(next)
43         {
44             InspectorTest.evaluateInConsole('throw new Error(\'asdf\')', dumpMessages.bind(null, next));
45         }
46     ]);
47 }
48 </script>
49 </head>
50 <body onload="runTest()">
51 <p>
52 Tests that evaluating 'throw undefined|1|string|object|Error' in the console won't crash the browser and correctly reported.
53 <a href="https://bugs.webkit.org/show_bug.cgi?id=59611">Bug 59611.</a>
54 </p>
55 </body>
56 </html>