Title: [154681] trunk
Revision
154681
Author
[email protected]
Date
2013-08-27 07:13:31 -0700 (Tue, 27 Aug 2013)

Log Message

Web Inspector: Column Breakpoint not working, may be off by 1
https://bugs.webkit.org/show_bug.cgi?id=120334

Patch by Joseph Pecoraro <[email protected]> on 2013-08-27
Reviewed by David Kilzer.

Source/WebCore:

_javascript_Core 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154680 => 154681)


--- trunk/LayoutTests/ChangeLog	2013-08-27 13:41:08 UTC (rev 154680)
+++ trunk/LayoutTests/ChangeLog	2013-08-27 14:13:31 UTC (rev 154681)
@@ -1,3 +1,15 @@
+2013-08-27  Joseph Pecoraro  <[email protected]>
+
+        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  <[email protected]>
 
         [EFL] Added new accessibility expectations after r153798.

Added: trunk/LayoutTests/inspector-protocol/debugger/column-breakpoint-expected.txt (0 => 154681)


--- trunk/LayoutTests/inspector-protocol/debugger/column-breakpoint-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/column-breakpoint-expected.txt	2013-08-27 14:13:31 UTC (rev 154681)
@@ -0,0 +1,7 @@
+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"}
+

Added: trunk/LayoutTests/inspector-protocol/debugger/column-breakpoint.html (0 => 154681)


--- trunk/LayoutTests/inspector-protocol/debugger/column-breakpoint.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/column-breakpoint.html	2013-08-27 14:13:31 UTC (rev 154681)
@@ -0,0 +1,58 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<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>

Modified: trunk/Source/WebCore/ChangeLog (154680 => 154681)


--- trunk/Source/WebCore/ChangeLog	2013-08-27 13:41:08 UTC (rev 154680)
+++ trunk/Source/WebCore/ChangeLog	2013-08-27 14:13:31 UTC (rev 154681)
@@ -1,3 +1,19 @@
+2013-08-27  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Column Breakpoint not working, may be off by 1
+        https://bugs.webkit.org/show_bug.cgi?id=120334
+
+        Reviewed by David Kilzer.
+
+        _javascript_Core 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  <[email protected]>
 
         Switch some more code to element child/descendant iterators

Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp (154680 => 154681)


--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2013-08-27 13:41:08 UTC (rev 154680)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2013-08-27 14:13:31 UTC (rev 154681)
@@ -390,7 +390,7 @@
 
 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 = _javascript_CallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, textPosition);
     if (m_lastExecutedSourceId != sourceID) {
         m_lastExecutedLine = -1;
@@ -404,7 +404,7 @@
     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());
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to