Changeset 60886 in webkit


Ignore:
Timestamp:
Jun 9, 2010 1:57:35 AM (14 years ago)
Author:
yurys@chromium.org
Message:

2010-06-09 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: update stack trace after script source editing
https://bugs.webkit.org/show_bug.cgi?id=40357

  • src/js/DebuggerAgent.js: (devtools.DebuggerAgent.prototype.editScriptSource.this.requestSeqToCallback_.cmd.getSequenceNumber): (devtools.DebuggerAgent.prototype.editScriptSource.requestBacktrace): (devtools.DebuggerAgent.prototype.editScriptSource.handleBacktraceResponse): (devtools.DebuggerAgent.prototype.editScriptSource.reportDidCommitEditing): (devtools.DebuggerAgent.prototype.editScriptSource): (devtools.DebuggerAgent.prototype.requestBacktrace_): (devtools.DebuggerAgent.prototype.handleDebuggerOutput_): (devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_): (devtools.DebuggerAgent.prototype.updateCallFramesFromBacktraceResponse_):
  • src/js/InspectorControllerImpl.js: (.devtools.InspectorBackendImpl.prototype.editScriptSource):
Location:
trunk/WebKit/chromium
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r60884 r60886  
     12010-06-09  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: update stack trace after script source editing
     6        https://bugs.webkit.org/show_bug.cgi?id=40357
     7
     8        * src/js/DebuggerAgent.js:
     9        (devtools.DebuggerAgent.prototype.editScriptSource.this.requestSeqToCallback_.cmd.getSequenceNumber):
     10        (devtools.DebuggerAgent.prototype.editScriptSource.requestBacktrace):
     11        (devtools.DebuggerAgent.prototype.editScriptSource.handleBacktraceResponse):
     12        (devtools.DebuggerAgent.prototype.editScriptSource.reportDidCommitEditing):
     13        (devtools.DebuggerAgent.prototype.editScriptSource):
     14        (devtools.DebuggerAgent.prototype.requestBacktrace_):
     15        (devtools.DebuggerAgent.prototype.handleDebuggerOutput_):
     16        (devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_):
     17        (devtools.DebuggerAgent.prototype.updateCallFramesFromBacktraceResponse_):
     18        * src/js/InspectorControllerImpl.js:
     19        (.devtools.InspectorBackendImpl.prototype.editScriptSource):
     20
    1212010-06-08  Tony Chang  <tony@chromium.org>
    222
  • trunk/WebKit/chromium/src/js/DebuggerAgent.js

    r60771 r60886  
    308308
    309309/**
    310  * Changes given line of the script. 
     310 * Changes given line of the script.
    311311 */
    312312devtools.DebuggerAgent.prototype.editScriptSource = function(sourceId, newContent, callback)
     
    320320    devtools.DebuggerAgent.sendCommand_(cmd);
    321321    this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
    322         if (!msg.isSuccess())
    323             WebInspector.log("Unable to modify source code within given scope. Only function bodies are editable at the moment.", WebInspector.ConsoleMessage.MessageLevel.Warning);
    324         this.resolveScriptSource(sourceId, callback);
     322        if (!msg.isSuccess()) {
     323            callback(false, "Unable to modify source code within given scope. Only function bodies are editable at the moment.", null);
     324            return;
     325        }
     326
     327        this.resolveScriptSource(sourceId, requestBacktrace.bind(this));
     328    }.bind(this);
     329
     330
     331    function requestBacktrace(newScriptSource) {
    325332        if (WebInspector.panels.scripts.paused)
    326             this.requestBacktrace_();
    327     }.bind(this);
     333            this.requestBacktrace_(handleBacktraceResponse.bind(this, newScriptSource));
     334        else
     335            reportDidCommitEditing(newScriptSource);
     336    }
     337
     338    function handleBacktraceResponse(newScriptSource, msg) {
     339        this.updateCallFramesFromBacktraceResponse_(msg);
     340        reportDidCommitEditing(newScriptSource, this.callFrames_);
     341    }
     342
     343    function reportDidCommitEditing(newScriptSource, callFrames) {
     344        callback(true, newScriptSource, callFrames);
     345    }
     346
    328347    RemoteDebuggerAgent.processDebugCommands();
    329348};
     
    680699 * Sends "backtrace" request to v8.
    681700 */
    682 devtools.DebuggerAgent.prototype.requestBacktrace_ = function()
     701devtools.DebuggerAgent.prototype.requestBacktrace_ = function(opt_customHandler)
    683702{
    684703    var cmd = new devtools.DebugCommand("backtrace", {
     
    686705    });
    687706    devtools.DebuggerAgent.sendCommand_(cmd);
     707    var responseHandler = opt_customHandler ? opt_customHandler : this.handleBacktraceResponse_.bind(this);
     708    this.requestSeqToCallback_[cmd.getSequenceNumber()] = responseHandler;
    688709};
    689710
     
    801822            this.handleClearBreakpointResponse_(msg);
    802823        else if (msg.getCommand() === "backtrace")
    803             this.handleBacktraceResponse_(msg);
     824            this.invokeCallbackForResponse_(msg);
    804825        else if (msg.getCommand() === "lookup")
    805826            this.invokeCallbackForResponse_(msg);
     
    9921013devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_ = function(msg)
    9931014{
     1015    this.updateCallFramesFromBacktraceResponse_(msg);
     1016    WebInspector.pausedScript(this.callFrames_);
     1017    this.showPendingExceptionMessage_();
     1018    InspectorFrontendHost.bringToFront();
     1019};
     1020
     1021
     1022devtools.DebuggerAgent.prototype.updateCallFramesFromBacktraceResponse_ = function(msg)
     1023{
    9941024    var frames = msg.getBody().frames;
    9951025    this.callFrames_ = [];
    9961026    for (var i = 0; i <  frames.length; ++i)
    9971027        this.callFrames_.push(this.formatCallFrame_(frames[i]));
    998     WebInspector.pausedScript(this.callFrames_);
    999     this.showPendingExceptionMessage_();
    1000     InspectorFrontendHost.bringToFront();
     1028    return this.callFrames_;
    10011029};
    10021030
  • trunk/WebKit/chromium/src/js/InspectorControllerImpl.js

    r60843 r60886  
    145145devtools.InspectorBackendImpl.prototype.editScriptSource = function(callID, sourceID, newContent)
    146146{
    147     devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(newFullBody) {
    148         WebInspector.didEditScriptSource(callID, newFullBody);
     147    devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(success, newBodyOrErrorMessage, callFrames) {
     148        WebInspector.didEditScriptSource(callID, success, newBodyOrErrorMessage, callFrames);
    149149    });
    150150};
Note: See TracChangeset for help on using the changeset viewer.