| <html> |
| <head> |
| <script src="../../http/tests/inspector/resources/protocol-test.js"></script> |
| <script> |
| function appendBadScript() |
| { |
| let script = document.createElement("script"); |
| script.src = "resources/file-with-syntax-error.js"; |
| document.body.appendChild(script); |
| } |
| |
| function test() |
| { |
| InspectorProtocol.sendCommand("Debugger.enable", {}); |
| InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorProtocol.checkForError); |
| InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true}); |
| |
| let suite = ProtocolTest.createAsyncSuite("TopLevelSyntaxError"); |
| |
| suite.addTestCase({ |
| name: "TopLevelSyntaxErrorDontCrash", |
| description: "Make sure exceptions from top-level syntax errors don't cause us to crash.", |
| test(resolve, reject) { |
| InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject) { |
| InspectorProtocol.sendCommand("Debugger.resume"); |
| |
| ProtocolTest.pass("Paused on the breakpoint after syntax error at top level without crashing."); |
| resolve(); |
| } |
| |
| ProtocolTest.evaluateInPage("appendBadScript()"); |
| } |
| }); |
| |
| suite.runTestCasesAndFinish(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Making sure we don't crash when having a top-level syntax error.</p> |
| </body> |
| </html> |