Title: [89127] trunk/Source/WebCore
Revision
89127
Author
[email protected]
Date
2011-06-17 01:19:26 -0700 (Fri, 17 Jun 2011)

Log Message

2011-06-16  Yury Semikhatsky  <[email protected]>

        Reviewed by Pavel Feldman.

        Web Inspector: return description of the changes applied in response to editScriptSource command
        https://bugs.webkit.org/show_bug.cgi?id=62801

        Return description of the changes made in response to Debugger.editScriptSource command.

        * bindings/js/ScriptDebugServer.cpp:
        (WebCore::ScriptDebugServer::editScriptSource):
        * bindings/js/ScriptDebugServer.h:
        * bindings/v8/DebuggerScript.js:
        ():
        * bindings/v8/ScriptDebugServer.cpp:
        (WebCore::ScriptDebugServer::editScriptSource):
        * bindings/v8/ScriptDebugServer.h:
        * inspector/Inspector.json:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89126 => 89127)


--- trunk/Source/WebCore/ChangeLog	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/ChangeLog	2011-06-17 08:19:26 UTC (rev 89127)
@@ -1,3 +1,22 @@
+2011-06-16  Yury Semikhatsky  <[email protected]>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: return description of the changes applied in response to editScriptSource command
+        https://bugs.webkit.org/show_bug.cgi?id=62801
+
+        Return description of the changes made in response to Debugger.editScriptSource command.
+
+        * bindings/js/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::editScriptSource):
+        * bindings/js/ScriptDebugServer.h:
+        * bindings/v8/DebuggerScript.js:
+        ():
+        * bindings/v8/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::editScriptSource):
+        * bindings/v8/ScriptDebugServer.h:
+        * inspector/Inspector.json:
+
 2011-06-16  Gabor Loki  <[email protected]>
 
         [Qt] Unreviewed, build fix after r89118.

Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp (89126 => 89127)


--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2011-06-17 08:19:26 UTC (rev 89127)
@@ -190,7 +190,7 @@
     m_doneProcessingDebuggerEvents = true;
 }
 
-bool ScriptDebugServer::editScriptSource(const String&, const String&, String*, ScriptValue*)
+bool ScriptDebugServer::editScriptSource(const String&, const String&, String*, ScriptValue*, ScriptObject*)
 {
     // FIXME(40300): implement this.
     return false;

Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.h (89126 => 89127)


--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.h	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.h	2011-06-17 08:19:26 UTC (rev 89127)
@@ -52,6 +52,7 @@
 
 class _javascript_CallFrame;
 class ScriptDebugListener;
+class ScriptObject;
 class ScriptValue;
 
 class ScriptDebugServer : protected JSC::Debugger {
@@ -79,7 +80,7 @@
     void stepOverStatement();
     void stepOutOfFunction();
 
-    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames);
+    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result);
 
     void recompileAllJSFunctionsSoon();
     virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) = 0;

Modified: trunk/Source/WebCore/bindings/v8/DebuggerScript.js (89126 => 89127)


--- trunk/Source/WebCore/bindings/v8/DebuggerScript.js	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/bindings/v8/DebuggerScript.js	2011-06-17 08:19:26 UTC (rev 89127)
@@ -187,8 +187,7 @@
         throw("Script not found");
 
     var changeLog = [];
-    Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog);
-    return scriptToEdit.source;
+    return Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog);
 }
 
 DebuggerScript.clearBreakpoints = function(execState, args)

Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (89126 => 89127)


--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2011-06-17 08:19:26 UTC (rev 89127)
@@ -36,6 +36,7 @@
 #include "DebuggerScriptSource.h"
 #include "_javascript_CallFrame.h"
 #include "ScriptDebugListener.h"
+#include "ScriptObject.h"
 #include "V8Binding.h"
 #include "V8JavaScriptCallFrame.h"
 #include <wtf/StdLibExtras.h>
@@ -211,7 +212,7 @@
     continueProgram();
 }
 
-bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames)
+bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result)
 {
     ensureDebuggerScriptCompiled();
     v8::HandleScope scope;
@@ -225,7 +226,7 @@
 
     v8::TryCatch tryCatch;
     tryCatch.SetVerbose(false);
-    v8::Handle<v8::Value> result = function->Call(m_debuggerScript.get(), 2, argv);
+    v8::Handle<v8::Value> v8result = function->Call(m_debuggerScript.get(), 2, argv);
     if (tryCatch.HasCaught()) {
         v8::Local<v8::Message> message = tryCatch.Message();
         if (!message.IsEmpty())
@@ -234,7 +235,9 @@
             *error = "Unknown error.";
         return false;
     }
-    ASSERT(!result.IsEmpty());
+    ASSERT(!v8result.IsEmpty());
+    if (v8result->IsObject())
+        *result = ScriptObject(ScriptState::current(), v8result->ToObject());
 
     // Call stack may have changed after if the edited function was on the stack.
     if (isPaused())

Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h (89126 => 89127)


--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h	2011-06-17 08:19:26 UTC (rev 89127)
@@ -46,6 +46,7 @@
 namespace WebCore {
 
 class ScriptDebugListener;
+class ScriptObject;
 class ScriptValue;
 
 class ScriptDebugServer {
@@ -73,7 +74,7 @@
     void stepOverStatement();
     void stepOutOfFunction();
 
-    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames);
+    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result);
 
     void recompileAllJSFunctionsSoon() { }
     void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) { }

Modified: trunk/Source/WebCore/inspector/Inspector.json (89126 => 89127)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-06-17 08:19:26 UTC (rev 89127)
@@ -1494,7 +1494,8 @@
                     { "name": "scriptSource", "type": "string", "description": "New content of the script." }
                 ],
                 "returns": [
-                    { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame"}, "description": "New stack trace in case editing has happened while VM was stopped." }
+                    { "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." }
                 ],
                 "description": "Edits _javascript_ script live."
             },

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (89126 => 89127)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-06-17 08:19:26 UTC (rev 89127)
@@ -285,12 +285,27 @@
     return location;
 }
 
-void InspectorDebuggerAgent::editScriptSource(ErrorString* error, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames)
+static PassRefPtr<InspectorObject> scriptToInspectorObject(ScriptObject scriptObject)
 {
-    if (scriptDebugServer().editScriptSource(sourceId, newContent, error, &m_currentCallStack))
-        *newCallFrames = currentCallFrames();
+    if (scriptObject.hasNoValue())
+        return 0;
+    RefPtr<InspectorValue> value = scriptObject.toInspectorValue(scriptObject.scriptState());
+    if (!value)
+        return 0;
+    return value->asObject();
 }
 
+void InspectorDebuggerAgent::editScriptSource(ErrorString* error, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result)
+{
+    ScriptObject resultObject;
+    if (!scriptDebugServer().editScriptSource(sourceId, newContent, error, &m_currentCallStack, &resultObject))
+        return;
+    *newCallFrames = currentCallFrames();
+    RefPtr<InspectorObject> object = scriptToInspectorObject(resultObject);
+    if (object)
+        *result = object;
+}
+
 void InspectorDebuggerAgent::getScriptSource(ErrorString*, const String& sourceId, String* scriptSource)
 {
     *scriptSource = m_scripts.get(sourceId).source;

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (89126 => 89127)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-06-17 08:13:00 UTC (rev 89126)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-06-17 08:19:26 UTC (rev 89127)
@@ -85,7 +85,7 @@
     void removeBreakpoint(ErrorString*, const String& breakpointId);
     void continueToLocation(ErrorString*, PassRefPtr<InspectorObject> location);
 
-    void editScriptSource(ErrorString*, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames);
+    void editScriptSource(ErrorString*, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result);
     void getScriptSource(ErrorString*, const String& sourceId, String* scriptSource);
     void schedulePauseOnNextStatement(DebuggerEventType type, PassRefPtr<InspectorValue> data);
     void cancelPauseOnNextStatement();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to