Title: [89131] trunk/Source/WebCore
Revision
89131
Author
yu...@chromium.org
Date
2011-06-17 03:05:13 -0700 (Fri, 17 Jun 2011)

Log Message

2011-06-17  Yury Semikhatsky  <yu...@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: support preview mode for live edit changes
        https://bugs.webkit.org/show_bug.cgi?id=62851

        Debugger.editScriptSource command now supports preview flag.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89130 => 89131)


--- trunk/Source/WebCore/ChangeLog	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/ChangeLog	2011-06-17 10:05:13 UTC (rev 89131)
@@ -1,3 +1,23 @@
+2011-06-17  Yury Semikhatsky  <yu...@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: support preview mode for live edit changes
+        https://bugs.webkit.org/show_bug.cgi?id=62851
+
+        Debugger.editScriptSource command now supports preview flag.
+
+        * bindings/js/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::editScriptSource):
+        * bindings/js/ScriptDebugServer.h:
+        * bindings/v8/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::editScriptSource):
+        * bindings/v8/ScriptDebugServer.h:
+        * inspector/Inspector.json:
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::editScriptSource):
+        * inspector/InspectorDebuggerAgent.h:
+
 2011-06-09  Hans Wennborg  <h...@chromium.org>
 
         Reviewed by Tony Gentilcore.

Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp (89130 => 89131)


--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2011-06-17 10:05:13 UTC (rev 89131)
@@ -190,7 +190,7 @@
     m_doneProcessingDebuggerEvents = true;
 }
 
-bool ScriptDebugServer::editScriptSource(const String&, const String&, String*, ScriptValue*, ScriptObject*)
+bool ScriptDebugServer::editScriptSource(const String&, const String&, bool, String*, ScriptValue*, ScriptObject*)
 {
     // FIXME(40300): implement this.
     return false;

Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.h (89130 => 89131)


--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.h	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.h	2011-06-17 10:05:13 UTC (rev 89131)
@@ -80,7 +80,7 @@
     void stepOverStatement();
     void stepOutOfFunction();
 
-    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result);
+    bool editScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, ScriptValue* newCallFrames, ScriptObject* result);
 
     void recompileAllJSFunctionsSoon();
     virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) = 0;

Modified: trunk/Source/WebCore/bindings/v8/DebuggerScript.js (89130 => 89131)


--- trunk/Source/WebCore/bindings/v8/DebuggerScript.js	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/bindings/v8/DebuggerScript.js	2011-06-17 10:05:13 UTC (rev 89131)
@@ -173,7 +173,7 @@
     execState.prepareStep(Debug.StepAction.StepOut, 1);
 }
 
-DebuggerScript.editScriptSource = function(scriptId, newSource)
+DebuggerScript.editScriptSource = function(scriptId, newSource, preview)
 {
     var scripts = Debug.scripts();
     var scriptToEdit = null;
@@ -187,7 +187,7 @@
         throw("Script not found");
 
     var changeLog = [];
-    return Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog);
+    return Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, preview, changeLog);
 }
 
 DebuggerScript.clearBreakpoints = function(execState, args)

Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (89130 => 89131)


--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2011-06-17 10:05:13 UTC (rev 89131)
@@ -212,7 +212,7 @@
     continueProgram();
 }
 
-bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result)
+bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, ScriptValue* newCallFrames, ScriptObject* result)
 {
     ensureDebuggerScriptCompiled();
     v8::HandleScope scope;
@@ -222,11 +222,11 @@
         contextScope = adoptPtr(new v8::Context::Scope(v8::Debug::GetDebugContext()));
 
     v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("editScriptSource")));
-    v8::Handle<v8::Value> argv[] = { v8String(sourceID), v8String(newContent) };
+    v8::Handle<v8::Value> argv[] = { v8String(sourceID), v8String(newContent), v8Boolean(preview) };
 
     v8::TryCatch tryCatch;
     tryCatch.SetVerbose(false);
-    v8::Handle<v8::Value> v8result = function->Call(m_debuggerScript.get(), 2, argv);
+    v8::Handle<v8::Value> v8result = function->Call(m_debuggerScript.get(), 3, argv);
     if (tryCatch.HasCaught()) {
         v8::Local<v8::Message> message = tryCatch.Message();
         if (!message.IsEmpty())
@@ -240,7 +240,7 @@
         *result = ScriptObject(ScriptState::current(), v8result->ToObject());
 
     // Call stack may have changed after if the edited function was on the stack.
-    if (isPaused())
+    if (!preview && isPaused())
         *newCallFrames = currentCallFrame();
     return true;
 }

Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h (89130 => 89131)


--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h	2011-06-17 10:05:13 UTC (rev 89131)
@@ -74,7 +74,7 @@
     void stepOverStatement();
     void stepOutOfFunction();
 
-    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result);
+    bool editScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, ScriptValue* newCallFrames, ScriptObject* result);
 
     void recompileAllJSFunctionsSoon() { }
     void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) { }

Modified: trunk/Source/WebCore/inspector/Inspector.json (89130 => 89131)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-06-17 10:05:13 UTC (rev 89131)
@@ -1491,7 +1491,8 @@
                 "name": "editScriptSource",
                 "parameters": [
                     { "name": "sourceId", "type": "string", "description": "Id of the script to edit." },
-                    { "name": "scriptSource", "type": "string", "description": "New content of the script." }
+                    { "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." }
                 ],
                 "returns": [
                     { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame"}, "description": "New stack trace in case editing has happened while VM was stopped." },

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (89130 => 89131)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-06-17 10:05:13 UTC (rev 89131)
@@ -295,10 +295,11 @@
     return value->asObject();
 }
 
-void InspectorDebuggerAgent::editScriptSource(ErrorString* error, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result)
+void InspectorDebuggerAgent::editScriptSource(ErrorString* error, const String& sourceId, const String& newContent, const bool* const preview, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result)
 {
+    bool previewOnly = preview && *preview;
     ScriptObject resultObject;
-    if (!scriptDebugServer().editScriptSource(sourceId, newContent, error, &m_currentCallStack, &resultObject))
+    if (!scriptDebugServer().editScriptSource(sourceId, newContent, previewOnly, error, &m_currentCallStack, &resultObject))
         return;
     *newCallFrames = currentCallFrames();
     RefPtr<InspectorObject> object = scriptToInspectorObject(resultObject);

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (89130 => 89131)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-06-17 09:43:59 UTC (rev 89130)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-06-17 10:05:13 UTC (rev 89131)
@@ -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, RefPtr<InspectorObject>* result);
+    void editScriptSource(ErrorString*, const String& sourceId, const String& newContent, const bool* const preview, 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
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to