Changeset 83290 in webkit


Ignore:
Timestamp:
Apr 8, 2011 5:36:57 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2011-04-08 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: use "locations" for debugger scripts, "lineNumbers" for the UI elements.
https://bugs.webkit.org/show_bug.cgi?id=58118

This change reuses location for call frames in the protocol + structures script
location <-> source lines interaction better. When we need UI columns, we will add
them, but we should distinguish between script and UI terms on the type level, not naming.

  • English.lproj/localizedStrings.js:
  • bindings/v8/DebuggerScript.js:
  • inspector/InjectedScriptSource.js:
  • inspector/Inspector.json:
  • inspector/front-end/CallStackSidebarPane.js: (WebInspector.CallStackSidebarPane.prototype.update.didGetSourceLine): (WebInspector.CallStackSidebarPane.prototype.update):
  • inspector/front-end/DebuggerPresentationModel.js: (WebInspector.DebuggerPresentationModel.prototype.addConsoleMessage.didRequestSourceMapping): (WebInspector.DebuggerPresentationModel.prototype.addConsoleMessage): (WebInspector.DebuggerPresentationModel.prototype.continueToLine): (WebInspector.DebuggerPresentationModel.prototype._setBreakpointInDebugger.didRequestSourceMapping): (WebInspector.DebuggerPresentationModel.prototype._setBreakpointInDebugger): (WebInspector.DebuggerPresentationModel.prototype._breakpointAdded.didRequestSourceMapping): (WebInspector.DebuggerPresentationModel.prototype._breakpointAdded): (WebInspector.PresenationCallFrame): (WebInspector.PresenationCallFrame.prototype.sourceLine.didRequestSourceMapping): (WebInspector.PresenationCallFrame.prototype.sourceLine):
  • inspector/front-end/ScriptFormatter.js: (WebInspector.ScriptFormatter.locationToPosition): (WebInspector.ScriptFormatter.lineToPosition):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype._debuggerPaused.else.didGetSourceLocation): (WebInspector.ScriptsPanel.prototype._debuggerPaused): (WebInspector.ScriptsPanel.prototype.showAnchorLocation): (WebInspector.ScriptsPanel.prototype._callFrameSelected.didGetSourceLocation): (WebInspector.ScriptsPanel.prototype._callFrameSelected):
  • inspector/front-end/SourceFile.js: (WebInspector.SourceMapping.prototype.scriptLocationToSourceLine): (WebInspector.SourceMapping.prototype.sourceLineToScriptLocation): (WebInspector.FormattedSourceMapping.prototype.scriptLocationToSourceLine): (WebInspector.FormattedSourceMapping.prototype.sourceLineToScriptLocation):
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/http/tests/inspector/debugger-test.js

    r82590 r83290  
    107107    for (var i = 0; i < callFrames.length; i++) {
    108108        var frame = callFrames[i];
    109         var script = WebInspector.debuggerModel.scriptForSourceID(frame.sourceID);
     109        var script = WebInspector.debuggerModel.scriptForSourceID(frame.location.sourceID);
    110110        var url;
    111111        if (script)
     
    113113        else
    114114            url = "(internal script)"
    115         var s = "    " + i + ") " + frame.functionName + " (" + url + ":" + (frame.line + 1) + ")";
     115        var s = "    " + i + ") " + frame.functionName + " (" + url + ":" + (frame.location.lineNumber + 1) + ")";
    116116        InspectorTest.addResult(s);
    117117    }
  • trunk/Source/WebCore/ChangeLog

    r83289 r83290  
     12011-04-08  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: use "locations" for debugger scripts, "lineNumbers" for the UI elements.
     6        https://bugs.webkit.org/show_bug.cgi?id=58118
     7
     8        This change reuses location for call frames in the protocol + structures script
     9        location <-> source lines interaction better. When we need UI columns, we will add
     10        them, but we should distinguish between script and UI terms on the type level, not naming.
     11
     12        * English.lproj/localizedStrings.js:
     13        * bindings/v8/DebuggerScript.js:
     14        * inspector/InjectedScriptSource.js:
     15        * inspector/Inspector.json:
     16        * inspector/front-end/CallStackSidebarPane.js:
     17        (WebInspector.CallStackSidebarPane.prototype.update.didGetSourceLine):
     18        (WebInspector.CallStackSidebarPane.prototype.update):
     19        * inspector/front-end/DebuggerPresentationModel.js:
     20        (WebInspector.DebuggerPresentationModel.prototype.addConsoleMessage.didRequestSourceMapping):
     21        (WebInspector.DebuggerPresentationModel.prototype.addConsoleMessage):
     22        (WebInspector.DebuggerPresentationModel.prototype.continueToLine):
     23        (WebInspector.DebuggerPresentationModel.prototype._setBreakpointInDebugger.didRequestSourceMapping):
     24        (WebInspector.DebuggerPresentationModel.prototype._setBreakpointInDebugger):
     25        (WebInspector.DebuggerPresentationModel.prototype._breakpointAdded.didRequestSourceMapping):
     26        (WebInspector.DebuggerPresentationModel.prototype._breakpointAdded):
     27        (WebInspector.PresenationCallFrame):
     28        (WebInspector.PresenationCallFrame.prototype.sourceLine.didRequestSourceMapping):
     29        (WebInspector.PresenationCallFrame.prototype.sourceLine):
     30        * inspector/front-end/ScriptFormatter.js:
     31        (WebInspector.ScriptFormatter.locationToPosition):
     32        (WebInspector.ScriptFormatter.lineToPosition):
     33        * inspector/front-end/ScriptsPanel.js:
     34        (WebInspector.ScriptsPanel.prototype._debuggerPaused.else.didGetSourceLocation):
     35        (WebInspector.ScriptsPanel.prototype._debuggerPaused):
     36        (WebInspector.ScriptsPanel.prototype.showAnchorLocation):
     37        (WebInspector.ScriptsPanel.prototype._callFrameSelected.didGetSourceLocation):
     38        (WebInspector.ScriptsPanel.prototype._callFrameSelected):
     39        * inspector/front-end/SourceFile.js:
     40        (WebInspector.SourceMapping.prototype.scriptLocationToSourceLine):
     41        (WebInspector.SourceMapping.prototype.sourceLineToScriptLocation):
     42        (WebInspector.FormattedSourceMapping.prototype.scriptLocationToSourceLine):
     43        (WebInspector.FormattedSourceMapping.prototype.sourceLineToScriptLocation):
     44
    1452011-04-08  Pavel Podivilov  <podivilov@chromium.org>
    246
  • trunk/Source/WebCore/bindings/v8/DebuggerScript.js

    r83190 r83290  
    9292DebuggerScript.setBreakpoint = function(execState, args)
    9393{
    94     var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, args.columnNumber, args.condition);
     94    var breakId = Debug.setScriptBreakPointById(args.sourceID, args.lineNumber, args.columnNumber, args.condition);
    9595
    9696    var locations = Debug.findBreakPointActualLocations(breakId);
     
    251251        "column": location.column,
    252252        "functionName": functionName,
    253         "type": "function",
    254253        "thisObject": thisObject,
    255254        "scopeChain": scopeChain,
  • trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp

    r83190 r83290  
    6868
    6969    v8::Local<v8::Object> args = v8::Object::New();
    70     args->Set(v8::String::New("scriptId"), v8String(sourceID));
     70    args->Set(v8::String::New("sourceID"), v8String(sourceID));
    7171    args->Set(v8::String::New("lineNumber"), v8::Integer::New(scriptBreakpoint.lineNumber));
    7272    args->Set(v8::String::New("columnNumber"), v8::Integer::New(scriptBreakpoint.columnNumber));
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r82609 r83290  
    475475{
    476476    this.id = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
    477     this.type = callFrame.type;
    478     this.functionName = (this.type === "function" ? callFrame.functionName : "");
    479     this.sourceID = callFrame.sourceID;
    480     this.line = callFrame.line;
    481     this.column = callFrame.column;
     477    this.functionName = (callFrame.type === "function" ? callFrame.functionName : "");
     478    this.location = { sourceID: callFrame.sourceID, lineNumber: callFrame.line, columnNumber: callFrame.column };
    482479    this.scopeChain = this._wrapScopeChain(callFrame);
    483480}
  • trunk/Source/WebCore/inspector/Inspector.json

    r83190 r83290  
    12331233                    "sourceID": { "type": "string",  "description": "Script identifier as reported by the <code>scriptParsed</code>" },
    12341234                    "lineNumber": { "type": "integer", "description": "Line number in the script." },
    1235                     "columnNumber": { "type": "integer", "description": "Column number in the script." }
     1235                    "columnNumber": { "type": "integer", "optional": true, "description": "Column number in the script." }
    12361236                },
    12371237                "description": "Location in the source code."
     
    12421242                "properties": {
    12431243                    "id": { "type": "string",  "description": "Call frame identifier" },
    1244                     "type": { "type": "string", "description": "Call frame type. // FIXME" },
    12451244                    "functionName": { "type": "string", "description": "Name of the function called on this frame." },
    1246                     "sourceID": { "type": "string", "description": "Script identifier." },
    1247                     "line": { "type": "integer", "description": "Line number in the script." },
    1248                     "column": { "type": "integer", "description": "Column number in the script." },
     1245                    "location": { "$ref": "Location", "description": "Location in the source code." },
    12491246                    "scopeChain": { "type": "array", "items": { "type": "object" }, "description": "Scope chain for given call frame. // FIXME" }
    12501247                },
     
    12851282                "name": "setBreakpoint",
    12861283                "parameters": [
    1287                     { "name": "sourceId", "type": "string", "description": "Source ID of the resource to set breakpoint on (as reported by <code>scriptParsed</code>)." },
    1288                     { "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." },
    1289                     { "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." },
     1284                    { "name": "location", "$ref": "Location", "description": "Location to set breakpoint in." },
    12901285                    { "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." }
    12911286                ],
    12921287                "returns": [
    12931288                    { "name": "breakpointId", "type": "string", "description": "Id of the created breakpoint for further manipulations." },
    1294                     { "name": "location", "$ref" : "Location", "description": "Location this breakpoint resolved into." }
     1289                    { "name": "actualLocation", "$ref" : "Location", "description": "Location this breakpoint resolved into." }
    12951290                ],
    12961291                "description": "Sets JavaScript breakpoint at a given location."
     
    13061301                "name": "continueToLocation",
    13071302                "parameters": [
    1308                     { "name": "sourceId", "type": "string", "description": "Source ID of the resource to continue to (as reported by <code>scriptParsed</code>)." },
    1309                     { "name": "lineNumber", "type": "integer", "description": "Line number to stop at." },
    1310                     { "name": "columnNumber", "type": "integer", "description": "Column number to stop at." }
     1303                    { "name": "location", "$ref": "Location", "description": "Location to continue to." }
    13111304                ],
    13121305                "description": "Continues execution until specific location is reached."
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp

    r83190 r83290  
    175175}
    176176
    177 void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const String& sourceId, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorObject>* location)
    178 {
    179     int columnNumber = optionalColumnNumber ? *optionalColumnNumber : 0;
     177static bool parseLocation(ErrorString* errorString, RefPtr<InspectorObject> location, String* sourceId, int* lineNumber, int* columnNumber)
     178{
     179    if (!location->getString("sourceID", sourceId) || !location->getNumber("lineNumber", lineNumber)) {
     180        // FIXME: replace with input validation.
     181        *errorString = "sourceId and lineNumber are required.";
     182        return false;
     183    }
     184    *columnNumber = 0;
     185    location->getNumber("columnNumber", columnNumber);
     186    return true;
     187}
     188
     189void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, PassRefPtr<InspectorObject> location, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorObject>* actualLocation)
     190{
     191    String sourceId;
     192    int lineNumber;
     193    int columnNumber;
     194
     195    if (!parseLocation(errorString, location, &sourceId, &lineNumber, &columnNumber))
     196        return;
     197
    180198    String condition = optionalCondition ? *optionalCondition : "";
    181199
     
    184202        return;
    185203    ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
    186     *location = resolveBreakpoint(breakpointId, sourceId, breakpoint);
    187     if (*location)
     204    *actualLocation = resolveBreakpoint(breakpointId, sourceId, breakpoint);
     205    if (*actualLocation)
    188206        *outBreakpointId = breakpointId;
    189207    else
     
    205223}
    206224
    207 void InspectorDebuggerAgent::continueToLocation(ErrorString* error, const String& sourceId, int lineNumber, int columnNumber)
     225void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, PassRefPtr<InspectorObject> location)
    208226{
    209227    if (!m_continueToLocationBreakpointId.isEmpty()) {
     
    211229        m_continueToLocationBreakpointId = "";
    212230    }
     231
     232    String sourceId;
     233    int lineNumber;
     234    int columnNumber;
     235
     236    if (!parseLocation(errorString, location, &sourceId, &lineNumber, &columnNumber))
     237        return;
     238
    213239    ScriptBreakpoint breakpoint(lineNumber, columnNumber, "");
    214240    m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(sourceId, breakpoint, &lineNumber, &columnNumber);
    215     resume(error);
     241    resume(errorString);
    216242}
    217243
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h

    r83190 r83290  
    8282
    8383    void setBreakpointByUrl(ErrorString*, const String& url, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorArray>* locations);
    84     void setBreakpoint(ErrorString*, const String& sourceId, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorObject>* location);
     84    void setBreakpoint(ErrorString*, PassRefPtr<InspectorObject> location, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorObject>* actualLocation);
    8585    void removeBreakpoint(ErrorString*, const String& breakpointId);
    86     void continueToLocation(ErrorString*, const String& sourceId, int lineNumber, int columnNumber);
     86    void continueToLocation(ErrorString*, PassRefPtr<InspectorObject> location);
    8787
    8888    void editScriptSource(ErrorString*, const String& sourceID, const String& newContent, RefPtr<InspectorArray>* newCallFrames);
  • trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js

    r82234 r83290  
    4747        }
    4848
    49         var title;
    50         var subtitle;
    51         var script;
    52 
    5349        for (var i = 0; i < callFrames.length; ++i) {
    5450            var callFrame = callFrames[i];
    55             switch (callFrame.type) {
    56             case "function":
    57                 title = callFrame.functionName || WebInspector.UIString("(anonymous function)");
    58                 break;
    59             case "program":
    60                 title = WebInspector.UIString("(program)");
    61                 break;
    62             }
     51            var title = callFrame.functionName || WebInspector.UIString("(anonymous function)");
    6352
    6453            var subtitle;
     
    7261            placard.element.addEventListener("click", this._placardSelected.bind(this, placard), false);
    7362
    74             function didGetSourceLocation(placard, sourceFileId, lineNumber, columnNumber)
     63            function didGetSourceLine(placard, sourceFileId, lineNumber)
    7564            {
    7665                if (placard.subtitle)
     
    8069                placard._text = WebInspector.UIString("%s() at %s", placard.title, placard.subtitle);
    8170            }
    82             callFrame.sourceLocation(didGetSourceLocation.bind(this, placard));
     71            callFrame.sourceLine(didGetSourceLine.bind(this, placard));
    8372
    8473            this.placards.push(placard);
  • trunk/Source/WebCore/inspector/front-end/DebuggerModel.js

    r83190 r83290  
    6969    },
    7070
    71     continueToLocation: function(sourceID, lineNumber, columnNumber)
    72     {
    73         DebuggerAgent.continueToLocation(sourceID, lineNumber, columnNumber);
     71    continueToLocation: function(location)
     72    {
     73        DebuggerAgent.continueToLocation(location);
    7474    },
    7575
     
    9393    },
    9494
    95     setBreakpointBySourceId: function(sourceID, lineNumber, columnNumber, condition, callback)
    96     {
    97         function didSetBreakpoint(error, breakpointId, location)
     95    setBreakpointBySourceId: function(location, condition, callback)
     96    {
     97        function didSetBreakpoint(error, breakpointId, actualLocation)
    9898        {
    9999            if (callback)
    100                 callback(error ? null : breakpointId, [location]);
    101         }
    102         DebuggerAgent.setBreakpoint(sourceID, lineNumber, columnNumber, condition, didSetBreakpoint.bind(this));
     100                callback(error ? null : breakpointId, [actualLocation]);
     101        }
     102        DebuggerAgent.setBreakpoint(location, condition, didSetBreakpoint.bind(this));
    103103    },
    104104
  • trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js

    r83289 r83290  
    236236            var presentationMessage = {};
    237237            presentationMessage.sourceFileId = sourceFile.id;
    238             presentationMessage.lineNumber = mapping.scriptLocationToSourceLocation(message.line - 1, 0).lineNumber;
     238            presentationMessage.lineNumber = mapping.scriptLocationToSourceLine({lineNumber:message.line - 1, columnNumber:0});
    239239            presentationMessage.originalMessage = message;
    240240            sourceFile.messages.push(presentationMessage);
     
    255255        function didRequestSourceMapping(mapping)
    256256        {
    257             var location = mapping.sourceLocationToScriptLocation(lineNumber, 0);
    258             WebInspector.debuggerModel.continueToLocation(location.scriptId, location.lineNumber, location.columnNumber);
     257            var location = mapping.sourceLineToScriptLocation(lineNumber);
     258            WebInspector.debuggerModel.continueToLocation(location);
    259259        }
    260260        this._sourceFiles[sourceFileId].requestSourceMapping(didRequestSourceMapping.bind(this));
     
    309309        function didRequestSourceMapping(mapping)
    310310        {
    311             var location = mapping.sourceLocationToScriptLocation(breakpoint.lineNumber, 0);
    312             var script = WebInspector.debuggerModel.scriptForSourceID(location.scriptId);
     311            var location = mapping.sourceLineToScriptLocation(breakpoint.lineNumber);
     312            var script = WebInspector.debuggerModel.scriptForSourceID(location.sourceID);
    313313            if (script.sourceURL)
    314314                WebInspector.debuggerModel.setBreakpoint(script.sourceURL, location.lineNumber, location.columnNumber, breakpoint.condition, didSetBreakpoint.bind(this));
    315             else
    316                 WebInspector.debuggerModel.setBreakpointBySourceId(script.sourceID, location.lineNumber, location.columnNumber, breakpoint.condition, didSetBreakpoint.bind(this));
     315            else {
     316                location.sourceID = script.sourceID;
     317                WebInspector.debuggerModel.setBreakpointBySourceId(location, breakpoint.condition, didSetBreakpoint.bind(this));
     318            }
    317319        }
    318320        breakpoint.sourceFile.requestSourceMapping(didRequestSourceMapping.bind(this));
     
    406408        {
    407409            // Refine line number based on resolved location.
    408             if (breakpoint.location) {
    409                 var sourceLocation = mapping.scriptLocationToSourceLocation(breakpoint.location.lineNumber, breakpoint.location.columnNumber);
    410                 breakpoint.lineNumber = sourceLocation.lineNumber;
    411             }
     410            if (breakpoint.location)
     411                breakpoint.lineNumber = mapping.scriptLocationToSourceLine(breakpoint.location);
    412412
    413413            var existingBreakpoint = this.findBreakpoint(sourceFile.id, breakpoint.lineNumber);
     
    501501            var callFrame = callFrames[i];
    502502            var sourceFile;
    503             var script = WebInspector.debuggerModel.scriptForSourceID(callFrame.sourceID);
     503            var script = WebInspector.debuggerModel.scriptForSourceID(callFrame.location.sourceID);
    504504            if (script)
    505505                sourceFile = this._sourceFileForScript(script.sourceURL, script.sourceID);
     
    634634    this._index = index;
    635635    this._sourceFile = sourceFile;
    636     this._script = WebInspector.debuggerModel.scriptForSourceID(callFrame.sourceID);
     636    this._script = WebInspector.debuggerModel.scriptForSourceID(callFrame.location.sourceID);
    637637}
    638638
     
    684684    },
    685685
    686     sourceLocation: function(callback)
     686    sourceLine: function(callback)
    687687    {
    688688        if (!this._sourceFile) {
    689             callback(undefined, this._callFrame.line, this._callFrame.column);
     689            callback(undefined, this._callFrame.location.lineNumber);
    690690            return;
    691691        }
     
    693693        function didRequestSourceMapping(mapping)
    694694        {
    695             var sourceLocation = mapping.scriptLocationToSourceLocation(this._callFrame.line, this._callFrame.column);
    696             callback(this._sourceFile.id, sourceLocation.lineNumber, sourceLocation.columnNumber);
     695            callback(this._sourceFile.id, mapping.scriptLocationToSourceLine(this._callFrame.location));
    697696        }
    698697        this._sourceFile.requestSourceMapping(didRequestSourceMapping.bind(this));
  • trunk/Source/WebCore/inspector/front-end/ScriptFormatter.js

    r82103 r83290  
    3737}
    3838
    39 WebInspector.ScriptFormatter.locationToPosition = function(lineEndings, lineNumber, columnNumber)
     39WebInspector.ScriptFormatter.locationToPosition = function(lineEndings, location)
    4040{
    41     var position = lineNumber ? lineEndings[lineNumber - 1] + 1 : 0;
    42     return position + columnNumber;
     41    var position = location.lineNumber ? lineEndings[location.lineNumber - 1] + 1 : 0;
     42    return position + location.columnNumber;
     43}
     44
     45WebInspector.ScriptFormatter.lineToPosition = function(lineEndings, lineNumber)
     46{
     47    return this.locationToPosition(lineEndings, { lineNumber: lineNumber, columnNumber: 0 });
    4348}
    4449
     
    5964    for (var i = 0; i < scripts.length; ++i) {
    6065        var start = { lineNumber: scripts[i].lineOffset, columnNumber: scripts[i].columnOffset };
    61         start.position = WebInspector.ScriptFormatter.locationToPosition(lineEndings, start.lineNumber, start.columnNumber);
     66        start.position = WebInspector.ScriptFormatter.locationToPosition(lineEndings, start);
    6267        var endPosition = start.position + scripts[i].length;
    6368        var end = WebInspector.ScriptFormatter.positionToLocation(lineEndings, endPosition);
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r82847 r83290  
    388388            }
    389389        } else {
    390             function didGetSourceLocation(sourceFileId, lineNumber, columnNumber)
     390            function didGetSourceLocation(sourceFileId, lineNumber)
    391391            {
    392392                if (!sourceFileId || !this._presentationModel.findBreakpoint(sourceFileId, lineNumber))
     
    395395                status = WebInspector.UIString("Paused on a JavaScript breakpoint.");
    396396            }
    397             callFrames[0].sourceLocation(didGetSourceLocation.bind(this));
     397            callFrames[0].sourceLine(didGetSourceLocation.bind(this));
    398398        }
    399399        if (status)
     
    488488        function didRequestSourceMapping(mapping)
    489489        {
    490             var location = mapping.scriptLocationToSourceLocation(anchor.getAttribute("line_number") - 1, 0);
    491             this._showSourceLine(sourceFile.id, location.lineNumber);
     490            var lineNumber = mapping.scriptLocationToSourceLine({lineNumber:anchor.getAttribute("line_number") - 1, columnNumber:0});
     491            this._showSourceLine(sourceFile.id, lineNumber);
    492492        }
    493493        var sourceFile = this._presentationModel.sourceFileForScriptURL(anchor.href);
     
    622622        this.sidebarPanes.callstack.selectedCallFrame = this._presentationModel.selectedCallFrame;
    623623
    624         function didGetSourceLocation(sourceFileId, lineNumber, columnNumber)
     624        function didGetSourceLocation(sourceFileId, lineNumber)
    625625        {
    626626            if (!sourceFileId)
     
    635635            this._executionSourceFrame = sourceFrame;
    636636        }
    637         callFrame.sourceLocation(didGetSourceLocation.bind(this));
     637        callFrame.sourceLine(didGetSourceLocation.bind(this));
    638638    },
    639639
  • trunk/Source/WebCore/inspector/front-end/SourceFile.js

    r82234 r83290  
    255255
    256256WebInspector.SourceMapping.prototype = {
    257     scriptLocationToSourceLocation: function(lineNumber, columnNumber)
    258     {
    259         return { lineNumber: lineNumber, columnNumber: columnNumber };
    260     },
    261 
    262     sourceLocationToScriptLocation: function(lineNumber, columnNumber)
    263     {
     257    scriptLocationToSourceLine: function(location)
     258    {
     259        return location.lineNumber;
     260    },
     261
     262    sourceLineToScriptLocation: function(lineNumber)
     263    {
     264        var columnNumber = 0;
    264265        var closestScript = this._sortedScripts[0];
    265266        for (var i = 1; i < this._sortedScripts.length; ++i) {
     
    269270            closestScript = script;
    270271        }
    271         return { scriptId: closestScript.sourceID, lineNumber: lineNumber, columnNumber: columnNumber };
     272        return { sourceID: closestScript.sourceID, lineNumber: lineNumber, columnNumber: columnNumber };
    272273    }
    273274}
     
    282283
    283284WebInspector.FormattedSourceMapping.prototype = {
    284     scriptLocationToSourceLocation: function(lineNumber, columnNumber)
    285     {
    286         var originalPosition = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, lineNumber, columnNumber);
     285    scriptLocationToSourceLine: function(location)
     286    {
     287        var originalPosition = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, location);
    287288        var formattedPosition = this._convertPosition(this._mapping.original, this._mapping.formatted, originalPosition);
    288         return WebInspector.ScriptFormatter.positionToLocation(this._formattedLineEndings, formattedPosition);
    289     },
    290 
    291     sourceLocationToScriptLocation: function(lineNumber, columnNumber)
    292     {
    293         var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(this._formattedLineEndings, lineNumber, columnNumber);
     289        return WebInspector.ScriptFormatter.positionToLocation(this._formattedLineEndings, formattedPosition).lineNumber;
     290    },
     291
     292    sourceLineToScriptLocation: function(lineNumber)
     293    {
     294        var formattedPosition = WebInspector.ScriptFormatter.lineToPosition(this._formattedLineEndings, lineNumber);
    294295        var originalPosition = this._convertPosition(this._mapping.formatted, this._mapping.original, formattedPosition);
    295296        var originalLocation = WebInspector.ScriptFormatter.positionToLocation(this._originalLineEndings, originalPosition);
    296         return WebInspector.SourceMapping.prototype.sourceLocationToScriptLocation.call(this, originalLocation.lineNumber, originalLocation.columnNumber);
     297        return WebInspector.SourceMapping.prototype.sourceLineToScriptLocation.call(this, originalLocation.lineNumber);
    297298    },
    298299
Note: See TracChangeset for help on using the changeset viewer.