Changeset 80224 in webkit


Ignore:
Timestamp:
Mar 3, 2011 3:03:32 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-03-03 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: rename "sourceName" to "sourceFileId" in ScriptsPanel.js.
https://bugs.webkit.org/show_bug.cgi?id=55569

  • inspector/debugger/scripts-panel.html:

2011-03-03 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: rename "sourceName" to "sourceFileId" in ScriptsPanel.js.
https://bugs.webkit.org/show_bug.cgi?id=55569

sourceFileId better reflects the intention to have unique identifier for each source that is shown in scripts panel.

  • inspector/front-end/DebuggerPresentationModel.js:
  • inspector/front-end/ScriptsPanel.js:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r80223 r80224  
     12011-03-03  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: rename "sourceName" to "sourceFileId" in ScriptsPanel.js.
     6        https://bugs.webkit.org/show_bug.cgi?id=55569
     7
     8        * inspector/debugger/scripts-panel.html:
     9
    1102011-03-03  Jeremy Moskovich  <jeremy@chromium.org>
    211
  • trunk/LayoutTests/inspector/debugger/scripts-panel.html

    r79873 r80224  
    3535
    3636                var sourceFrameCount = 0;
    37                 for (var sourceName in panel._sourceNameToSourceFrame)
     37                for (var sourceFileId in panel._sourceFileIdToSourceFrame)
    3838                    sourceFrameCount += 1;
    3939                InspectorTest.assertEquals(1, sourceFrameCount, "wrong number of source frames created during initial load");
  • trunk/Source/WebCore/ChangeLog

    r80222 r80224  
     12011-03-03  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: rename "sourceName" to "sourceFileId" in ScriptsPanel.js.
     6        https://bugs.webkit.org/show_bug.cgi?id=55569
     7
     8        sourceFileId better reflects the intention to have unique identifier for each source that is shown in scripts panel.
     9
     10        * inspector/front-end/DebuggerPresentationModel.js:
     11        * inspector/front-end/ScriptsPanel.js:
     12
    1132011-03-03  Steve Block  <steveblock@google.com>
    214
  • trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js

    r79311 r80224  
    4545
    4646WebInspector.DebuggerPresentationModel.prototype = {
    47     breakpointsForSourceName: function(sourceName)
     47    breakpointsForSourceFileId: function(sourceFileId)
    4848    {
    4949        var breakpoints = [];
    5050        for (var id in this._breakpoints) {
    5151            var breakpoint = this._breakpoints[id];
    52             if (breakpoint.sourceName === sourceName)
     52            if (breakpoint.sourceFileId === sourceFileId)
    5353                breakpoints.push(breakpoint);
    5454        }
     
    6262        var sourceLocation = this._actualLocationToSourceLocation(breakpoint.url || breakpoint.sourceID, location.lineNumber, location.columnNumber);
    6363
    64         var encodedSourceLocation = this._encodeSourceLocation(sourceLocation.sourceName, sourceLocation.lineNumber);
     64        var encodedSourceLocation = this._encodeSourceLocation(sourceLocation.sourceFileId, sourceLocation.lineNumber);
    6565        if (encodedSourceLocation in this._sourceLocationToBreakpointId) {
    6666            // We can't show more than one breakpoint on a single source frame line. Remove newly added breakpoint.
     
    7070
    7171        var presentationBreakpoint = {
    72             sourceName: sourceLocation.sourceName,
     72            sourceFileId: sourceLocation.sourceFileId,
    7373            lineNumber: sourceLocation.lineNumber,
    7474            url: breakpoint.url,
     
    8888        var breakpointId = event.data;
    8989        var breakpoint = this._breakpoints[breakpointId];
    90         var encodedSourceLocation = this._encodeSourceLocation(breakpoint.sourceName, breakpoint.lineNumber);
     90        var encodedSourceLocation = this._encodeSourceLocation(breakpoint.sourceFileId, breakpoint.lineNumber);
    9191        delete this._breakpoints[breakpointId];
    9292        delete this._sourceLocationToBreakpointId[encodedSourceLocation];
     
    101101    },
    102102
    103     _encodeSourceLocation: function(sourceName, lineNumber)
     103    _encodeSourceLocation: function(sourceFileId, lineNumber)
    104104    {
    105         return sourceName + ":" + lineNumber;
     105        return sourceFileId + ":" + lineNumber;
    106106    },
    107107
    108     _actualLocationToSourceLocation: function(sourceName, lineNumber, columnNumber)
     108    _actualLocationToSourceLocation: function(sourceID, lineNumber, columnNumber)
    109109    {
    110110        // TODO: use source mapping to obtain source location.
    111         return { sourceName: sourceName, lineNumber: lineNumber, columnNumber: columnNumber };
     111        return { sourceFileId: sourceID, lineNumber: lineNumber, columnNumber: columnNumber };
    112112    }
    113113}
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r80102 r80224  
    266266        }
    267267
    268         var sourceName = this._sourceNameForScript(script);
    269         this._recreateSourceFrame(sourceName);
     268        var sourceFileId = this._sourceFileIdForScript(script);
     269        this._recreateSourceFrame(sourceFileId);
    270270
    271271        var callFrames = WebInspector.debuggerModel.callFrames;
     
    288288
    289289                // Add resource url to files select if not already added while debugging inlined scripts.
    290                 if (!(resource.url in this._sourceNameToFilesSelectOption))
     290                if (!(resource.url in this._sourceFileIdToFilesSelectOption))
    291291                    this._addOptionToFilesSelectAndShowSourceFrameIfNeeded(resource.url);
    292292            } else {
     
    301301                this._recreateSourceFrame(script.sourceURL);
    302302            }
    303         } else if (!(script.sourceURL in this._sourceNameToFilesSelectOption)) {
     303        } else if (!(script.sourceURL in this._sourceFileIdToFilesSelectOption)) {
    304304            // This is a dynamic script with "//@ sourceURL=" comment.
    305305            this._addOptionToFilesSelectAndShowSourceFrameIfNeeded(script.sourceURL);
     
    327327
    328328        // Add resource url to files select if not already added while debugging inlined scripts.
    329         if (!(resource.url in this._sourceNameToFilesSelectOption))
     329        if (!(resource.url in this._sourceFileIdToFilesSelectOption))
    330330            this._addOptionToFilesSelectAndShowSourceFrameIfNeeded(resource.url);
    331331    },
     
    347347    },
    348348
    349     _addOptionToFilesSelect: function(sourceName)
    350     {
    351         var script = this._scriptForSourceName(sourceName);
     349    _addOptionToFilesSelect: function(sourceFileId)
     350    {
     351        var script = this._scriptForSourceFileId(sourceFileId);
    352352        var select = this._filesSelectElement;
    353353        var option = document.createElement("option");
     
    367367            select.insertBefore(option, select.childNodes.item(insertionIndex));
    368368
    369         option._sourceName = sourceName;
    370         this._sourceNameToFilesSelectOption[sourceName] = option;
     369        option._sourceFileId = sourceFileId;
     370        this._sourceFileIdToFilesSelectOption[sourceFileId] = option;
    371371    },
    372372
     
    374374    {
    375375        this._messages.push(message);
    376         var sourceFrame = this._sourceNameToSourceFrame[message.url];
     376        var sourceFrame = this._sourceFileIdToSourceFrame[message.url];
    377377        if (sourceFrame)
    378378            sourceFrame.addMessage(message);
     
    382382    {
    383383        this._messages = [];
    384         for (var url in this._sourceNameToSourceFrame)
    385             this._sourceNameToSourceFrame[url].clearMessages();
     384        for (var url in this._sourceFileIdToSourceFrame)
     385            this._sourceFileIdToSourceFrame[url].clearMessages();
    386386    },
    387387
     
    390390        var breakpoint = event.data;
    391391
    392         var sourceFrame = this._sourceNameToSourceFrame[breakpoint.sourceName];
     392        var sourceFrame = this._sourceFileIdToSourceFrame[breakpoint.sourceFileId];
    393393        if (sourceFrame && sourceFrame.loaded)
    394394            sourceFrame.addBreakpoint(breakpoint.lineNumber, breakpoint.resolved, breakpoint.condition, breakpoint.enabled);
     
    399399        var breakpoint = event.data;
    400400
    401         var sourceFrame = this._sourceNameToSourceFrame[breakpoint.sourceName];
     401        var sourceFrame = this._sourceFileIdToSourceFrame[breakpoint.sourceFileId];
    402402        if (sourceFrame && sourceFrame.loaded)
    403403            sourceFrame.removeBreakpoint(breakpoint.lineNumber);
     
    492492        this._updateBackAndForwardButtons();
    493493
    494         this._sourceNameToSourceFrame = {};
    495         this._sourceNameToFilesSelectOption = {};
     494        this._sourceFileIdToSourceFrame = {};
     495        this._sourceFileIdToFilesSelectOption = {};
    496496        this._messages = [];
    497497        this._filesSelectElement.removeChildren();
     
    525525    canShowSourceLine: function(url, line)
    526526    {
    527         return this._debuggerEnabled && (url in this._sourceNameToFilesSelectOption);
     527        return this._debuggerEnabled && (url in this._sourceFileIdToFilesSelectOption);
    528528    },
    529529
    530530    showSourceLine: function(url, line)
    531531    {
    532         if (!(url in this._sourceNameToFilesSelectOption))
     532        if (!(url in this._sourceFileIdToFilesSelectOption))
    533533            return;
    534534        var sourceFrame = this._showSourceFrameAndAddToHistory(url);
     
    547547    },
    548548
    549     _showSourceFrameAndAddToHistory: function(sourceName)
    550     {
    551         var sourceFrame = this._showSourceFrame(sourceName);
     549    _showSourceFrameAndAddToHistory: function(sourceFileId)
     550    {
     551        var sourceFrame = this._showSourceFrame(sourceFileId);
    552552
    553553        var oldIndex = this._currentBackForwardIndex;
     
    557557        // Check for a previous entry of the same object in _backForwardList.
    558558        // If one is found, remove it.
    559         var previousEntryIndex = this._backForwardList.indexOf(sourceName);
     559        var previousEntryIndex = this._backForwardList.indexOf(sourceFileId);
    560560        if (previousEntryIndex !== -1)
    561561            this._backForwardList.splice(previousEntryIndex, 1);
    562562
    563         this._backForwardList.push(sourceName);
     563        this._backForwardList.push(sourceFileId);
    564564        this._currentBackForwardIndex = this._backForwardList.length - 1;
    565565
     
    569569    },
    570570
    571     _showSourceFrame: function(sourceName)
    572     {
    573         var index = this._sourceNameToFilesSelectOption[sourceName].index;
     571    _showSourceFrame: function(sourceFileId)
     572    {
     573        var index = this._sourceFileIdToFilesSelectOption[sourceFileId].index;
    574574        this._filesSelectElement.selectedIndex = index;
    575575
    576         var sourceFrame = this._sourceFrameForSourceName(sourceName);
     576        var sourceFrame = this._sourceFrameForSourceFileId(sourceFileId);
    577577        this.visibleView = sourceFrame;
    578578
    579         var script = this._scriptForSourceName(sourceName);
     579        var script = this._scriptForSourceFileId(sourceFileId);
    580580        if (script.sourceURL)
    581581            WebInspector.settings.lastViewedScriptFile = script.sourceURL;
     
    584584    },
    585585
    586     _sourceFrameForSourceName: function(sourceName)
    587     {
    588         var sourceFrame = this._sourceNameToSourceFrame[sourceName];
    589         return sourceFrame || this._createSourceFrame(sourceName);
    590     },
    591 
    592     _createSourceFrame: function(sourceName)
    593     {
    594         var script = this._scriptForSourceName(sourceName);
     586    _sourceFrameForSourceFileId: function(sourceFileId)
     587    {
     588        var sourceFrame = this._sourceFileIdToSourceFrame[sourceFileId];
     589        return sourceFrame || this._createSourceFrame(sourceFileId);
     590    },
     591
     592    _createSourceFrame: function(sourceFileId)
     593    {
     594        var script = this._scriptForSourceFileId(sourceFileId);
    595595        var contentProvider;
    596596        var isScript;
     
    603603        }
    604604        sourceFrame = new WebInspector.SourceFrame(contentProvider, script.sourceURL, isScript);
    605         sourceFrame._sourceName = sourceName;
     605        sourceFrame._sourceFileId = sourceFileId;
    606606        sourceFrame.addEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
    607         this._sourceNameToSourceFrame[sourceName] = sourceFrame;
     607        this._sourceFileIdToSourceFrame[sourceFileId] = sourceFrame;
    608608        return sourceFrame;
    609609    },
    610610
    611     _recreateSourceFrame: function(sourceName)
    612     {
    613         var oldSourceFrame = this._sourceNameToSourceFrame[sourceName];
     611    _recreateSourceFrame: function(sourceFileId)
     612    {
     613        var oldSourceFrame = this._sourceFileIdToSourceFrame[sourceFileId];
    614614        if (!oldSourceFrame)
    615615            return;
    616616        oldSourceFrame.removeEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
    617         delete this._sourceNameToSourceFrame[sourceName];
     617        delete this._sourceFileIdToSourceFrame[sourceFileId];
    618618        oldSourceFrame.removeEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
    619619        if (this.visibleView !== oldSourceFrame)
    620620            return;
    621621
    622         var newSourceFrame = this._createSourceFrame(sourceName)
     622        var newSourceFrame = this._createSourceFrame(sourceFileId)
    623623        newSourceFrame.scrollTop = oldSourceFrame.scrollTop;
    624624        this.visibleView = newSourceFrame;
     
    628628    {
    629629        var sourceFrame = event.target;
    630         var sourceName = sourceFrame._sourceName;
     630        var sourceFileId = sourceFrame._sourceFileId;
    631631
    632632        for (var i = 0; i < this._messages.length; ++i) {
    633633            var message = this._messages[i];
    634             if (message.url === sourceName)
     634            if (message.url === sourceFileId)
    635635                sourceFrame.addMessage(message);
    636636        }
    637637
    638         var breakpoints = this._presentationModel.breakpointsForSourceName(sourceName);
     638        var breakpoints = this._presentationModel.breakpointsForSourceFileId(sourceFileId);
    639639        for (var i = 0; i < breakpoints.length; ++i) {
    640640            var breakpoint = breakpoints[i];
     
    645645        if (selectedCallFrame) {
    646646            var script = WebInspector.debuggerModel.scriptForSourceID(selectedCallFrame.sourceID);
    647             if (this._sourceNameForScript(script) === sourceName) {
     647            if (this._sourceFileIdForScript(script) === sourceFileId) {
    648648                sourceFrame.setExecutionLine(selectedCallFrame.line);
    649649                this._executionSourceFrame = sourceFrame;
     
    652652    },
    653653
    654     _sourceNameForScript: function(script)
     654    _sourceFileIdForScript: function(script)
    655655    {
    656656        return script.sourceURL || script.sourceID;
    657657    },
    658658
    659     _scriptForSourceName: function(sourceName)
     659    _scriptForSourceFileId: function(sourceFileId)
    660660    {
    661661        function filter(script)
    662662        {
    663             return (script.sourceURL || script.sourceID) === sourceName;
     663            return (script.sourceURL || script.sourceID) === sourceFileId;
    664664        }
    665665        return WebInspector.debuggerModel.queryScripts(filter)[0];
     
    686686
    687687        var script = WebInspector.debuggerModel.scriptForSourceID(currentFrame.sourceID);
    688         var sourceName = this._sourceNameForScript(script);
    689         if (!(sourceName in this._sourceNameToFilesSelectOption)) {
     688        var sourceFileId = this._sourceFileIdForScript(script);
     689        if (!(sourceFileId in this._sourceFileIdToFilesSelectOption)) {
    690690            // This happens in two cases:
    691691            // 1) Current call frame function is defined in anonymous script (anonymous scripts aren't added to files select by default)
    692692            // 2) We are debugging synchronously executed inlined script and there is no resource so far
    693             this._addOptionToFilesSelect(sourceName);
    694         }
    695         var sourceFrame = this._showSourceFrameAndAddToHistory(sourceName);
     693            this._addOptionToFilesSelect(sourceFileId);
     694        }
     695        var sourceFrame = this._showSourceFrameAndAddToHistory(sourceFileId);
    696696        if (sourceFrame.loaded) {
    697697            sourceFrame.setExecutionLine(currentFrame.line);
     
    702702    _filesSelectChanged: function()
    703703    {
    704         var sourceName = this._filesSelectElement[this._filesSelectElement.selectedIndex]._sourceName;
    705         this._showSourceFrameAndAddToHistory(sourceName);
     704        var sourceFileId = this._filesSelectElement[this._filesSelectElement.selectedIndex]._sourceFileId;
     705        this._showSourceFrameAndAddToHistory(sourceFileId);
    706706    },
    707707
Note: See TracChangeset for help on using the changeset viewer.