| <!doctype html> |
| <html> |
| <head> |
| <script type="text/javascript" src="../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script type="text/javascript" src="./resources/break-on-exception-tests.js"></script> |
| <script> |
| function test() { |
| function doExceptionTest(testName, exceptionBreakType, resumeAction) |
| { |
| var pauses = 0; |
| var index = 0; |
| |
| function runTestCase(test) { |
| InspectorTest.evaluateInPage("setTimeout(" + test + ", 50)"); |
| } |
| |
| WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) { |
| var scriptObject = event.data.script; |
| if (!/break-on-exception-tests\.js$/.test(scriptObject.url)) |
| return; |
| |
| if (exceptionBreakType == 'AllExceptions') |
| WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false; |
| else |
| WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false; |
| |
| runTestCase(testName); |
| }); |
| |
| WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) { |
| var callFrame = WebInspector.debuggerManager.activeCallFrame; |
| if (callFrame) { |
| // Pausing. |
| InspectorTest.assert(WebInspector.debuggerManager.pauseReason == "exception"); |
| |
| var funcName = callFrame.functionName || "<anonymous>"; |
| var location = callFrame.sourceCodeLocation; |
| var line = location.lineNumber + 1; |
| var column = location.columnNumber + 1; |
| |
| InspectorTest.log("PAUSE #" + (++pauses) + " AT: " + funcName + ":" + line + ":" + column); |
| WebInspector.debuggerManager.resume(); |
| |
| } else { |
| // Resuming. |
| if (resumeAction == 'FinishOnResume') |
| InspectorTest.completeTest(); |
| } |
| }); |
| |
| // This is a signal mechanism for the web process to tell us that the test is done. |
| // The web process fires the signal by doing console.log("DONE"). |
| WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) { |
| var message = event.data.message; |
| if (!message.parameters || message.parameters.length !== 1) |
| return; |
| if (message.parameters[0].type !== "string" || message.parameters[0].description !== "DONE") |
| return; |
| InspectorTest.completeTest(); |
| }); |
| |
| InspectorTest.reloadPage(); |
| } |
| |
| doExceptionTest('doThrow', 'AllExceptions', 'IgnoreResume'); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Checking pause locations when pausing on all exceptions.</p> |
| </body> |
| </html> |