Changeset 107708 in webkit


Ignore:
Timestamp:
Feb 14, 2012 4:55:56 AM (12 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: Make ScriptsNavigator default file selector.
https://bugs.webkit.org/show_bug.cgi?id=78349

Reviewed by Pavel Feldman.

Source/WebCore:

Moved ScriptsNavigator out of experiments.
Introduced new setting "useScriptsNavigator" with true as default value.
Updated scripts panel tests related to file selector.

Tests: inspector/debugger/scripts-combobox-file-selector-history.html

inspector/debugger/scripts-file-selector.html

  • English.lproj/localizedStrings.js:
  • inspector/front-end/DebuggerPresentationModel.js:

(WebInspector.DebuggerPresentationModel.prototype.uiSourceCodes):

  • inspector/front-end/ScriptsNavigator.js:

(WebInspector.ScriptsNavigator.prototype._removeUISourceCode):
(WebInspector.ScriptsNavigator.prototype._showScriptFoldersSettingChanged):

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.prototype._uiSourceCodeAdded):
(WebInspector.ScriptsPanel.prototype._addUISourceCode):
(WebInspector.ScriptsPanel.prototype._updateExecutionLine):

  • inspector/front-end/Settings.js:

(WebInspector.ExperimentsSettings):

  • inspector/front-end/SettingsScreen.js:

(WebInspector.SettingsScreen):

Source/WebKit/chromium:

  • src/js/Tests.js:

(.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkNoDuplicates):
(.TestSuite.prototype.uiSourceCodesToString_):
(.TestSuite.prototype.nonAnonymousUISourceCodes_):
(.TestSuite.prototype._scriptsAreParsed):
(.TestSuite.prototype._waitUntilScriptsAreParsed.waitForAllScripts):
(.TestSuite.prototype._waitUntilScriptsAreParsed):

LayoutTests:

  • http/tests/inspector/debugger-test.js:

(initialize_DebuggerTest):
(initialize_DebuggerTest.):

  • inspector/debugger/scripts-combobox-file-selector-history-expected.txt: Added.
  • inspector/debugger/scripts-combobox-file-selector-history.html: Added.
  • inspector/debugger/scripts-file-selector-expected.txt: Copied from LayoutTests/inspector/debugger/scripts-panel-expected.txt.
  • inspector/debugger/scripts-file-selector.html: Added.
  • inspector/debugger/scripts-panel-expected.txt:
  • inspector/debugger/scripts-panel.html:
  • inspector/debugger/scripts-sorting-expected.txt:
  • inspector/debugger/scripts-sorting.html:
  • inspector/debugger/source-frame-count.html:
Location:
trunk
Files:
3 added
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107705 r107708  
     12012-02-14  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Make ScriptsNavigator default file selector.
     4        https://bugs.webkit.org/show_bug.cgi?id=78349
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * http/tests/inspector/debugger-test.js:
     9        (initialize_DebuggerTest):
     10        (initialize_DebuggerTest.):
     11        * inspector/debugger/scripts-combobox-file-selector-history-expected.txt: Added.
     12        * inspector/debugger/scripts-combobox-file-selector-history.html: Added.
     13        * inspector/debugger/scripts-file-selector-expected.txt: Copied from LayoutTests/inspector/debugger/scripts-panel-expected.txt.
     14        * inspector/debugger/scripts-file-selector.html: Added.
     15        * inspector/debugger/scripts-panel-expected.txt:
     16        * inspector/debugger/scripts-panel.html:
     17        * inspector/debugger/scripts-sorting-expected.txt:
     18        * inspector/debugger/scripts-sorting.html:
     19        * inspector/debugger/source-frame-count.html:
     20
    1212012-02-14  Alexander Pavlov  <apavlov@chromium.org>
    222
  • trunk/LayoutTests/http/tests/inspector/debugger-test.js

    r107615 r107708  
    154154};
    155155
    156 InspectorTest.showScriptSource = function(scriptName, callback)
    157 {
    158     var filesSelect = document.getElementById("scripts-files");
    159     for (var i = 0; i < filesSelect.length; ++i) {
    160         if (filesSelect[i]._uiSourceCode && filesSelect[i]._uiSourceCode.fileName === scriptName) {
    161             filesSelect.selectedIndex = i;
    162             WebInspector.panels.scripts._fileSelector._filesSelectChanged();
    163             var sourceFrame = WebInspector.panels.scripts.visibleView;
     156InspectorTest.showScriptSourceOnScriptsPanel = function(panel, scriptName, callback)
     157{
     158    var uiSourceCodes = panel._presentationModel.uiSourceCodes();
     159    for (var i = 0; i < uiSourceCodes.length; ++i) {
     160        if (uiSourceCodes[i].fileName === scriptName) {
     161            panel.showUISourceCode(uiSourceCodes[i]);
     162            var sourceFrame = panel.visibleView;
    164163            if (sourceFrame.loaded)
    165164                callback(sourceFrame);
     
    169168        }
    170169    }
    171     InspectorTest.addSniffer(WebInspector.panels.scripts._fileSelector, "_addOptionToFilesSelect", InspectorTest.showScriptSource.bind(InspectorTest, scriptName, callback));
     170    InspectorTest.addSniffer(panel, "_addUISourceCode", InspectorTest.showScriptSource.bind(InspectorTest, scriptName, callback));
     171};
     172
     173InspectorTest.showScriptSource = function(scriptName, callback)
     174{
     175    InspectorTest.showScriptSourceOnScriptsPanel(WebInspector.panels.scripts, scriptName, callback)
     176};
     177
     178InspectorTest.dumpScriptsNavigator = function(navigator)
     179{
     180    InspectorTest.addResult("Dumping ScriptsNavigator 'Scripts' tab:");
     181    dumpNavigatorTreeOutline(navigator._navigatorScriptsTree);
     182    InspectorTest.addResult("Dumping ScriptsNavigator 'Content scripts' tab:");
     183    dumpNavigatorTreeOutline(navigator._navigatorContentScriptsTree);
     184
     185    function dumpNavigatorTreeElement(prefix, treeElement)
     186    {
     187        InspectorTest.addResult(prefix + treeElement.titleText);
     188        for (var i = 0; i < treeElement.children.length; ++i)
     189            dumpNavigatorTreeElement(prefix + "  ", treeElement.children[i]);
     190    }
     191
     192    function dumpNavigatorTreeOutline(treeOutline)
     193    {
     194        for (var i = 0; i < treeOutline.children.length; ++i)
     195            dumpNavigatorTreeElement("  ", treeOutline.children[i]);
     196    }
     197};
     198
     199InspectorTest.dumpComboBoxFileSelector = function(comboBoxFileSelector)
     200{
     201    var rootURL = "http://localhost:8080/LayoutTests/inspector/debugger/";
     202    InspectorTest.addResult("Dumping ComboBoxFileSelector:");
     203    var select = comboBoxFileSelector._filesSelectElement;
     204    for (var i = 0; i < select.length; ++i) {
     205        var option = select[i];
     206        var text = option.text.replace(/.*LayoutTests/, "LayoutTests");
     207        text = text.replace(/\u00a0/g, " ").replace(/\u2026/g, "...");
     208        var tooltip = option.title.replace(rootURL, "<root>/");
     209        InspectorTest.addResult(text + (tooltip ? "(" + tooltip + ")" : ""));
     210    }
    172211};
    173212
  • trunk/LayoutTests/inspector/debugger/scripts-file-selector-expected.txt

    r107707 r107708  
    1 Tests that scripts panel UI elements work as intended.
     1Tests scripts panel file selectors.
    22
    3 
    4 Running: testInitialLoad
    5 Source requested for foo.js
    6 Dump files select:
    7     bar.js
    8     baz.js
    9     foo.js
    10 Source requested for baz.js
    11 
    12 Running: testHistory
    13 Source requested for index.html
    14 Source requested for script1.js
    15 Source requested for script2.js
    16 Source requested for script3.js
    17 
    18 Running: testFilesSelect
     3Dumping ComboBoxFileSelector:
    194    ?a=b(?a=b)
    205    very_looooooooo...oooooooong_url(very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url)
     
    3318    contentScript.js?a=2(<root>/foo/bar/contentScript.js?a=2)
    3419    contentScript2.js?a=1(<root>/foo/bar/contentScript2.js?a=1)
     20Dumping ScriptsNavigator 'Scripts' tab:
     21  example.com
     22    ?a=b
     23  localhost
     24    LayoutTests/inspector/debugger/foo/bar
     25      script.js
     26      script.js?a=1
     27      script.js?a=2
     28    LayoutTests/inspector/debugger/foo/baz
     29      script.js
     30  ?a=b
     31  very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url
     32Dumping ScriptsNavigator 'Content scripts' tab:
     33  localhost
     34    LayoutTests/inspector/debugger/foo/bar
     35      contentScript.js?a=1
     36      contentScript.js?a=2
     37      contentScript2.js?a=1
    3538
    36 Running: testSourceReplaced
    37 Source requested for foo.js
    38 Source requested for source2.js
    39 Source requested for source1.js
    40 Source requested for compiled.js
    41 
  • trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt

    r107615 r107708  
    33
    44Running: testInitialLoad
     5Dumping ScriptsNavigator 'Scripts' tab:
     6  bar.js
     7  baz.js
     8  foo.js
     9Dumping ScriptsNavigator 'Content scripts' tab:
     10Source requested for baz.js
     11
     12Running: testInitialLoadWithComboBoxFileSelector
    513Source requested for foo.js
    614Dump files select:
     
    1018Source requested for baz.js
    1119
    12 Running: testHistory
    13 Source requested for index.html
    14 Source requested for script1.js
    15 Source requested for script2.js
    16 Source requested for script3.js
    17 
    18 Running: testFilesSelect
    19     ?a=b(?a=b)
    20     very_looooooooo...oooooooong_url(very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url)
    21 — example.com —
    22     ?a=b(http://example.com/?a=b)
    23 — localhost —
    24 LayoutTests/inspector/debugger/foo/bar
    25     script.js(<root>/foo/bar/script.js)
    26     script.js?a=1(<root>/foo/bar/script.js?a=1)
    27     script.js?a=2(<root>/foo/bar/script.js?a=2)
    28 LayoutTests/inspector/debugger/foo/baz
    29     script.js(<root>/foo/baz/script.js)
    30 — Content scripts —
    31 LayoutTests/inspector/debugger/foo/bar
    32     contentScript.js?a=1(<root>/foo/bar/contentScript.js?a=1)
    33     contentScript.js?a=2(<root>/foo/bar/contentScript.js?a=2)
    34     contentScript2.js?a=1(<root>/foo/bar/contentScript2.js?a=1)
    35 
    3620Running: testSourceReplaced
    37 Source requested for foo.js
     21Dumping ScriptsNavigator 'Scripts' tab:
     22  compiled.js
     23  foo.js
     24Dumping ScriptsNavigator 'Content scripts' tab:
     25Dumping ScriptsNavigator 'Scripts' tab:
     26  foo.js
     27  source1.js
     28  source2.js
     29Dumping ScriptsNavigator 'Content scripts' tab:
    3830Source requested for source2.js
    3931Source requested for source1.js
    4032Source requested for compiled.js
     33Dumping ScriptsNavigator 'Scripts' tab:
     34  compiled.js
     35  foo.js
     36Dumping ScriptsNavigator 'Content scripts' tab:
    4137
     38Running: testSourceReplacedWithComboBoxFileSelector
     39Source requested for foo.js
     40Dumping ComboBoxFileSelector:
     41    compiled.js(compiled.js)
     42    foo.js(foo.js)
     43Dumping ComboBoxFileSelector:
     44    foo.js(foo.js)
     45    source1.js(source1.js)
     46    source2.js(source2.js)
     47Source requested for source2.js
     48Source requested for source1.js
     49Source requested for compiled.js
     50Dumping ComboBoxFileSelector:
     51    compiled.js(compiled.js)
     52    foo.js(foo.js)
     53
  • trunk/LayoutTests/inspector/debugger/scripts-panel.html

    r107615 r107708  
    22<head>
    33<script src="../../http/tests/inspector/inspector-test.js"></script>
     4<script src="../../http/tests/inspector/debugger-test.js"></script>
    45
    56<script>
     
    1011    WebInspector._isMac = false;
    1112
     13    var uiSourceCodes;
    1214    function createDebuggerPresentationModelMock()
    1315    {
     
    1618        model.messagesForUISourceCode = function() { return []; };
    1719        model.canEditScriptSource = function() { return true; };
     20        uiSourceCodes = [];
     21        model.uiSourceCodes = function() { return uiSourceCodes.slice(); };
    1822        return model;
    1923    }
     
    2630            callback("");
    2731        };
     32        uiSourceCodes.push(uiSourceCode);
    2833        return uiSourceCode;
    29     }
    30 
    31     function showSourceFrame(panel, fileName)
    32     {
    33         var select = panel._fileSelector._filesSelectElement;
    34         for (var i = 0; i < select.length; ++i) {
    35             if (select[i].text.indexOf(fileName) === -1)
    36                 continue;
    37             select.selectedIndex = i;
    38             panel._fileSelector._filesSelectChanged();
    39             break;
    40         }
    4134    }
    4235
     
    4639            var model = createDebuggerPresentationModelMock();
    4740            var panel = new WebInspector.ScriptsPanel(model);
     41            panel.show();
     42
     43            var uiSourceCodeBAZ = createUISouceCode("baz.js");
     44            panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
     45            panel._uiSourceCodeAdded({ data: createUISouceCode("bar.js") });
     46            panel._uiSourceCodeAdded({ data: uiSourceCodeBAZ });
     47
     48            InspectorTest.dumpScriptsNavigator(panel._navigator);
     49
     50            // Select "baz.js".
     51            panel._showFile(uiSourceCodeBAZ);
     52            panel.detach();
     53
     54            next();
     55        },
     56
     57        function testInitialLoadWithComboBoxFileSelector(next)
     58        {
     59            var model = createDebuggerPresentationModelMock();
     60            WebInspector.settings.useScriptsNavigator.set(false);
     61            var panel = new WebInspector.ScriptsPanel(model);
     62            WebInspector.settings.useScriptsNavigator.set(true);
    4863            panel.show();
    4964
     
    6984        },
    7085
    71         function testHistory(next)
    72         {
    73             var model = createDebuggerPresentationModelMock();
    74             var panel = new WebInspector.ScriptsPanel(model);
    75             panel.show();
    76 
    77             var files = ["index.html", "script1.js", "script2.js", "script3.js"];
    78             for (var i = 0; i < files.length; ++i)
    79                 panel._uiSourceCodeAdded({ data: createUISouceCode(files[i]) });
    80 
    81             function checkCurrentlySelectedFileName(fileName)
    82             {
    83                 var index = panel._fileSelector._filesSelectElement.selectedIndex;
    84                 var text = panel._fileSelector._filesSelectElement[index].text;
    85                 InspectorTest.assertTrue(text.indexOf(fileName) !== -1,
    86                     "Wrong option text. Expected <" + fileName + ">, found <" + text + ">.");
    87             }
    88 
    89             for (var i = 0; i < files.length; ++i)
    90                 showSourceFrame(panel, files[i]);
    91             checkCurrentlySelectedFileName("script3.js");
    92             InspectorTest.assertEquals(true, panel._fileSelector.forwardButton.disabled, "Forward should be disabled.");
    93 
    94             panel._fileSelector.backButton.click();
    95             checkCurrentlySelectedFileName("script2.js");
    96             InspectorTest.assertEquals(false, panel._fileSelector.forwardButton.disabled, "Forward should be enabled after back button click.");
    97 
    98             panel._fileSelector.forwardButton.click();
    99             checkCurrentlySelectedFileName("script3.js");
    100             InspectorTest.assertEquals(true, panel._fileSelector.forwardButton.disabled, "Forward should be disabled after forward button click.");
    101 
    102             panel._fileSelector.backButton.click();
    103             checkCurrentlySelectedFileName("script2.js");
    104 
    105             panel._fileSelector.backButton.click();
    106             checkCurrentlySelectedFileName("script1.js");
    107 
    108             panel._fileSelector.backButton.click();
    109             checkCurrentlySelectedFileName("index.html");
    110 
    111             panel._fileSelector.forwardButton.click();
    112             panel._fileSelector.forwardButton.click();
    113             checkCurrentlySelectedFileName("script2.js");
    114 
    115             showSourceFrame(panel, "script1.js");
    116             checkCurrentlySelectedFileName("script1.js");
    117             InspectorTest.assertEquals(true, panel._fileSelector.forwardButton.disabled);
    118 
    119             panel._fileSelector.backButton.click();
    120             checkCurrentlySelectedFileName("script2.js");
    121 
    122             panel._fileSelector.backButton.click();
    123             checkCurrentlySelectedFileName("index.html");
    124 
    125             panel.detach();
    126             next();
    127         },
    128 
    129         function testFilesSelect(next)
    130         {
    131             var model = createDebuggerPresentationModelMock();
    132             var panel = new WebInspector.ScriptsPanel(model);
    133             panel.show();
    134 
    135             var rootURL = "http://localhost:8080/LayoutTests/inspector/debugger/";
    136             var nextId = 0;
    137             function addOption(url, isContentScript)
    138             {
    139                 var uiSourceCode = new WebInspector.UISourceCode(nextId++, url, null, null);
    140                 uiSourceCode.isContentScript = isContentScript;
    141                 panel._fileSelector._addOptionToFilesSelect(uiSourceCode);
    142             }
    143             addOption(rootURL + "foo/bar/script.js", false);
    144             addOption(rootURL + "foo/bar/contentScript2.js?a=1", true);
    145             addOption(rootURL + "foo/bar/script.js?a=2", false);
    146             addOption(rootURL + "foo/bar/contentScript.js?a=2", true);
    147             addOption(rootURL + "foo/bar/script.js?a=1", false);
    148             addOption(rootURL + "foo/baz/script.js", false);
    149             addOption(rootURL + "foo/bar/contentScript.js?a=1", true);
    150             addOption("http://example.com/?a=b", false);
    151             addOption("?a=b", false);
    152             addOption("very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url", false);
    153 
    154             var select = panel._fileSelector._filesSelectElement;
    155             for (var i = 0; i < select.length; ++i) {
    156                 var option = select[i];
    157                 var text = option.text.replace(/.*LayoutTests/, "LayoutTests");
    158                 text = text.replace(/\u00a0/g, " ").replace(/\u2026/g, "...");
    159                 var tooltip = option.title.replace(rootURL, "<root>/");
    160                 InspectorTest.addResult(text + (tooltip ? "(" + tooltip + ")" : ""));
    161             }
    162 
    163             panel.detach();
    164             next();
    165         },
    166 
    16786        function testSourceReplaced(next)
    16887        {
     
    17594            panel._uiSourceCodeAdded({ data: compiledSourceCode });
    17695
    177             InspectorTest.assertEquals(2, panel._fileSelector._filesSelectElement.length);
     96            InspectorTest.dumpScriptsNavigator(panel._navigator);
    17897
    17998            // Plug compiler source mapping.
     
    182101            panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [compiledSourceCode], uiSourceCodeList: [source1SourceCode, source2SourceCode] }});
    183102
    184             InspectorTest.assertEquals(3, panel._fileSelector._filesSelectElement.length);
    185             showSourceFrame(panel, "source2.js");
    186             showSourceFrame(panel, "source1.js");
     103            InspectorTest.dumpScriptsNavigator(panel._navigator);
     104            InspectorTest.showScriptSourceOnScriptsPanel(panel, "source2.js", step2);
    187105
    188             // Unplug compiler source mapping.
    189             panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [source1SourceCode, source2SourceCode], uiSourceCodeList: [compiledSourceCode] }});
    190             InspectorTest.assertEquals(2, panel._fileSelector._filesSelectElement.length);
     106            function step2() {
     107                InspectorTest.showScriptSourceOnScriptsPanel(panel, "source1.js", step3);
     108            }
    191109
    192             panel.detach();
    193             next();
     110            function step3() {
     111                // Unplug compiler source mapping.
     112                panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [source1SourceCode, source2SourceCode], uiSourceCodeList: [compiledSourceCode] }});
     113                InspectorTest.dumpScriptsNavigator(panel._navigator);
     114
     115                panel.detach();
     116                next();
     117            }
     118        },
     119
     120        function testSourceReplacedWithComboBoxFileSelector(next)
     121        {
     122            var model = createDebuggerPresentationModelMock();
     123            WebInspector.settings.useScriptsNavigator.set(false);
     124            var panel = new WebInspector.ScriptsPanel(model);
     125            WebInspector.settings.useScriptsNavigator.set(true);
     126            panel.show();
     127
     128            panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
     129            var compiledSourceCode = createUISouceCode("compiled.js");
     130            panel._uiSourceCodeAdded({ data: compiledSourceCode });
     131
     132            InspectorTest.dumpComboBoxFileSelector(panel._fileSelector);
     133
     134            // Plug compiler source mapping.
     135            var source1SourceCode = createUISouceCode("source1.js");
     136            var source2SourceCode = createUISouceCode("source2.js");
     137            panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [compiledSourceCode], uiSourceCodeList: [source1SourceCode, source2SourceCode] }});
     138            InspectorTest.dumpComboBoxFileSelector(panel._fileSelector);
     139            InspectorTest.showScriptSourceOnScriptsPanel(panel, "source2.js", step2);
     140
     141            function step2() {
     142                InspectorTest.showScriptSourceOnScriptsPanel(panel, "source1.js", step3);
     143            }
     144
     145            function step3() {
     146                // Unplug compiler source mapping.
     147                panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [source1SourceCode, source2SourceCode], uiSourceCodeList: [compiledSourceCode] }});
     148                InspectorTest.dumpComboBoxFileSelector(panel._fileSelector);
     149
     150                panel.detach();
     151                next();
     152            }
    194153        }
    195154    ]);
  • trunk/LayoutTests/inspector/debugger/scripts-sorting-expected.txt

    r107615 r107708  
    11Tests scripts sorting in the scripts panel.
    22
    3 Debugger was enabled.
    43
    54WebInspector.settings.showScriptFolders = true
    6     *Non*URL*path
     5Dumping ComboBoxFileSelector:
     6    *Non*URL*path(*Non*URL*path)
    77— bar.com —
    88/foo/path
    9     bar.js?file=bar/zzz.js
    10     foo.js?file=bar/aaa.js
     9    bar.js?file=bar/zzz.js(http://bar.com/foo/path/bar.js?file=bar/zzz.js)
     10    foo.js?file=bar/aaa.js(http://bar.com/foo/path/foo.js?file=bar/aaa.js)
    1111— foo.com —
     12    block.js?block=foo(http://foo.com/block.js?block=foo)
     13    ga.js(http://foo.com/ga.js)
     14    lenta.ban?pg=4883&ifr=1(http://foo.com/lenta.ban?pg=4883&ifr=1)
     15    lenta.ban?pg=5309&ifr=1(http://foo.com/lenta.ban?pg=5309&ifr=1)
     16    top100.jcn?80674(http://foo.com/top100.jcn?80674)
     17/_js/production
     18    motor.js?1308927432(http://foo.com/_js/production/motor.js?1308927432)
     19/foo/path
     20    bar.js?file=bar/zzz.js(http://foo.com/foo/path/bar.js?file=bar/zzz.js)
     21    foo.js?file=bar/aaa.js(http://foo.com/foo/path/foo.js?file=bar/aaa.js)
     22/i
     23    xgemius.js(http://foo.com/i/xgemius.js)
     24/i/js
     25    jquery-1.5.1.min.js(http://foo.com/i/js/jquery-1.5.1.min.js)
     26    jquery.cookie.js(http://foo.com/i/js/jquery.cookie.js)
     27— Content scripts —
     28    *Non*URL*path(*Non*URL*path)
     29extension-name
     30    bar.js(extension-schema://extension-name/bar.js)
     31extension-name/folder
     32    baz.js(extension-schema://extension-name/folder/baz.js)
     33Dumping ScriptsNavigator 'Scripts' tab:
     34  bar.com
     35    foo/path
     36      bar.js?file=bar/zzz.js
     37      foo.js?file=bar/aaa.js
     38  foo.com
     39    _js/production
     40      motor.js?1308927432
     41    foo/path
     42      bar.js?file=bar/zzz.js
     43      foo.js?file=bar/aaa.js
     44    i
     45      xgemius.js
     46    i/js
     47      jquery-1.5.1.min.js
     48      jquery.cookie.js
    1249    block.js?block=foo
    1350    ga.js
     
    1552    lenta.ban?pg=5309&ifr=1
    1653    top100.jcn?80674
    17 /_js/production
    18     motor.js?1308927432
    19 /foo/path
    20     bar.js?file=bar/zzz.js
    21     foo.js?file=bar/aaa.js
    22 /i
    23     xgemius.js
    24 /i/js
    25     jquery-1.5.1.min.js
    26     jquery.cookie.js
    27 — Content scripts —
    28     *Non*URL*path
    29 extension-name
     54  *Non*URL*path
     55Dumping ScriptsNavigator 'Content scripts' tab:
     56  extension-name
     57    folder
     58      baz.js
    3059    bar.js
    31 extension-name/folder
    32     baz.js
     60  *Non*URL*path
    3361
    3462WebInspector.settings.showScriptFolders = false
    35 *Non*URL*path
    36 bar.js?file=bar/zzz.js
    37 bar.js?file=bar/zzz.js
    38 block.js?block=foo
    39 foo.js?file=bar/aaa.js
    40 foo.js?file=bar/aaa.js
    41 ga.js
    42 jquery-1.5.1.min.js
    43 jquery.cookie.js
    44 lenta.ban?pg=4883&ifr=1
    45 lenta.ban?pg=5309&ifr=1
    46 motor.js?1308927432
    47 top100.jcn?80674
    48 xgemius.js
     63Dumping ComboBoxFileSelector:
     64*Non*URL*path(*Non*URL*path)
     65bar.js?file=bar/zzz.js(http://foo.com/foo/path/bar.js?file=bar/zzz.js)
     66bar.js?file=bar/zzz.js(http://bar.com/foo/path/bar.js?file=bar/zzz.js)
     67block.js?block=foo(http://foo.com/block.js?block=foo)
     68foo.js?file=bar/aaa.js(http://foo.com/foo/path/foo.js?file=bar/aaa.js)
     69foo.js?file=bar/aaa.js(http://bar.com/foo/path/foo.js?file=bar/aaa.js)
     70ga.js(http://foo.com/ga.js)
     71jquery-1.5.1.min.js(http://foo.com/i/js/jquery-1.5.1.min.js)
     72jquery.cookie.js(http://foo.com/i/js/jquery.cookie.js)
     73lenta.ban?pg=4883&ifr=1(http://foo.com/lenta.ban?pg=4883&ifr=1)
     74lenta.ban?pg=5309&ifr=1(http://foo.com/lenta.ban?pg=5309&ifr=1)
     75motor.js?1308927432(http://foo.com/_js/production/motor.js?1308927432)
     76top100.jcn?80674(http://foo.com/top100.jcn?80674)
     77xgemius.js(http://foo.com/i/xgemius.js)
    4978— Content scripts —
    50 *Non*URL*path
    51 extension-name/bar.js
    52 extension-name/folder/baz.js
     79*Non*URL*path(*Non*URL*path)
     80extension-name/bar.js(extension-schema://extension-name/bar.js)
     81extension-name/folder/baz.js(extension-schema://extension-name/folder/baz.js)
     82Dumping ScriptsNavigator 'Scripts' tab:
     83  *Non*URL*path
     84  bar.js?file=bar/zzz.js
     85  bar.js?file=bar/zzz.js
     86  block.js?block=foo
     87  foo.js?file=bar/aaa.js
     88  foo.js?file=bar/aaa.js
     89  ga.js
     90  jquery-1.5.1.min.js
     91  jquery.cookie.js
     92  lenta.ban?pg=4883&ifr=1
     93  lenta.ban?pg=5309&ifr=1
     94  motor.js?1308927432
     95  top100.jcn?80674
     96  xgemius.js
     97Dumping ScriptsNavigator 'Content scripts' tab:
     98  *Non*URL*path
     99  bar.js
     100  baz.js
    53101
    54102WebInspector.settings.showScriptFolders = true
    55     *Non*URL*path
     103Dumping ComboBoxFileSelector:
     104    *Non*URL*path(*Non*URL*path)
    56105— bar.com —
    57106/foo/path
    58     bar.js?file=bar/zzz.js
    59     foo.js?file=bar/aaa.js
     107    bar.js?file=bar/zzz.js(http://bar.com/foo/path/bar.js?file=bar/zzz.js)
     108    foo.js?file=bar/aaa.js(http://bar.com/foo/path/foo.js?file=bar/aaa.js)
    60109— foo.com —
     110    block.js?block=foo(http://foo.com/block.js?block=foo)
     111    ga.js(http://foo.com/ga.js)
     112    lenta.ban?pg=4883&ifr=1(http://foo.com/lenta.ban?pg=4883&ifr=1)
     113    lenta.ban?pg=5309&ifr=1(http://foo.com/lenta.ban?pg=5309&ifr=1)
     114    top100.jcn?80674(http://foo.com/top100.jcn?80674)
     115/_js/production
     116    motor.js?1308927432(http://foo.com/_js/production/motor.js?1308927432)
     117/foo/path
     118    bar.js?file=bar/zzz.js(http://foo.com/foo/path/bar.js?file=bar/zzz.js)
     119    foo.js?file=bar/aaa.js(http://foo.com/foo/path/foo.js?file=bar/aaa.js)
     120/i
     121    xgemius.js(http://foo.com/i/xgemius.js)
     122/i/js
     123    jquery-1.5.1.min.js(http://foo.com/i/js/jquery-1.5.1.min.js)
     124    jquery.cookie.js(http://foo.com/i/js/jquery.cookie.js)
     125— Content scripts —
     126    *Non*URL*path(*Non*URL*path)
     127extension-name
     128    bar.js(extension-schema://extension-name/bar.js)
     129extension-name/folder
     130    baz.js(extension-schema://extension-name/folder/baz.js)
     131Dumping ScriptsNavigator 'Scripts' tab:
     132  bar.com
     133    foo/path
     134      bar.js?file=bar/zzz.js
     135      foo.js?file=bar/aaa.js
     136  foo.com
     137    _js/production
     138      motor.js?1308927432
     139    foo/path
     140      bar.js?file=bar/zzz.js
     141      foo.js?file=bar/aaa.js
     142    i
     143      xgemius.js
     144    i/js
     145      jquery-1.5.1.min.js
     146      jquery.cookie.js
    61147    block.js?block=foo
    62148    ga.js
     
    64150    lenta.ban?pg=5309&ifr=1
    65151    top100.jcn?80674
    66 /_js/production
    67     motor.js?1308927432
    68 /foo/path
    69     bar.js?file=bar/zzz.js
    70     foo.js?file=bar/aaa.js
    71 /i
    72     xgemius.js
    73 /i/js
    74     jquery-1.5.1.min.js
    75     jquery.cookie.js
    76 — Content scripts —
    77     *Non*URL*path
    78 extension-name
     152  *Non*URL*path
     153Dumping ScriptsNavigator 'Content scripts' tab:
     154  extension-name
     155    folder
     156      baz.js
    79157    bar.js
    80 extension-name/folder
    81     baz.js
    82 Debugger was disabled.
     158  *Non*URL*path
    83159
  • trunk/LayoutTests/inspector/debugger/scripts-sorting.html

    r107615 r107708  
    1010    WebInspector._isMac = false;
    1111
    12     InspectorTest.startDebuggerTest(step1);
    13 
    14     function step1()
    15     {
    16         var scripts = [
    17             "block.js?block=foo",
    18             "ga.js",
    19             "lenta.ban?pg=4883&ifr=1",
    20             "lenta.ban?pg=5309&ifr=1",
    21             "top100.jcn?80674",
    22             "_js/production/motor.js?1308927432",
    23             "i/xgemius.js",
    24             "i/js/jquery-1.5.1.min.js",
    25             "i/js/jquery.cookie.js",
    26             "foo/path/bar.js?file=bar/zzz.js",
    27             "foo/path/foo.js?file=bar/aaa.js" ];
    28         for (var i = 0; i < scripts.length; ++i)
    29             addOption("http://foo.com/" + scripts[i]);
    30 
    31         var scripts2 = [
    32             "foo/path/bar.js?file=bar/zzz.js",
    33             "foo/path/foo.js?file=bar/aaa.js" ];
    34         for (var i = 0; i < scripts2.length; ++i)
    35             addOption("http://bar.com/" + scripts2[i]);
    36         addOption("*Non*URL*path");
    37 
    38         var extensions = [
    39             "extension-schema://extension-name/bar.js",
    40             "extension-schema://extension-name/folder/baz.js" ];
    41         for (var i = 0; i < extensions.length; ++i)
    42             addOption(extensions[i], true);
    43         addOption("*Non*URL*path", true);
    44 
    45         try {
    46             dumpScriptsList();
    47             WebInspector.settings.showScriptFolders.set(false);
    48             dumpScriptsList();
    49         } finally {
    50             WebInspector.settings.showScriptFolders.set(true);
    51         }
    52         dumpScriptsList();
    53         InspectorTest.completeDebuggerTest();
    54     }
     12    var navigatorFileSelector = new WebInspector.ScriptsNavigator();
     13    var comboBoxFileSelector = new WebInspector.ScriptsPanel.ComboBoxFileSelector();
    5514
    5615    var nextId = 1;
    57 
    58     function addOption(url, isContentScript)
     16    function addUISourceCode(url, isContentScript)
    5917    {
    6018        var uiSourceCode = new WebInspector.UISourceCode(nextId++, url, null, null);
    6119        uiSourceCode.isContentScript = isContentScript;
    62         WebInspector.panels.scripts._fileSelector._addOptionToFilesSelect(uiSourceCode);
     20        navigatorFileSelector.addUISourceCode(uiSourceCode);
     21        comboBoxFileSelector.addUISourceCode(uiSourceCode);
    6322    }
    6423
     
    6726        InspectorTest.addResult("");
    6827        InspectorTest.addResult("WebInspector.settings.showScriptFolders = " + WebInspector.settings.showScriptFolders.get());
    69         var select = WebInspector.panels.scripts._fileSelector._filesSelectElement;
    70         for (var i = 0; i < select.length; ++i) {
    71             if (select[i]._uiSourceCode && select[i]._uiSourceCode.url.indexOf("LayoutTests/") !== -1)
    72                 continue;
    73             if (select[i].textContent.indexOf("LayoutTests/") !== -1)
    74                 continue;
    75             InspectorTest.addResult(select[i].textContent.replace(/\u00a0/g, " "));
    76         }
     28
     29        InspectorTest.dumpComboBoxFileSelector(comboBoxFileSelector);
     30        InspectorTest.dumpScriptsNavigator(navigatorFileSelector);
    7731    }
     32
     33    var scripts = [
     34        "block.js?block=foo",
     35        "ga.js",
     36        "lenta.ban?pg=4883&ifr=1",
     37        "lenta.ban?pg=5309&ifr=1",
     38        "top100.jcn?80674",
     39        "_js/production/motor.js?1308927432",
     40        "i/xgemius.js",
     41        "i/js/jquery-1.5.1.min.js",
     42        "i/js/jquery.cookie.js",
     43        "foo/path/bar.js?file=bar/zzz.js",
     44        "foo/path/foo.js?file=bar/aaa.js" ];
     45    for (var i = 0; i < scripts.length; ++i)
     46        addUISourceCode("http://foo.com/" + scripts[i]);
     47
     48    var scripts2 = [
     49        "foo/path/bar.js?file=bar/zzz.js",
     50        "foo/path/foo.js?file=bar/aaa.js" ];
     51    for (var i = 0; i < scripts2.length; ++i)
     52        addUISourceCode("http://bar.com/" + scripts2[i]);
     53    addUISourceCode("*Non*URL*path");
     54
     55    var extensions = [
     56        "extension-schema://extension-name/bar.js",
     57        "extension-schema://extension-name/folder/baz.js" ];
     58    for (var i = 0; i < extensions.length; ++i)
     59        addUISourceCode(extensions[i], true);
     60    addUISourceCode("*Non*URL*path", true);
     61
     62    try {
     63        dumpScriptsList();
     64        WebInspector.settings.showScriptFolders.set(false);
     65        dumpScriptsList();
     66    } finally {
     67        WebInspector.settings.showScriptFolders.set(true);
     68    }
     69    dumpScriptsList();
     70    InspectorTest.completeTest();
    7871}
    7972</script>
  • trunk/LayoutTests/inspector/debugger/source-frame-count.html

    r107615 r107708  
    1818            var sourceFrameCount = 0;
    1919
    20             InspectorTest.showScriptSource("source-frame-count.html", didShowScriptSource);
     20            InspectorTest.showScriptSource("source-frame-count.html", step2);
    2121
    22             function didShowScriptSource()
     22            function step2()
    2323            {
    24                 function didCreateSourceFrame()
     24                InspectorTest.showScriptSource("script1.js", step3);
     25            }
     26
     27            function step3()
     28            {
     29                InspectorTest.showScriptSource("script2.js", didShowScriptSources);
     30            }
     31
     32            function didShowScriptSources()
     33            {
     34                function didCreateSourceFrame(uiSourceCode)
    2535                {
    2636                    sourceFrameCount += 1;
    2737                }
    28                 InspectorTest.addSniffer(panel, "_createSourceFrame", didCreateSourceFrame, true);
     38                InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "wasShown", didCreateSourceFrame, true);
    2939                InspectorTest.reloadPage(didReload);
    3040            }
     
    3242            function didReload()
    3343            {
    34                 InspectorTest.showScriptSource("source-frame-count.html", didShowScriptSourceAgain);
     44                InspectorTest.showScriptSource("script3.js", didShowScriptSourceAgain);
    3545            }
    3646
    3747            function didShowScriptSourceAgain()
    3848            {
    39                 InspectorTest.assertTrue(select[select.selectedIndex].text.indexOf("source-frame-count.html") !== -1);
    40                 // There should be maximum 2 source frames: first one is the first shown, second one is the last viewed ("source-frame-count.html").
    41                 InspectorTest.assertEquals(true, sourceFrameCount <= 2, "too many source frames created after page reload");
     49                InspectorTest.assertTrue(panel._editorContainer.visibleView._uiSourceCode.url.indexOf("script3.js") !== -1);
     50                // There should be maximum 3 source frames shown:
     51                //  - first one is the first shown (first tab added)
     52                //  - second one is the last viewed ("script2.js")
     53                //  - third one is explicitly selected script3.js.
     54                InspectorTest.assertEquals(true, sourceFrameCount <= 3, "too many source frames created after page reload");
    4255                next();
    4356            }
  • trunk/Source/WebCore/ChangeLog

    r107707 r107708  
     12012-02-14  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Make ScriptsNavigator default file selector.
     4        https://bugs.webkit.org/show_bug.cgi?id=78349
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Moved ScriptsNavigator out of experiments.
     9        Introduced new setting "useScriptsNavigator" with true as default value.
     10        Updated scripts panel tests related to file selector.
     11
     12        Tests: inspector/debugger/scripts-combobox-file-selector-history.html
     13               inspector/debugger/scripts-file-selector.html
     14
     15        * English.lproj/localizedStrings.js:
     16        * inspector/front-end/DebuggerPresentationModel.js:
     17        (WebInspector.DebuggerPresentationModel.prototype.uiSourceCodes):
     18        * inspector/front-end/ScriptsNavigator.js:
     19        (WebInspector.ScriptsNavigator.prototype._removeUISourceCode):
     20        (WebInspector.ScriptsNavigator.prototype._showScriptFoldersSettingChanged):
     21        * inspector/front-end/ScriptsPanel.js:
     22        (WebInspector.ScriptsPanel.prototype._uiSourceCodeAdded):
     23        (WebInspector.ScriptsPanel.prototype._addUISourceCode):
     24        (WebInspector.ScriptsPanel.prototype._updateExecutionLine):
     25        * inspector/front-end/Settings.js:
     26        (WebInspector.ExperimentsSettings):
     27        * inspector/front-end/SettingsScreen.js:
     28        (WebInspector.SettingsScreen):
     29
    1302012-02-14  No'am Rosenthal  <noam.rosenthal@nokia.com>
    231
  • trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js

    r107615 r107708  
    184184        var result = [];
    185185        for (var i = 0; i < this._rawSourceCodes.length; ++i) {
     186            if (!this._rawSourceCodes[i].sourceMapping)
     187                continue;
    186188            var uiSourceCodeList = this._rawSourceCodes[i].sourceMapping.uiSourceCodeList();
    187189            for (var j = 0; j < uiSourceCodeList.length; ++j)
  • trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js

    r107615 r107708  
    218218            treeElement = parent;
    219219        }
     220        this._scriptTreeElementsByUISourceCode.remove(uiSourceCode);
    220221    },
    221222   
     
    228229            this.addUISourceCode(uiSourceCodes[i]);
    229230       
    230         this.revealUISourceCode(this._lastSelectedUISourceCode);
     231        if (this._lastSelectedUISourceCode)
     232            this.revealUISourceCode(this._lastSelectedUISourceCode);
    231233    },
    232234   
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r107615 r107708  
    6161    this.splitView.installResizer(this.debugSidebarResizeWidgetElement);
    6262
    63     if (WebInspector.experimentsSettings.useScriptsNavigator.isEnabled()) {
     63    WebInspector.settings.useScriptsNavigator = WebInspector.settings.createSetting("useScriptsNavigator", true);
     64    if (WebInspector.settings.useScriptsNavigator.get()) {
    6465        const initialNavigatorWidth = 225;
    6566        const minimalViewsContainerWidthPercent = 50;
     
    259260            return;
    260261        }
     262
     263        this._addUISourceCode(uiSourceCode);
     264    },
     265
     266    /**
     267     * @param {WebInspector.UISourceCode} uiSourceCode
     268     */
     269    _addUISourceCode: function(uiSourceCode)
     270    {
    261271        this._fileSelector.addUISourceCode(uiSourceCode);
    262272        this._editorContainer.uiSourceCodeAdded(uiSourceCode);
     
    605615
    606616        // Anonymous scripts are not added to files select by default.
    607         this._fileSelector.addUISourceCode(uiLocation.uiSourceCode);
     617        this._addUISourceCode(uiLocation.uiSourceCode);
    608618
    609619        var sourceFrame = this._showFile(uiLocation.uiSourceCode);
  • trunk/Source/WebCore/inspector/front-end/Settings.js

    r107615 r107708  
    169169   
    170170    // Add currently running experiments here.
    171     // FIXME: Move out from experiments once navigator is production-ready.
    172     this.useScriptsNavigator = this._createExperiment("useScriptsNavigator", "Use file navigator and tabbed editor container in scripts panel");
    173171    this.sourceFrameAlwaysEditable = this._createExperiment("sourceFrameAlwaysEditable", "Make resources always editable");
    174172    this.freeFlowDOMEditing = this._createExperiment("freeFlowDOMEditing", "Enable free flow DOM editing");
  • trunk/Source/WebCore/inspector/front-end/SettingsScreen.js

    r107615 r107708  
    7373
    7474    p = this._appendSection(WebInspector.UIString("Scripts"), true);
     75    p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Use file navigator and tabbed editor container in scripts panel"), WebInspector.settings.useScriptsNavigator));
    7576    p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show script folders"), WebInspector.settings.showScriptFolders));
    7677    p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts));
  • trunk/Source/WebKit/chromium/ChangeLog

    r107700 r107708  
     12012-02-14  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Make ScriptsNavigator default file selector.
     4        https://bugs.webkit.org/show_bug.cgi?id=78349
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * src/js/Tests.js:
     9        (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkNoDuplicates):
     10        (.TestSuite.prototype.uiSourceCodesToString_):
     11        (.TestSuite.prototype.nonAnonymousUISourceCodes_):
     12        (.TestSuite.prototype._scriptsAreParsed):
     13        (.TestSuite.prototype._waitUntilScriptsAreParsed.waitForAllScripts):
     14        (.TestSuite.prototype._waitUntilScriptsAreParsed):
     15
    1162012-02-14  Hayato Ito  <hayato@chromium.org>
    217
  • trunk/Source/WebKit/chromium/src/js/Tests.js

    r105846 r107708  
    309309    this.showPanel("scripts");
    310310
    311 
    312311    function switchToElementsTab() {
    313312        test.showPanel("elements");
     
    321320
    322321    function checkScriptsPanel() {
    323         test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view.");
    324322        test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Some scripts are missing.");
    325323        checkNoDuplicates();
     
    328326
    329327    function checkNoDuplicates() {
    330         var scriptSelect = document.getElementById("scripts-files");
    331         var options = scriptSelect.options;
    332         for (var i = 0; i < options.length; i++) {
    333             var scriptName = options[i].text;
    334             for (var j = i + 1; j < options.length; j++)
    335                 test.assertTrue(scriptName !== options[j].text, "Found script duplicates: " + test.optionsToString_(options));
     328        var uiSourceCodes = test.nonAnonymousUISourceCodes_();
     329        for (var i = 0; i < uiSourceCodes.length; i++) {
     330            var scriptName = uiSourceCodes[i].fileName;
     331            for (var j = i + 1; j < uiSourceCodes.length; j++)
     332                test.assertTrue(scriptName !== uiSourceCodes[j].fileName, "Found script duplicates: " + test.uiSourceCodesToString_(uiSourceCodes));
    336333        }
    337334    }
     
    585582
    586583/**
    587  * Serializes options collection to string.
    588  * @param {HTMLOptionsCollection} options
     584 * Serializes array of uiSourceCodes to string.
     585 * @param {Array.<WebInspectorUISourceCode>} uiSourceCodes
    589586 * @return {string}
    590587 */
    591 TestSuite.prototype.optionsToString_ = function(options)
     588TestSuite.prototype.uiSourceCodesToString_ = function(uiSourceCodes)
    592589{
    593590    var names = [];
    594     for (var i = 0; i < options.length; i++)
    595         names.push('"' + options[i].text + '"');
     591    for (var i = 0; i < uiSourceCodes.length; i++)
     592        names.push('"' + uiSourceCodes[i].fileName + '"');
    596593    return names.join(",");
    597594};
     
    599596
    600597/**
    601  * Ensures that main HTML resource is selected in Scripts panel and that its
    602  * source frame is setup. Invokes the callback when the condition is satisfied.
    603  * @param {HTMLOptionsCollection} options
    604  * @param {function(WebInspector.SourceView,string)} callback
    605  */
    606 TestSuite.prototype.showMainPageScriptSource_ = function(scriptName, callback)
    607 {
    608     var test = this;
    609 
    610     var scriptSelect = document.getElementById("scripts-files");
    611     var options = scriptSelect.options;
    612 
    613     test.assertTrue(options.length, "Scripts list is empty");
    614 
    615     // Select page's script if it's not current option.
    616     var scriptResource;
    617     if (options[scriptSelect.selectedIndex].text === scriptName)
    618         scriptResource = options[scriptSelect.selectedIndex].representedObject;
    619     else {
    620         var pageScriptIndex = -1;
    621         for (var i = 0; i < options.length; i++) {
    622             if (options[i].text === scriptName) {
    623                 pageScriptIndex = i;
    624                 break;
    625             }
    626         }
    627         test.assertTrue(-1 !== pageScriptIndex, "Script with url " + scriptName + " not found among " + test.optionsToString_(options));
    628         scriptResource = options[pageScriptIndex].representedObject;
    629 
    630         // Current panel is "Scripts".
    631         WebInspector.inspectorView.currentPanel()._showScriptOrResource(scriptResource);
    632         test.assertEquals(pageScriptIndex, scriptSelect.selectedIndex, "Unexpected selected option index.");
    633     }
    634 
    635     test.assertTrue(scriptResource instanceof WebInspector.Resource,
    636                     "Unexpected resource class.");
    637     test.assertTrue(!!scriptResource.url, "Resource URL is null.");
    638     test.assertTrue(scriptResource.url.search(scriptName + "$") !== -1, "Main HTML resource should be selected.");
    639 
    640     var scriptsPanel = WebInspector.panels.scripts;
    641 
    642     var view = scriptsPanel.visibleView;
    643     test.assertTrue(view instanceof WebInspector.SourceView);
    644 
    645     if (!view.sourceFrame._loaded) {
    646         test.addSniffer(view, "_sourceFrameSetupFinished", function(event) {
    647             callback(view, scriptResource.url);
    648         });
    649     } else
    650         callback(view, scriptResource.url);
     598 * Returns all loaded non anonymous uiSourceCodes.
     599 * @return {Array.<WebInspectorUISourceCode>}
     600 */
     601TestSuite.prototype.nonAnonymousUISourceCodes_ = function()
     602{
     603    function filterOutAnonymous(uiSourceCode)
     604    {
     605        return !!uiSourceCode.url;
     606    }
     607
     608    var uiSourceCodes = WebInspector.panels.scripts._presentationModel.uiSourceCodes();
     609    return uiSourceCodes.filter(filterOutAnonymous);
    651610};
    652611
     
    681640TestSuite.prototype._scriptsAreParsed = function(expected)
    682641{
    683     var scriptSelect = document.getElementById("scripts-files");
    684     var options = scriptSelect.options;
    685 
     642    var uiSourceCodes = this.nonAnonymousUISourceCodes_();
    686643    // Check that at least all the expected scripts are present.
    687644    var missing = expected.slice(0);
    688     for (var i = 0 ; i < options.length; i++) {
    689         for (var j = 0; j < missing.length; j++) {
    690             if (options[i].text.search(missing[j]) !== -1) {
     645    for (var i = 0; i < uiSourceCodes.length; ++i) {
     646        for (var j = 0; j < missing.length; ++j) {
     647            if (uiSourceCodes[i].fileName.search(missing[j]) !== -1) {
    691648                missing.splice(j, 1);
    692649                break;
     
    745702            callback();
    746703        else
    747             test.addSniffer(WebInspector.panels.scripts, "_uiSourceCodeAdded", waitForAllScripts);
     704            test.addSniffer(WebInspector.panels.scripts, "_addUISourceCode", waitForAllScripts);
    748705    }
    749706
Note: See TracChangeset for help on using the changeset viewer.