| <html> | |
| <head> | |
| <script src="../../http/tests/inspector/resources/protocol-test.js"></script> | |
| <script src="resources/breakpoint.js"></script> | |
| <script> | |
| function test() | |
| { | |
| InspectorProtocol.sendCommand("Debugger.enable", {}); | |
| InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true}); | |
| var breakpointTriggered = 0; | |
| InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject) | |
| { | |
| if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) { | |
| ProtocolTest.log("Found breakpoint.js"); | |
| var scriptIdentifier = messageObject.params.scriptId; | |
| var location = {scriptId: scriptIdentifier, lineNumber: 3, columnNumber: 0}; | |
| InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) { | |
| InspectorProtocol.checkForError(responseObject); | |
| ProtocolTest.log("Set Breakpoint, Triggering it"); | |
| breakpointIdentifier = responseObject.result.breakpointId; | |
| InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"}); | |
| }); | |
| } | |
| } | |
| InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject) | |
| { | |
| ProtocolTest.log("Hit Breakpoint!"); | |
| ++breakpointTriggered; | |
| if (breakpointTriggered === 1) | |
| InspectorProtocol.sendCommand("Debugger.resume", {}); | |
| else { | |
| ProtocolTest.log("FAIL: should not have hit breakpoint after it was removed."); | |
| ProtocolTest.completeTest(); | |
| } | |
| } | |
| InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject) | |
| { | |
| ProtocolTest.log("Resumed, Removing Breakpoint and trying to trigger it again"); | |
| InspectorProtocol.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointIdentifier}, function(responseObject) { | |
| InspectorProtocol.checkForError(responseObject); | |
| InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"}, function(responseObject) { | |
| InspectorProtocol.checkForError(responseObject); | |
| setTimeout(function() { | |
| ProtocolTest.log("PASS: did not hit breakpoint after removing it."); | |
| ProtocolTest.completeTest(); | |
| }, 50); | |
| }); | |
| }); | |
| } | |
| } | |
| </script> | |
| </head> | |
| <body onload="runTest()"> | |
| <p>Debugger.removeBreakpoint</p> | |
| </body> | |
| </html> |