| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/console-test.js"></script> |
| <script> |
| function throwError() |
| { |
| throw new Error("error_text"); |
| } |
| |
| function throwObject() |
| { |
| throw {a: 42}; |
| } |
| |
| function throwNumber() |
| { |
| throw 42; |
| } |
| |
| function rejectWithError() |
| { |
| Promise.reject(new Error("promise_error")); |
| } |
| |
| function rejectWithObject() |
| { |
| Promise.reject({b: 42}); |
| } |
| //# sourceURL=foo.js |
| </script> |
| <script> |
| function test() |
| { |
| var expressions = [ |
| ["setTimeout(throwError, 0); undefined", 3], |
| ["throwError();", 2], |
| ["setTimeout(throwObject, 0); undefined", 3], |
| ["throwObject();", 2], |
| ["setTimeout(throwNumber, 0); undefined", 3], |
| ["throwNumber();", 2], |
| ["setTimeout(rejectWithError, 0); undefined", 3], |
| ["rejectWithError();", 3], |
| ["setTimeout(rejectWithObject, 0); undefined", 3], |
| ["rejectWithObject();", 3] |
| ]; |
| |
| function nextExpression() |
| { |
| if (!expressions.length) { |
| InspectorTest.dumpConsoleMessages(); |
| InspectorTest.completeTest(); |
| return; |
| } |
| |
| var expression = expressions.shift(); |
| InspectorTest.waitUntilNthMessageReceived(expression[1], nextExpression); |
| InspectorTest.evaluateInConsole(expression[0], function() {}); |
| } |
| |
| nextExpression(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p> |
| Tests that expressions have thrown objects. |
| </p> |
| </body> |
| </html> |