Changeset 88808 in webkit


Ignore:
Timestamp:
Jun 14, 2011 9:25:29 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-06-14 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: add tooltip to file select options in scripts panel.
https://bugs.webkit.org/show_bug.cgi?id=62537

  • inspector/debugger/scripts-panel-expected.txt:
  • inspector/debugger/scripts-panel.html:

2011-06-14 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: add tooltip to file select options in scripts panel.
https://bugs.webkit.org/show_bug.cgi?id=62537

  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel): (WebInspector.ScriptsPanel.prototype._sourceFileAdded): (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.compare): (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect): (WebInspector.ScriptsPanel.prototype._callFrameSelected.didGetSourceLocation): (WebInspector.ScriptsPanel.prototype._callFrameSelected):
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r88806 r88808  
     12011-06-14  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: add tooltip to file select options in scripts panel.
     6        https://bugs.webkit.org/show_bug.cgi?id=62537
     7
     8        * inspector/debugger/scripts-panel-expected.txt:
     9        * inspector/debugger/scripts-panel.html:
     10
    1112011-06-14  Ademar de Souza Reis Jr.  <ademar.reis@openbossa.org>
    212
  • trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt

    r79873 r88808  
    99Running: testSourceFramesCount
    1010Page reloaded.
     11
     12Running: testFilesSelect
     13text: script.js, tooltip: ...foo/bar/script.js
     14text: script.js, tooltip: ...foo/bar/script.js?a=1
     15text: script.js, tooltip: ...foo/bar/script.js?a=2
     16text: script.js, tooltip: ...foo/baz/script.js
     17text: Content scripts, tooltip: ...
     18text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=1
     19text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=2
     20text: contentScript2.js, tooltip: ...foo/bar/contentScript2.js?a=1
    1121Debugger was disabled.
    1222
  • trunk/LayoutTests/inspector/debugger/scripts-panel.html

    r80224 r88808  
    123123                next();
    124124            }
     125        },
     126
     127        function testFilesSelect(next)
     128        {
     129            var panel = new WebInspector.ScriptsPanel();
     130            var rootURL = WebInspector.mainResource.url.substring(0, WebInspector.mainResource.url.lastIndexOf("/") + 1);
     131            var nextId = 0;
     132
     133            function addOption(url, isContentScript)
     134            {
     135                var displayName = url;
     136                var indexOfQuery = displayName.indexOf("?");
     137                if (indexOfQuery !== -1)
     138                    displayName = displayName.substring(0, indexOfQuery);
     139                var lastSlashIndex = displayName.lastIndexOf("/");
     140                if (lastSlashIndex !== -1)
     141                    displayName = displayName.substring(lastSlashIndex + 1);
     142                panel._addOptionToFilesSelect({ id: nextId++, url: rootURL + url, displayName: displayName, isContentScript: isContentScript });
     143            }
     144            addOption("foo/bar/script.js", false);
     145            addOption("foo/bar/contentScript2.js?a=1", true);
     146            addOption("foo/bar/script.js?a=2", false);
     147            addOption("foo/bar/contentScript.js?a=2", true);
     148            addOption("foo/bar/script.js?a=1", false);
     149            addOption("foo/baz/script.js", false);
     150            addOption("foo/bar/contentScript.js?a=1", true);
     151            var select = panel._filesSelectElement;
     152            for (var i = 0; i < select.length; ++i) {
     153                var option = select[i];
     154                var tooltip = "..." + option.title.substring(rootURL.length);
     155                InspectorTest.addResult("text: " + option.text + ", tooltip: " + tooltip);
     156            }
     157            next();
    125158        }
    126159    ]);
  • trunk/Source/WebCore/ChangeLog

    r88805 r88808  
     12011-06-14  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: add tooltip to file select options in scripts panel.
     6        https://bugs.webkit.org/show_bug.cgi?id=62537
     7
     8        * inspector/front-end/ScriptsPanel.js:
     9        (WebInspector.ScriptsPanel):
     10        (WebInspector.ScriptsPanel.prototype._sourceFileAdded):
     11        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.compare):
     12        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect):
     13        (WebInspector.ScriptsPanel.prototype._callFrameSelected.didGetSourceLocation):
     14        (WebInspector.ScriptsPanel.prototype._callFrameSelected):
     15
    1162011-06-14  Luke Macpherson   <macpherson@chromium.org>
    217
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r88805 r88808  
    119119    this.sidebarPanes.scopechain.expanded = true;
    120120    this.sidebarPanes.jsBreakpoints.expanded = true;
    121    
     121
    122122    var helpSection = WebInspector.shortcutsHelp.section(WebInspector.UIString("Scripts Panel"));
    123     this.sidebarPanes.callstack.registerShortcuts(helpSection, this.registerShortcut.bind(this));   
     123    this.sidebarPanes.callstack.registerShortcuts(helpSection, this.registerShortcut.bind(this));
    124124
    125125    var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
     
    235235        }
    236236
    237         this._addOptionToFilesSelect(sourceFile.id);
     237        this._addOptionToFilesSelect(sourceFile);
    238238
    239239        var lastViewedURL = WebInspector.settings.lastViewedScriptFile;
     
    249249    },
    250250
    251     _addOptionToFilesSelect: function(sourceFileId)
    252     {
    253         var sourceFile = this._presentationModel.sourceFile(sourceFileId);
     251    _addOptionToFilesSelect: function(sourceFile)
     252    {
    254253        var select = this._filesSelectElement;
    255254        var option = document.createElement("option");
    256255        option.text = sourceFile.displayName;
     256        option.title = sourceFile.url;
    257257        option.isContentScript = sourceFile.isContentScript;
    258258        if (sourceFile.isContentScript)
    259259            option.addStyleClass("extension-script");
     260        function compare(a, b)
     261        {
     262            return a < b ? -1 : (a > b ? 1 : 0);
     263        }
    260264        function optionCompare(a, b)
    261265        {
     
    270274                return -1;
    271275
    272             if (a.text === b.text)
    273                 return 0;
    274             return a.text < b.text ? -1 : 1;
     276            return compare(a.text, b.text) || compare(a.title, b.title);
    275277        }
    276278
     
    287289            select.insertBefore(contentScriptSection, insertionIndex < 0 ? null : select.childNodes.item(insertionIndex));
    288290        }
    289         option._sourceFileId = sourceFileId;
    290         this._sourceFileIdToFilesSelectOption[sourceFileId] = option;
     291        option._sourceFileId = sourceFile.id;
     292        this._sourceFileIdToFilesSelectOption[sourceFile.id] = option;
    291293    },
    292294
     
    649651            if (!(sourceFileId in this._sourceFileIdToFilesSelectOption)) {
    650652                // Anonymous scripts are not added to files select by default.
    651                 this._addOptionToFilesSelect(sourceFileId);
     653                var sourceFile = this._presentationModel.sourceFile(sourceFileId);
     654                this._addOptionToFilesSelect(sourceFile);
    652655            }
    653656            var sourceFrame = this._showSourceFrameAndAddToHistory(sourceFileId);
Note: See TracChangeset for help on using the changeset viewer.