Changeset 89127 in webkit


Ignore:
Timestamp:
Jun 17, 2011 1:19:26 AM (13 years ago)
Author:
yurys@chromium.org
Message:

2011-06-16 Yury Semikhatsky <yurys@chromium.org>

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:
Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89122 r89127  
     12011-06-16  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: return description of the changes applied in response to editScriptSource command
     6        https://bugs.webkit.org/show_bug.cgi?id=62801
     7
     8        Return description of the changes made in response to Debugger.editScriptSource command.
     9
     10        * bindings/js/ScriptDebugServer.cpp:
     11        (WebCore::ScriptDebugServer::editScriptSource):
     12        * bindings/js/ScriptDebugServer.h:
     13        * bindings/v8/DebuggerScript.js:
     14        ():
     15        * bindings/v8/ScriptDebugServer.cpp:
     16        (WebCore::ScriptDebugServer::editScriptSource):
     17        * bindings/v8/ScriptDebugServer.h:
     18        * inspector/Inspector.json:
     19
    1202011-06-16  Gabor Loki  <loki@webkit.org>
    221
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp

    r86756 r89127  
    191191}
    192192
    193 bool ScriptDebugServer::editScriptSource(const String&, const String&, String*, ScriptValue*)
     193bool ScriptDebugServer::editScriptSource(const String&, const String&, String*, ScriptValue*, ScriptObject*)
    194194{
    195195    // FIXME(40300): implement this.
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.h

    r85035 r89127  
    5353class JavaScriptCallFrame;
    5454class ScriptDebugListener;
     55class ScriptObject;
    5556class ScriptValue;
    5657
     
    8081    void stepOutOfFunction();
    8182
    82     bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames);
     83    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result);
    8384
    8485    void recompileAllJSFunctionsSoon();
  • trunk/Source/WebCore/bindings/v8/DebuggerScript.js

    r85320 r89127  
    188188
    189189    var changeLog = [];
    190     Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog);
    191     return scriptToEdit.source;
     190    return Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog);
    192191}
    193192
  • trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp

    r87280 r89127  
    3737#include "JavaScriptCallFrame.h"
    3838#include "ScriptDebugListener.h"
     39#include "ScriptObject.h"
    3940#include "V8Binding.h"
    4041#include "V8JavaScriptCallFrame.h"
     
    212213}
    213214
    214 bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames)
     215bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result)
    215216{
    216217    ensureDebuggerScriptCompiled();
     
    226227    v8::TryCatch tryCatch;
    227228    tryCatch.SetVerbose(false);
    228     v8::Handle<v8::Value> result = function->Call(m_debuggerScript.get(), 2, argv);
     229    v8::Handle<v8::Value> v8result = function->Call(m_debuggerScript.get(), 2, argv);
    229230    if (tryCatch.HasCaught()) {
    230231        v8::Local<v8::Message> message = tryCatch.Message();
     
    235236        return false;
    236237    }
    237     ASSERT(!result.IsEmpty());
     238    ASSERT(!v8result.IsEmpty());
     239    if (v8result->IsObject())
     240        *result = ScriptObject(ScriptState::current(), v8result->ToObject());
    238241
    239242    // Call stack may have changed after if the edited function was on the stack.
  • trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h

    r85035 r89127  
    4747
    4848class ScriptDebugListener;
     49class ScriptObject;
    4950class ScriptValue;
    5051
     
    7475    void stepOutOfFunction();
    7576
    76     bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames);
     77    bool editScriptSource(const String& sourceID, const String& newContent, String* error, ScriptValue* newCallFrames, ScriptObject* result);
    7778
    7879    void recompileAllJSFunctionsSoon() { }
  • trunk/Source/WebCore/inspector/Inspector.json

    r89036 r89127  
    14951495                ],
    14961496                "returns": [
    1497                     { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame"}, "description": "New stack trace in case editing has happened while VM was stopped." }
     1497                    { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame"}, "description": "New stack trace in case editing has happened while VM was stopped." },
     1498                    { "name": "result", "type": "object", "optional": true, "description": "VM-specific description of the changes applied." }
    14981499                ],
    14991500                "description": "Edits JavaScript script live."
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp

    r86756 r89127  
    286286}
    287287
    288 void InspectorDebuggerAgent::editScriptSource(ErrorString* error, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames)
    289 {
    290     if (scriptDebugServer().editScriptSource(sourceId, newContent, error, &m_currentCallStack))
    291         *newCallFrames = currentCallFrames();
     288static PassRefPtr<InspectorObject> scriptToInspectorObject(ScriptObject scriptObject)
     289{
     290    if (scriptObject.hasNoValue())
     291        return 0;
     292    RefPtr<InspectorValue> value = scriptObject.toInspectorValue(scriptObject.scriptState());
     293    if (!value)
     294        return 0;
     295    return value->asObject();
     296}
     297
     298void InspectorDebuggerAgent::editScriptSource(ErrorString* error, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result)
     299{
     300    ScriptObject resultObject;
     301    if (!scriptDebugServer().editScriptSource(sourceId, newContent, error, &m_currentCallStack, &resultObject))
     302        return;
     303    *newCallFrames = currentCallFrames();
     304    RefPtr<InspectorObject> object = scriptToInspectorObject(resultObject);
     305    if (object)
     306        *result = object;
    292307}
    293308
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h

    r86756 r89127  
    8686    void continueToLocation(ErrorString*, PassRefPtr<InspectorObject> location);
    8787
    88     void editScriptSource(ErrorString*, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames);
     88    void editScriptSource(ErrorString*, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result);
    8989    void getScriptSource(ErrorString*, const String& sourceId, String* scriptSource);
    9090    void schedulePauseOnNextStatement(DebuggerEventType type, PassRefPtr<InspectorValue> data);
Note: See TracChangeset for help on using the changeset viewer.