Commit 979f0e61 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Web Inspector: Column Breakpoint not working, may be off by 1

https://bugs.webkit.org/show_bug.cgi?id=120334

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-08-27
Reviewed by David Kilzer.

Source/WebCore:

JavaScriptCore changed to 1-based column numbers at some point. We
need to update the ScriptDebugger assumption that they were 0-based.

Test: inspector-protocol/debugger/column-breakpoint.html

* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::createCallFrame):
(WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded):

LayoutTests:

Write a protocol test for setting a breakpoint at a line:column.

* inspector-protocol/debugger/column-breakpoint-expected.txt: Added.
* inspector-protocol/debugger/column-breakpoint.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fae8c8a4
2013-08-27 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Column Breakpoint not working, may be off by 1
https://bugs.webkit.org/show_bug.cgi?id=120334
Reviewed by David Kilzer.
Write a protocol test for setting a breakpoint at a line:column.
* inspector-protocol/debugger/column-breakpoint-expected.txt: Added.
* inspector-protocol/debugger/column-breakpoint.html: Added.
2013-08-27 Krzysztof Czech <k.czech@samsung.com>
 
[EFL] Added new accessibility expectations after r153798.
Breakpoints Enabled
Found <script>
Running testFunction
Hit Breakpoint!
Evaluted value of `a` (expecting number 1) was: {"type":"number","value":1,"description":"1"}
Evaluted value of `b` (expecting undefined) was: {"type":"undefined"}
<html>
<head>
<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
<script>
window.onload = runTest;
function test()
{
// This test setting a breakpoint on line:column in the <script> below.
// We set a breakpoint before evaluating `var b = ...`, and verify that
// by running some expressions at that call frame.
// Debugger.enable -> Debugger.setBreakpointsActive
InspectorTest.sendCommand("Debugger.enable", {}, function() {
InspectorTest.sendCommand("Debugger.setBreakpointsActive", {active: true}, function() {
InspectorTest.log("Breakpoints Enabled");
});
});
// Debugger.scriptParsed -> Debugger.setBreakpoint -> Runtime.evaluate
InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
if (/column-breakpoint\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 10) {
InspectorTest.log("Found <script>");
var scriptIdentifier = messageObject.params.scriptId;
var lineNumber = messageObject.params.startLine + 2;
var columnNumber = 10;
var location = {scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber};
InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
InspectorTest.log("Running testFunction");
InspectorTest.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
});
}
}
// Debugger.paused -> Debugger.evaluateOnCallFrame -> Debugger.evaluateOnCallFrame -> END
InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
{
InspectorTest.log("Hit Breakpoint!");
var callFrameIdentifier = messageObject.params.callFrames[0].callFrameId;
InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
InspectorTest.log("Evaluted value of `a` (expecting number 1) was: " + JSON.stringify(messageObject.result.result));
InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "b"}, function(messageObject) {
InspectorTest.log("Evaluted value of `b` (expecting undefined) was: " + JSON.stringify(messageObject.result.result));
InspectorTest.completeTest();
});
});
}
}
</script>
</head>
<body>
<script>// Line 0
function testFunction() {// Line 1
var a = 1;var b = a + 1;// Line 2
}// Line 3
</script>
</body>
</html>
2013-08-27 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Column Breakpoint not working, may be off by 1
https://bugs.webkit.org/show_bug.cgi?id=120334
Reviewed by David Kilzer.
JavaScriptCore changed to 1-based column numbers at some point. We
need to update the ScriptDebugger assumption that they were 0-based.
Test: inspector-protocol/debugger/column-breakpoint.html
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::createCallFrame):
(WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded):
2013-08-27 Antti Koivisto <antti@apple.com>
 
Switch some more code to element child/descendant iterators
......@@ -390,7 +390,7 @@ void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback
void ScriptDebugServer::createCallFrame(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber, int columnNumber)
{
TextPosition textPosition(OrdinalNumber::fromOneBasedInt(lineNumber), OrdinalNumber::fromZeroBasedInt(columnNumber));
TextPosition textPosition(OrdinalNumber::fromOneBasedInt(lineNumber), OrdinalNumber::fromOneBasedInt(columnNumber));
m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, textPosition);
if (m_lastExecutedSourceId != sourceID) {
m_lastExecutedLine = -1;
......@@ -404,7 +404,7 @@ void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(const DebuggerCallFrame&
if (!m_currentCallFrame)
return;
TextPosition textPosition(OrdinalNumber::fromOneBasedInt(lineNumber), OrdinalNumber::fromZeroBasedInt(columnNumber));
TextPosition textPosition(OrdinalNumber::fromOneBasedInt(lineNumber), OrdinalNumber::fromOneBasedInt(columnNumber));
m_currentCallFrame->update(debuggerCallFrame, sourceID, textPosition);
pauseIfNeeded(debuggerCallFrame.dynamicGlobalObject());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment