Title: [92371] trunk
Revision
92371
Author
[email protected]
Date
2011-08-04 06:54:18 -0700 (Thu, 04 Aug 2011)

Log Message

Web Inspector: replace isRegex with urlRegex in setBreakpointByUrl
https://bugs.webkit.org/show_bug.cgi?id=65684

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/Inspector.json:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::setBreakpointByUrl):
* inspector/InspectorDebuggerAgent.h:
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype.setBreakpoint):

LayoutTests:

* inspector/debugger/debugger-set-breakpoint-regex-expected.txt:
* inspector/debugger/debugger-set-breakpoint-regex.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92370 => 92371)


--- trunk/LayoutTests/ChangeLog	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/LayoutTests/ChangeLog	2011-08-04 13:54:18 UTC (rev 92371)
@@ -1,5 +1,15 @@
 2011-08-04  Pavel Feldman  <[email protected]>
 
+        Web Inspector: replace isRegex with urlRegex in setBreakpointByUrl
+        https://bugs.webkit.org/show_bug.cgi?id=65684
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/debugger-set-breakpoint-regex-expected.txt:
+        * inspector/debugger/debugger-set-breakpoint-regex.html:
+
+2011-08-04  Pavel Feldman  <[email protected]>
+
         Web Inspector: Rename sourceId -> scriptId in the protocol and the source code.
         https://bugs.webkit.org/show_bug.cgi?id=65682
 

Modified: trunk/LayoutTests/inspector/debugger/debugger-set-breakpoint-regex-expected.txt (92370 => 92371)


--- trunk/LayoutTests/inspector/debugger/debugger-set-breakpoint-regex-expected.txt	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/LayoutTests/inspector/debugger/debugger-set-breakpoint-regex-expected.txt	2011-08-04 13:54:18 UTC (rev 92371)
@@ -1,6 +1,20 @@
 Tests Debugger.setBreakpointByUrl with isRegex set to true.
 
 Debugger was enabled.
+
+Running: testSetNoneOfURLAndRegex
+{
+    code : -32000
+    message : "Either url or urlRegex must be specified."
+}
+
+Running: testSetBothURLAndRegex
+{
+    code : -32000
+    message : "Either url or urlRegex must be specified."
+}
+
+Running: testSetByRegex
 Set timer for test function.
 Script execution paused.
 Call stack:

Modified: trunk/LayoutTests/inspector/debugger/debugger-set-breakpoint-regex.html (92370 => 92371)


--- trunk/LayoutTests/inspector/debugger/debugger-set-breakpoint-regex.html	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/LayoutTests/inspector/debugger/debugger-set-breakpoint-regex.html	2011-08-04 13:54:18 UTC (rev 92371)
@@ -15,26 +15,53 @@
 
 function test()
 {
-    InspectorTest.startDebuggerTest(step1);
+    InspectorTest.runDebuggerTestSuite([
+        function testSetNoneOfURLAndRegex(next)
+        {
+            var url = ""
+            var urlRegex = "debugger-set-breakpoint.*";
+            DebuggerAgent.setBreakpointByUrl(undefined, undefined, 1, step2);
 
-    function step1()
-    {
-        var columnNumber = undefined;
-        var condition = undefined;
-        var isRegex = true;
-        DebuggerAgent.setBreakpointByUrl("debugger-set-breakpoint.*", 8, columnNumber, condition, isRegex, step2);
-    }
+            function step2(result)
+            {
+                InspectorTest.dump(result);
+                next();
+            }
+        },
 
-    function step2()
-    {
-        InspectorTest.runTestFunctionAndWaitUntilPaused(step3);
-    }
+        function testSetBothURLAndRegex(next)
+        {
+            var url = ""
+            var urlRegex = "debugger-set-breakpoint.*";
+            DebuggerAgent.setBreakpointByUrl(url, urlRegex, 1, step2);
 
-    function step3(callFrames)
-    {
-        InspectorTest.captureStackTrace(callFrames);
-        InspectorTest.completeDebuggerTest();
-    }
+            function step2(result)
+            {
+                InspectorTest.dump(result);
+                next();
+            }
+        },
+
+        function testSetByRegex(next)
+        {
+            var url = ""
+            var urlRegex = "debugger-set-breakpoint.*";
+            var columnNumber = undefined;
+            var condition = undefined;
+            DebuggerAgent.setBreakpointByUrl(url, urlRegex, 8, columnNumber, condition, step2);
+
+            function step2(result)
+            {
+                InspectorTest.runTestFunctionAndWaitUntilPaused(step3);
+            }
+        
+            function step3(callFrames)
+            {
+                InspectorTest.captureStackTrace(callFrames);
+                next();
+            }
+        }
+    ]);
 }
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (92370 => 92371)


--- trunk/Source/WebCore/ChangeLog	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/Source/WebCore/ChangeLog	2011-08-04 13:54:18 UTC (rev 92371)
@@ -1,3 +1,17 @@
+2011-08-04  Pavel Feldman  <[email protected]>
+
+        Web Inspector: replace isRegex with urlRegex in setBreakpointByUrl
+        https://bugs.webkit.org/show_bug.cgi?id=65684
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::setBreakpointByUrl):
+        * inspector/InspectorDebuggerAgent.h:
+        * inspector/front-end/DebuggerModel.js:
+        (WebInspector.DebuggerModel.prototype.setBreakpoint):
+
 2011-08-03  Philippe Normand  <[email protected]>
 
         [GTK] fullscreen/video-controls-override.html fails

Modified: trunk/Source/WebCore/inspector/Inspector.json (92370 => 92371)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-08-04 13:54:18 UTC (rev 92371)
@@ -1514,17 +1514,17 @@
             {
                 "name": "setBreakpointByUrl",
                 "parameters": [
-                    { "name": "url", "type": "string", "description": "URL of the resource to set breakpoint on." },
+                    { "name": "url", "type": "string", "optional": true, "description": "URL of the resources to set breakpoint on." },
+                    { "name": "urlRegex", "type": "string", "optional": true, "description": "Regex pattern for the URLs of the resources to set breakpoints on. Either <code>url</code> or <code>urlRegex</code> must be specified." },
                     { "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." },
                     { "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." },
-                    { "name": "condition", "type": "string", "optional": true, "description": "_expression_ to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this _expression_ evaluates to true." },
-                    { "name": "isRegex", "type": "boolean", "optional": true, "description": "If true, given <code>url</code> is considered to be a regular _expression_." }
+                    { "name": "condition", "type": "string", "optional": true, "description": "_expression_ to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this _expression_ evaluates to true." }
                 ],
                 "returns": [
-                    { "name": "breakpointId", "type": "string", "description": "Id of the created breakpoint for further manipulations." },
-                    { "name": "locations", "optional": true, "type": "array", "items": { "$ref": "Location"}, "description": "List of the locations this breakpoint resolved into." }
+                    { "name": "breakpointId", "type": "string", "description": "Id of the created breakpoint for further reference." },
+                    { "name": "locations", "optional": true, "type": "array", "items": { "$ref": "Location"}, "description": "List of the locations this breakpoint resolved into upon addition." }
                 ],
-                "description": "Sets _javascript_ breakpoint at a given location specified by URL. This breakpoint will survive page reload."
+                "description": "Sets _javascript_ breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in <code>locations</code> property. Further matching script parsing will result in subsequent <code>Debugger.breakpointResolved</code> events issued. This logical breakpoint will survive page reloads."
             },
             {
                 "name": "setBreakpoint",

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (92370 => 92371)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-08-04 13:54:18 UTC (rev 92371)
@@ -181,11 +181,17 @@
     return url == pattern;
 }
 
-void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString*, const String& url, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, const bool* const optionalIsRegex, String* outBreakpointId, RefPtr<InspectorArray>* locations)
+void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, const String* const optionalURL, const String* const optionalURLRegex, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorArray>* locations)
 {
+    if (!optionalURL == !optionalURLRegex) {
+        *errorString = "Either url or urlRegex must be specified.";
+        return;
+    }
+
+    String url = "" ? *optionalURL : *optionalURLRegex;
     int columnNumber = optionalColumnNumber ? *optionalColumnNumber : 0;
     String condition = optionalCondition ? *optionalCondition : "";
-    bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
+    bool isRegex = optionalURLRegex;
 
     String breakpointId = (isRegex ? "/" + url + "/" : url) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber);
     RefPtr<InspectorObject> breakpointsCookie = m_inspectorState->getObject(DebuggerAgentState::_javascript_Breakpoints);

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (92370 => 92371)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-08-04 13:54:18 UTC (rev 92371)
@@ -82,7 +82,7 @@
     // Part of the protocol.
     void setBreakpointsActive(ErrorString*, bool active);
 
-    void setBreakpointByUrl(ErrorString*, const String& url, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, const bool* const optionalIsRegex, String* breakpointId, RefPtr<InspectorArray>* locations);
+    void setBreakpointByUrl(ErrorString*, const String* const optionalURL, const String* const optionalURLRegex, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorArray>* locations);
     void setBreakpoint(ErrorString*, PassRefPtr<InspectorObject> location, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorObject>* actualLocation);
     void removeBreakpoint(ErrorString*, const String& breakpointId);
     void continueToLocation(ErrorString*, PassRefPtr<InspectorObject> location);

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerModel.js (92370 => 92371)


--- trunk/Source/WebCore/inspector/front-end/DebuggerModel.js	2011-08-04 13:42:54 UTC (rev 92370)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerModel.js	2011-08-04 13:54:18 UTC (rev 92371)
@@ -89,7 +89,7 @@
             if (callback)
                 callback(error ? null : breakpointId, locations);
         }
-        DebuggerAgent.setBreakpointByUrl(url, lineNumber, columnNumber, condition, didSetBreakpoint.bind(this));
+        DebuggerAgent.setBreakpointByUrl(url, undefined, lineNumber, columnNumber, condition, didSetBreakpoint.bind(this));
         WebInspector.userMetrics.ScriptsBreakpointSet.record();
     },
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to