Web Inspector: document Debugger.paused, introduce types for ids in Debugger domain.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 14:00:37 +0000 (14:00 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 14:00:37 +0000 (14:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68363

Migrates from poorly documented "details" object to explicit parameters
containing break type and data.

Reviewed by Tony Gentilcore.

Source/WebCore:

* inspector/InjectedScriptSource.js:
():
* inspector/Inspector.json:
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
(WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
(WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
(WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
(WebCore::InspectorDebuggerAgent::schedulePauseOnNextStatement):
(WebCore::InspectorDebuggerAgent::cancelPauseOnNextStatement):
(WebCore::InspectorDebuggerAgent::pause):
(WebCore::InspectorDebuggerAgent::didPause):
(WebCore::InspectorDebuggerAgent::didContinue):
(WebCore::InspectorDebuggerAgent::breakProgram):
(WebCore::InspectorDebuggerAgent::clear):
(WebCore::InspectorDebuggerAgent::clearBreakDetails):
* inspector/InspectorDebuggerAgent.h:
* inspector/front-end/DOMBreakpointsSidebarPane.js:
(WebInspector.DOMBreakpointsSidebarPane.prototype.createBreakpointHitStatusMessage.didPushNodeToFrontend):
(WebInspector.DOMBreakpointsSidebarPane.prototype.createBreakpointHitStatusMessage):
(WebInspector.DOMBreakpointsSidebarPane.prototype.highlightBreakpoint):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype._pausedScript):
(WebInspector.DebuggerDispatcher.prototype.paused):
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.PresentationCallFrame.prototype.evaluate):
* inspector/front-end/ScopeChainSidebarPane.js:
(WebInspector.ScopeChainSidebarPane.prototype.update):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._debuggerPaused.didCreateBreakpointHitStatusMessage):
(WebInspector.ScriptsPanel.prototype._debuggerPaused.else.didGetSourceLocation):
(WebInspector.ScriptsPanel.prototype._debuggerPaused):

LayoutTests:

* http/tests/inspector/debugger-test.js:
(initialize_DebuggerTest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95538 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/debugger-test.js
Source/WebCore/ChangeLog
Source/WebCore/inspector/InjectedScriptSource.js
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.h
Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js
Source/WebCore/inspector/front-end/DebuggerModel.js
Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
Source/WebCore/inspector/front-end/ScopeChainSidebarPane.js
Source/WebCore/inspector/front-end/ScriptsPanel.js

index 5731231..3d400c5 100644 (file)
@@ -1,3 +1,16 @@
+2011-09-19  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: document Debugger.paused, introduce types for ids in Debugger domain.
+        https://bugs.webkit.org/show_bug.cgi?id=68363
+
+        Migrates from poorly documented "details" object to explicit parameters
+        containing break type and data.
+
+        Reviewed by Tony Gentilcore.
+
+        * http/tests/inspector/debugger-test.js:
+        (initialize_DebuggerTest):
+
 2011-09-15  Pavel Feldman  <pfeldman@google.com>
 
         Web Inspector: refactor ConsoleView, Drawer, ConsolePanel trio.
index 4fdf356..b382f2e 100644 (file)
@@ -131,11 +131,11 @@ InspectorTest.dumpSourceFrameContents = function(sourceFrame)
     InspectorTest.addResult("==Source frame contents end==");
 };
 
-InspectorTest._pausedScript = function(details)
+InspectorTest._pausedScript = function(callFrames, reason, auxData)
 {
     if (!InspectorTest._quiet)
         InspectorTest.addResult("Script execution paused.");
-    InspectorTest._callFrames = details.callFrames;
+    InspectorTest._callFrames = callFrames;
     if (InspectorTest._waitUntilPausedCallback) {
         var callback = InspectorTest._waitUntilPausedCallback;
         delete InspectorTest._waitUntilPausedCallback;
index 229241c..903faba 100644 (file)
@@ -1,3 +1,59 @@
+2011-09-19  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: document Debugger.paused, introduce types for ids in Debugger domain.
+        https://bugs.webkit.org/show_bug.cgi?id=68363
+
+        Migrates from poorly documented "details" object to explicit parameters
+        containing break type and data.
+
+        Reviewed by Tony Gentilcore.
+
+        * inspector/InjectedScriptSource.js:
+        ():
+        * inspector/Inspector.json:
+        * inspector/InspectorDOMDebuggerAgent.cpp:
+        (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
+        (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
+        (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
+        (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
+        (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
+        (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
+        (WebCore::InspectorDebuggerAgent::schedulePauseOnNextStatement):
+        (WebCore::InspectorDebuggerAgent::cancelPauseOnNextStatement):
+        (WebCore::InspectorDebuggerAgent::pause):
+        (WebCore::InspectorDebuggerAgent::didPause):
+        (WebCore::InspectorDebuggerAgent::didContinue):
+        (WebCore::InspectorDebuggerAgent::breakProgram):
+        (WebCore::InspectorDebuggerAgent::clear):
+        (WebCore::InspectorDebuggerAgent::clearBreakDetails):
+        * inspector/InspectorDebuggerAgent.h:
+        * inspector/front-end/DOMBreakpointsSidebarPane.js:
+        (WebInspector.DOMBreakpointsSidebarPane.prototype.createBreakpointHitStatusMessage.didPushNodeToFrontend):
+        (WebInspector.DOMBreakpointsSidebarPane.prototype.createBreakpointHitStatusMessage):
+        (WebInspector.DOMBreakpointsSidebarPane.prototype.highlightBreakpoint):
+        * inspector/front-end/DebuggerModel.js:
+        (WebInspector.DebuggerModel.prototype._pausedScript):
+        (WebInspector.DebuggerDispatcher.prototype.paused):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.PresentationCallFrame.prototype.evaluate):
+        * inspector/front-end/ScopeChainSidebarPane.js:
+        (WebInspector.ScopeChainSidebarPane.prototype.update):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._debuggerPaused.didCreateBreakpointHitStatusMessage):
+        (WebInspector.ScriptsPanel.prototype._debuggerPaused.else.didGetSourceLocation):
+        (WebInspector.ScriptsPanel.prototype._debuggerPaused):
+
+2011-09-19  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: use strict types for Breakpoint and CallFrame ids in the protocol definition.
+        https://bugs.webkit.org/show_bug.cgi?id=68172
+
+        Reviewed by Tony Gentilcore.
+
+        * inspector/Inspector.json:
+
 2011-09-15  Pavel Feldman  <pfeldman@google.com>
 
         Web Inspector: refactor ConsoleView, Drawer, ConsolePanel trio. Remove animation
index c6ca5f6..1fef5db 100644 (file)
@@ -488,7 +488,7 @@ InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType)
 
 InjectedScript.CallFrameProxy = function(ordinal, callFrame)
 {
-    this.id = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
+    this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
     this.functionName = (callFrame.type === "function" ? callFrame.functionName : "");
     this.location = { scriptId: String(callFrame.sourceID), lineNumber: callFrame.line, columnNumber: callFrame.column };
     this.scopeChain = this._wrapScopeChain(callFrame);
index 5028d4b..1172392 100644 (file)
                 "properties": [
                     { "name": "name", "type": "string", "description": "Property name." },
                     { "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." },
-                    { "name": "writable", "type": "boolean", "description": "True iff the value associated with the property may be changed (data descriptors only)." },
+                    { "name": "writable", "type": "boolean", "description": "True if the value associated with the property may be changed (data descriptors only)." },
                     { "name": "get", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a getter for the property, or <code>undefined</code> if there is no getter (accessor descriptors only)." },
                     { "name": "set", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a setter for the property, or <code>undefined</code> if there is no setter (accessor descriptors only)." },
-                    { "name": "configurable", "type": "boolean", "description": "True iff the type of this property descriptor may be changed and if the property may be deleted from the corresponding object." },
-                    { "name": "enumerable", "type": "boolean", "description": "True iff this property shows up during enumeration of the properties on the corresponding object." },
-                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." }
+                    { "name": "configurable", "type": "boolean", "description": "True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object." },
+                    { "name": "enumerable", "type": "boolean", "description": "True if this property shows up during enumeration of the properties on the corresponding object." },
+                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }
                 ]
             },
             {
                 "parameters": [
                     { "name": "expression", "type": "string", "description": "Expression to evaluate." },
                     { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." },
-                    { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." },
-                    { "name": "doNotPauseOnExceptions", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions. Overrides setPauseOnException state." },
+                    { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation.", "hidden": true },
+                    { "name": "doNotPauseOnExceptions", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions. Overrides setPauseOnException state.", "hidden": true },
                     { "name": "frameId", "type": "string", "optional": true, "description": "Specifies in which frame to perform evaluation.", "hidden": true },
                     { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }
                 ],
                 "returns": [
                     { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." },
-                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." }
+                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }
                 ],
                 "description": "Evaluates expression on global object."
             },
                 ],
                 "returns": [
                     { "name": "result", "$ref": "RemoteObject", "description": "Call result." },
-                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." }
+                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }
                 ],
                 "description": "Calls function with given declaration on the given object."
             },
     },
     {
         "domain": "Debugger",
-        "description": "Debugger domain exposes JavaScript debugging functions. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.",
+        "description": "Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.",
         "types": [
             {
+                "id": "BreakpointId",
+                "type": "string",
+                "description": "Breakpoint identifier."
+            },
+            {
                 "id": "ScriptId",
                 "type": "string",
                 "description": "Unique script identifier."
             },
             {
+                "id": "CallFrameId",
+                "type": "string",
+                "description": "Call frame identifier."
+            },
+            {
                 "id": "Location",
                 "type": "object",
                 "properties": [
                 "id": "CallFrame",
                 "type": "object",
                 "properties": [
-                    { "name": "id", "type": "string", "description": "Call frame identifier. This identifier is only valid while the virtual machine is paused." },
+                    { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier. This identifier is only valid while the virtual machine is paused." },
                     { "name": "functionName", "type": "string", "description": "Name of the JavaScript function called on this call frame." },
                     { "name": "location", "$ref": "Location", "description": "Location in the source code." },
                     { "name": "scopeChain", "type": "array", "items": { "$ref": "Scope" }, "description": "Scope chain for this call frame." },
                     { "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 reference." },
+                    { "name": "breakpointId", "$ref": "BreakpointId", "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 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."
+                "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>breakpointResolved</code> events issued. This logical breakpoint will survive page reloads."
             },
             {
                 "name": "setBreakpoint",
                     { "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": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." },
                     { "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." }
                 ],
                 "description": "Sets JavaScript breakpoint at a given location."
             {
                 "name": "removeBreakpoint",
                 "parameters": [
-                    { "name": "breakpointId", "type": "string" }
+                    { "name": "breakpointId", "$ref": "BreakpointId" }
                 ],
                 "description": "Removes JavaScript breakpoint."
             },
             },
             {
                 "name": "stepInto",
-                "description": "Steps into the statement."
+                "description": "Steps into the function call."
             },
             {
                 "name": "stepOut",
-                "description": "Steps out of the function."
+                "description": "Steps out of the function call."
             },
             {
                 "name": "pause",
                 "parameters": [
                     { "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to edit." },
                     { "name": "scriptSource", "type": "string", "description": "New content of the script." },
-                    { "name": "preview", "type": "boolean", "optional": true, "description": " If true the change will not actually be applied. Preview mode may be used to get result description without actually modifying the code." }
+                    { "name": "preview", "type": "boolean", "optional": true, "description": " If true the change will not actually be applied. Preview mode may be used to get result description without actually modifying the code.", "hidden": true }
                 ],
                 "returns": [
                     { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame"}, "description": "New stack trace in case editing has happened while VM was stopped." },
-                    { "name": "result", "type": "object", "optional": true, "description": "VM-specific description of the changes applied." }
+                    { "name": "result", "type": "object", "optional": true, "description": "VM-specific description of the changes applied.", "hidden": true }
                 ],
                 "description": "Edits JavaScript source live."
             },
                 "returns": [
                     { "name": "scriptSource", "type": "string", "description": "Script source." }
                 ],
-                "description": "Returns source for the script with given ID."
+                "description": "Returns source for the script with given id."
             },
             {
                 "name": "setPauseOnExceptions",
                 "parameters": [
                     { "name": "state", "type": "string", "enum": ["none", "uncaught", "all"], "description": "Pause on exceptions mode." }
                 ],
-                "description": "Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions."
+                "description": "Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is <code>none</code>."
             },
             {
                 "name": "evaluateOnCallFrame",
                 "parameters": [
-                    { "name": "callFrameId", "type": "string", "description": "Call frame identifier to evaluate on. This identifier is a part of backtrace reported by the <code>pausedScript</code>." },
+                    { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." },
                     { "name": "expression", "type": "string", "description": "Expression to evaluate." },
                     { "name": "objectGroup", "type": "string", "optional": true, "description": "String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>)." },
-                    { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated expression, defaults to false." },
+                    { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated expression, defaults to false.", "hidden": true },
                     { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }
                 ],
                 "returns": [
                     { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." },
-                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." }
+                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }
                 ],
                 "description": "Evaluates expression on a given call frame."
             }
         "events": [
             {
                 "name": "debuggerWasEnabled",
-                "description": "Fired when debugger gets enabled (deprecated)."
+                "description": "Fired when debugger gets enabled (deprecated).",
+                "hidden": true
             },
             {
                 "name": "debuggerWasDisabled",
-                "description": "Fired when debugger gets disabled (deprecated)."
+                "description": "Fired when debugger gets disabled (deprecated).",
+                "hidden": true
             },
             {
                 "name": "scriptParsed",
                 "parameters": [
                     { "name": "scriptId", "$ref": "ScriptId", "description": "Identifier of the script parsed." },
-                    { "name": "url", "type": "string", "description": "URL of the script parsed (if any)." },
+                    { "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." },
                     { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." },
                     { "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." },
                     { "name": "endLine", "type": "integer", "description": "Last line of the script." },
                     { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." },
                     { "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." }
                 ],
-                "description": "Fired when virtual machine parses script. This even is also fired for all known scripts upon enabling debugger."
+                "description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger."
             },
             {
                 "name": "scriptFailedToParse",
                 "parameters": [
                     { "name": "url", "type": "string", "description": "URL of the script that failed to parse." },
-                    { "name": "data", "type": "string", "description": "Source text of the script that failed to parse." },
-                    { "name": "firstLine", "type": "integer", "description": "Line offset of the script within the resource." },
+                    { "name": "scriptSource", "type": "string", "description": "Source text of the script that failed to parse." },
+                    { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource." },
                     { "name": "errorLine", "type": "integer", "description": "Line with error." },
                     { "name": "errorMessage", "type": "string", "description": "Parse error message." }
                 ],
             {
                 "name": "breakpointResolved",
                 "parameters": [
-                    { "name": "breakpointId", "type": "string", "description": "Breakpoint unique identifier." },
+                    { "name": "breakpointId", "$ref": "BreakpointId", "description": "Breakpoint unique identifier." },
                     { "name": "location", "$ref": "Location", "description": "Actual breakpoint location." }
                 ],
                 "description": "Fired when breakpoint is resolved to an actual script and location."
             {
                 "name": "paused",
                 "parameters": [
-                    { 
-                        "name": "details",
-                        "type": "object",
-                        "properties": [
-                            { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." },
-                            { "name": "exception", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Current exception object if script execution is paused when an exception is being thrown." }
-                        ],
-                        "description": "Call stack information."
-                    }
+                    { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." },
+                    { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "other" ], "description": "Pause reason." },
+                    { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." }
                 ],
                 "description": "Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria."
             },
index 81b61c3..31f8ae5 100644 (file)
@@ -146,8 +146,7 @@ void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node* node)
     if (hasBreakpoint(node, AttributeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
         descriptionForDOMEvent(node, AttributeModified, false, eventData.get());
-        eventData->setString("breakpointType", domNativeBreakpointType);
-        m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
+        m_debuggerAgent->breakProgram(domNativeBreakpointType, eventData.release());
     }
 }
 
@@ -241,8 +240,7 @@ void InspectorDOMDebuggerAgent::willInsertDOMNode(Node*, Node* parent)
     if (hasBreakpoint(parent, SubtreeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
         descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get());
-        eventData->setString("breakpointType", domNativeBreakpointType);
-        m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
+        m_debuggerAgent->breakProgram(domNativeBreakpointType, eventData.release());
     }
 }
 
@@ -252,13 +250,11 @@ void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node)
     if (hasBreakpoint(node, NodeRemoved)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
         descriptionForDOMEvent(node, NodeRemoved, false, eventData.get());
-        eventData->setString("breakpointType", domNativeBreakpointType);
-        m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
+        m_debuggerAgent->breakProgram(domNativeBreakpointType, eventData.release());
     } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
         descriptionForDOMEvent(node, SubtreeModified, false, eventData.get());
-        eventData->setString("breakpointType", domNativeBreakpointType);
-        m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
+        m_debuggerAgent->breakProgram(domNativeBreakpointType, eventData.release());
     }
 }
 
@@ -267,8 +263,7 @@ void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element)
     if (hasBreakpoint(element, AttributeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
         descriptionForDOMEvent(element, AttributeModified, false, eventData.get());
-        eventData->setString("breakpointType", domNativeBreakpointType);
-        m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
+        m_debuggerAgent->breakProgram(domNativeBreakpointType, eventData.release());
     }
 }
 
@@ -335,12 +330,11 @@ void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(const String& categor
         return;
 
     RefPtr<InspectorObject> eventData = InspectorObject::create();
-    eventData->setString("breakpointType", eventListenerNativeBreakpointType);
     eventData->setString("eventName", fullEventName);
     if (synchronous)
-        m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
+        m_debuggerAgent->breakProgram(eventListenerNativeBreakpointType, eventData.release());
     else
-        m_debuggerAgent->schedulePauseOnNextStatement(NativeBreakpointDebuggerEventType, eventData.release());
+        m_debuggerAgent->schedulePauseOnNextStatement(eventListenerNativeBreakpointType, eventData.release());
 }
 
 void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString*, const String& url)
@@ -386,10 +380,9 @@ void InspectorDOMDebuggerAgent::willSendXMLHttpRequest(const String& url)
         return;
 
     RefPtr<InspectorObject> eventData = InspectorObject::create();
-    eventData->setString("breakpointType", xhrNativeBreakpointType);
     eventData->setString("breakpointURL", breakpointURL);
     eventData->setString("url", url);
-    m_debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
+    m_debuggerAgent->breakProgram(xhrNativeBreakpointType, eventData.release());
 }
 
 void InspectorDOMDebuggerAgent::clear()
index dc60843..b8fbb5d 100644 (file)
@@ -60,6 +60,8 @@ InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentin
     , m_javaScriptPauseScheduled(false)
     , m_listener(0)
 {
+    // FIXME: make breakReason optional so that there was no need to init it with "other".
+    clearBreakDetails();
 }
 
 InspectorDebuggerAgent::~InspectorDebuggerAgent()
@@ -335,13 +337,12 @@ void InspectorDebuggerAgent::getScriptSource(ErrorString*, const String& scriptI
     *scriptSource = m_scripts.get(scriptId).source;
 }
 
-void InspectorDebuggerAgent::schedulePauseOnNextStatement(DebuggerEventType type, PassRefPtr<InspectorValue> data)
+void InspectorDebuggerAgent::schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<InspectorObject> data)
 {
     if (m_javaScriptPauseScheduled)
         return;
-    m_breakProgramDetails = InspectorObject::create();
-    m_breakProgramDetails->setNumber("eventType", type);
-    m_breakProgramDetails->setValue("eventData", data);
+    m_breakReason = breakReason;
+    m_breakAuxData = data;
     scriptDebugServer().setPauseOnNextStatement(true);
 }
 
@@ -349,13 +350,16 @@ void InspectorDebuggerAgent::cancelPauseOnNextStatement()
 {
     if (m_javaScriptPauseScheduled)
         return;
-    m_breakProgramDetails = 0;
+    clearBreakDetails();
     scriptDebugServer().setPauseOnNextStatement(false);
 }
 
 void InspectorDebuggerAgent::pause(ErrorString*)
 {
-    schedulePauseOnNextStatement(JavaScriptPauseEventType, InspectorObject::create());
+    if (m_javaScriptPauseScheduled)
+        return;
+    clearBreakDetails();
+    scriptDebugServer().setPauseOnNextStatement(true);
     m_javaScriptPauseScheduled = true;
 }
 
@@ -470,17 +474,15 @@ void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu
     m_pausedScriptState = scriptState;
     m_currentCallStack = callFrames;
 
-    if (!m_breakProgramDetails)
-        m_breakProgramDetails = InspectorObject::create();
-    m_breakProgramDetails->setValue("callFrames", currentCallFrames());
-
     if (!exception.hasNoValue()) {
         InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
-        if (!injectedScript.hasNoValue())
-            m_breakProgramDetails->setValue("exception", injectedScript.wrapObject(exception, "backtrace"));
+        if (!injectedScript.hasNoValue()) {
+            m_breakReason = "exception";
+            m_breakAuxData = injectedScript.wrapObject(exception, "backtrace");
+        }
     }
 
-    m_frontend->paused(m_breakProgramDetails);
+    m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData);
     m_javaScriptPauseScheduled = false;
 
     if (!m_continueToLocationBreakpointId.isEmpty()) {
@@ -493,15 +495,14 @@ void InspectorDebuggerAgent::didContinue()
 {
     m_pausedScriptState = 0;
     m_currentCallStack = ScriptValue();
-    m_breakProgramDetails = 0;
+    clearBreakDetails();
     m_frontend->resumed();
 }
 
-void InspectorDebuggerAgent::breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data)
+void InspectorDebuggerAgent::breakProgram(const String& breakReason, PassRefPtr<InspectorObject> data)
 {
-    m_breakProgramDetails = InspectorObject::create();
-    m_breakProgramDetails->setNumber("eventType", type);
-    m_breakProgramDetails->setValue("eventData", data);
+    m_breakReason = breakReason;
+    m_breakAuxData = data;
     scriptDebugServer().breakProgram();
 }
 
@@ -512,7 +513,7 @@ void InspectorDebuggerAgent::clear()
     m_scripts.clear();
     m_breakpointIdToDebugServerBreakpointIds.clear();
     m_continueToLocationBreakpointId = String();
-    m_breakProgramDetails.clear();
+    clearBreakDetails();
     m_javaScriptPauseScheduled = false;
 }
 
@@ -525,6 +526,12 @@ bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString)
     return true;
 }
 
+void InspectorDebuggerAgent::clearBreakDetails()
+{
+    m_breakReason = "other";
+    m_breakAuxData = 0;
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
index 02ebfc0..185aab8 100644 (file)
@@ -57,12 +57,6 @@ class ScriptValue;
 
 typedef String ErrorString;
 
-enum DebuggerEventType {
-    JavaScriptPauseEventType,
-    JavaScriptBreakpointEventType,
-    NativeBreakpointDebuggerEventType
-};
-
 class InspectorDebuggerAgent : public ScriptDebugListener {
     WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -89,9 +83,9 @@ public:
 
     void setScriptSource(ErrorString*, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result);
     void getScriptSource(ErrorString*, const String& scriptId, String* scriptSource);
-    void schedulePauseOnNextStatement(DebuggerEventType type, PassRefPtr<InspectorValue> data);
+    void schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<InspectorObject> data);
     void cancelPauseOnNextStatement();
-    void breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data);
+    void breakProgram(const String& breakReason, PassRefPtr<InspectorObject> data);
     void pause(ErrorString*);
     void resume(ErrorString*);
     void stepOver(ErrorString*);
@@ -137,6 +131,7 @@ private:
     PassRefPtr<InspectorObject> resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint&);
     void clear();
     bool assertPaused(ErrorString*);
+    void clearBreakDetails();
 
     typedef HashMap<String, Script> ScriptsMap;
     typedef HashMap<String, Vector<String> > BreakpointIdToDebugServerBreakpointIdsMap;
@@ -150,7 +145,8 @@ private:
     ScriptsMap m_scripts;
     BreakpointIdToDebugServerBreakpointIdsMap m_breakpointIdToDebugServerBreakpointIds;
     String m_continueToLocationBreakpointId;
-    RefPtr<InspectorObject> m_breakProgramDetails;
+    String m_breakReason;
+    RefPtr<InspectorObject> m_breakAuxData;
     bool m_javaScriptPauseScheduled;
     Listener* m_listener;
 };
index 279748c..17b48cf 100644 (file)
@@ -86,34 +86,34 @@ WebInspector.DOMBreakpointsSidebarPane.prototype = {
         }
     },
 
-    createBreakpointHitStatusMessage: function(eventData, callback)
+    createBreakpointHitStatusMessage: function(auxData, callback)
     {
-        if (eventData.type === this._breakpointTypes.SubtreeModified) {
-            var targetNodeObject = WebInspector.RemoteObject.fromPayload(eventData.targetNode);
+        if (auxData.type === this._breakpointTypes.SubtreeModified) {
+            var targetNodeObject = WebInspector.RemoteObject.fromPayload(auxData.targetNode);
             function didPushNodeToFrontend(targetNodeId)
             {
                 if (targetNodeId)
                     targetNodeObject.release();
-                this._doCreateBreakpointHitStatusMessage(eventData, targetNodeId, callback);
+                this._doCreateBreakpointHitStatusMessage(auxData, targetNodeId, callback);
             }
             targetNodeObject.pushNodeToFrontend(didPushNodeToFrontend.bind(this));
         } else
-            this._doCreateBreakpointHitStatusMessage(eventData, null, callback);
+            this._doCreateBreakpointHitStatusMessage(auxData, null, callback);
     },
 
-    _doCreateBreakpointHitStatusMessage: function (eventData, targetNodeId, callback)
+    _doCreateBreakpointHitStatusMessage: function (auxData, targetNodeId, callback)
     {
         var message;
-        var typeLabel = this._breakpointTypeLabels[eventData.type];
-        var linkifiedNode = WebInspector.panels.elements.linkifyNodeById(eventData.nodeId);
+        var typeLabel = this._breakpointTypeLabels[auxData.type];
+        var linkifiedNode = WebInspector.panels.elements.linkifyNodeById(auxData.nodeId);
         var substitutions = [typeLabel, linkifiedNode];
         var targetNode = "";
         if (targetNodeId)
             targetNode = WebInspector.panels.elements.linkifyNodeById(targetNodeId);
 
-        if (eventData.type === this._breakpointTypes.SubtreeModified) {
-            if (eventData.insertion) {
-                if (targetNodeId !== eventData.nodeId) {
+        if (auxData.type === this._breakpointTypes.SubtreeModified) {
+            if (auxData.insertion) {
+                if (targetNodeId !== auxData.nodeId) {
                     message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.";
                     substitutions.push(targetNode);
                 } else
@@ -240,9 +240,9 @@ WebInspector.DOMBreakpointsSidebarPane.prototype = {
         this._saveBreakpoints();
     },
 
-    highlightBreakpoint: function(eventData)
+    highlightBreakpoint: function(auxData)
     {
-        var breakpointId = this._createBreakpointId(eventData.nodeId, eventData.type);
+        var breakpointId = this._createBreakpointId(auxData.nodeId, auxData.type);
         var element = this._breakpointElements[breakpointId];
         if (!element)
             return;
index 575e1c0..795c8c0 100644 (file)
@@ -190,8 +190,9 @@ WebInspector.DebuggerModel.prototype = {
         return this._debuggerPausedDetails;
     },
 
-    _pausedScript: function(details)
+    _pausedScript: function(callFrames, reason, auxData)
     {
+        var details = { callFrames: callFrames, reason: reason, auxData: auxData };
         this._debuggerPausedDetails = details;
         this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, details);
     },
@@ -234,9 +235,9 @@ WebInspector.DebuggerDispatcher = function(debuggerModel)
 }
 
 WebInspector.DebuggerDispatcher.prototype = {
-    paused: function(details)
+    paused: function(callFrames, reason, auxData)
     {
-        this._debuggerModel._pausedScript(details);
+        this._debuggerModel._pausedScript(callFrames, reason, auxData);
     },
 
     resumed: function()
index 0becb51..b6eeb8f 100644 (file)
@@ -489,7 +489,7 @@ WebInspector.PresentationCallFrame.prototype = {
             else
                 callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
         }
-        DebuggerAgent.evaluateOnCallFrame(this._callFrame.id, code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluateOnCallFrame.bind(this));
+        DebuggerAgent.evaluateOnCallFrame(this._callFrame.callFrameId, code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluateOnCallFrame.bind(this));
     },
 
     sourceLine: function(callback)
index 115e054..769fe10 100644 (file)
@@ -75,7 +75,8 @@ WebInspector.ScopeChainSidebarPane.prototype = {
                     if (callFrame.this)
                         extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(callFrame.this)) ];
                     if (i == 0) {
-                        var exception = WebInspector.debuggerModel.debuggerPausedDetails.exception;
+                        var details = WebInspector.debuggerModel.debuggerPausedDetails;
+                        var exception = details.reason === WebInspector.ScriptsPanel.BreakReason.Exception ? details.auxData : 0;
                         if (exception) {
                             extraProperties = extraProperties || [];
                             extraProperties.push(new WebInspector.RemoteObjectProperty("<exception>", WebInspector.RemoteObject.fromPayload(exception)));
index 40fde2b..c310948 100644 (file)
@@ -185,10 +185,11 @@ WebInspector.ScriptsPanel.PauseOnExceptionsState = {
     PauseOnUncaughtExceptions: "uncaught"
 };
 
-WebInspector.ScriptsPanel.BrowserBreakpointTypes = {
+WebInspector.ScriptsPanel.BreakReason = {
     DOM: "DOM",
     EventListener: "EventListener",
-    XHR: "XHR"
+    XHR: "XHR",
+    Exception: "exception"
 }
 
 WebInspector.ScriptsPanel.prototype = {
@@ -478,32 +479,26 @@ WebInspector.ScriptsPanel.prototype = {
         this.sidebarPanes.callstack.update(callFrames, details);
         this.sidebarPanes.callstack.selectedCallFrame = this._presentationModel.selectedCallFrame;
 
-        if (details.eventType === WebInspector.DebuggerEventTypes.NativeBreakpoint) {
-            if (details.eventData.breakpointType === WebInspector.ScriptsPanel.BrowserBreakpointTypes.DOM) {
-                this.sidebarPanes.domBreakpoints.highlightBreakpoint(details.eventData);
-                function didCreateBreakpointHitStatusMessage(element)
-                {
-                    this.sidebarPanes.callstack.setStatus(element);
-                }
-                this.sidebarPanes.domBreakpoints.createBreakpointHitStatusMessage(details.eventData, didCreateBreakpointHitStatusMessage.bind(this));
-            } else if (details.eventData.breakpointType === WebInspector.ScriptsPanel.BrowserBreakpointTypes.EventListener) {
-                var eventName = details.eventData.eventName;
-                this.sidebarPanes.eventListenerBreakpoints.highlightBreakpoint(details.eventData.eventName);
-                var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName);
-                this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a \"%s\" Event Listener.", eventNameForUI));
-            } else if (details.eventData.breakpointType === WebInspector.ScriptsPanel.BrowserBreakpointTypes.XHR) {
-                this.sidebarPanes.xhrBreakpoints.highlightBreakpoint(details.eventData.breakpointURL);
-                this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a XMLHttpRequest."));
+        if (details.reason === WebInspector.ScriptsPanel.BreakReason.DOM) {
+            this.sidebarPanes.domBreakpoints.highlightBreakpoint(details.auxData);
+            function didCreateBreakpointHitStatusMessage(element)
+            {
+                this.sidebarPanes.callstack.setStatus(element);
             }
+            this.sidebarPanes.domBreakpoints.createBreakpointHitStatusMessage(details.auxData, didCreateBreakpointHitStatusMessage.bind(this));
+        } else if (details.reason === WebInspector.ScriptsPanel.BreakReason.EventListener) {
+            var eventName = details.auxData.eventName;
+            this.sidebarPanes.eventListenerBreakpoints.highlightBreakpoint(details.auxData.eventName);
+            var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName);
+            this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a \"%s\" Event Listener.", eventNameForUI));
+        } else if (details.reason === WebInspector.ScriptsPanel.BreakReason.XHR) {
+            this.sidebarPanes.xhrBreakpoints.highlightBreakpoint(details.auxData.breakpointURL);
+            this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a XMLHttpRequest."));
+        } else if (details.reason === WebInspector.ScriptsPanel.BreakReason.Exception) {
+            this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on exception: '%s'.", details.auxData.description));
         } else {
             function didGetSourceLocation(uiSourceCode, lineNumber)
             {
-                var exception = WebInspector.debuggerModel.debuggerPausedDetails.exception;
-                if (exception) {
-                    this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on exception: '%s'.", exception.description));
-                    return;
-                }
-
                 if (!uiSourceCode || !this._presentationModel.findBreakpoint(uiSourceCode, lineNumber))
                     return;
                 this.sidebarPanes.jsBreakpoints.highlightBreakpoint(uiSourceCode, lineNumber);