Changeset 107708 in webkit
- Timestamp:
- Feb 14, 2012 4:55:56 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 16 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r107705 r107708 1 2012-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 1 21 2012-02-14 Alexander Pavlov <apavlov@chromium.org> 2 22 -
trunk/LayoutTests/http/tests/inspector/debugger-test.js
r107615 r107708 154 154 }; 155 155 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; 156 InspectorTest.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; 164 163 if (sourceFrame.loaded) 165 164 callback(sourceFrame); … … 169 168 } 170 169 } 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 173 InspectorTest.showScriptSource = function(scriptName, callback) 174 { 175 InspectorTest.showScriptSourceOnScriptsPanel(WebInspector.panels.scripts, scriptName, callback) 176 }; 177 178 InspectorTest.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 199 InspectorTest.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 } 172 211 }; 173 212 -
trunk/LayoutTests/inspector/debugger/scripts-file-selector-expected.txt
r107707 r107708 1 Tests that scripts panel UI elements work as intended.1 Tests scripts panel file selectors. 2 2 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 3 Dumping ComboBoxFileSelector: 19 4 ?a=b(?a=b) 20 5 very_looooooooo...oooooooong_url(very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url) … … 33 18 contentScript.js?a=2(<root>/foo/bar/contentScript.js?a=2) 34 19 contentScript2.js?a=1(<root>/foo/bar/contentScript2.js?a=1) 20 Dumping 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 32 Dumping 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 35 38 36 Running: testSourceReplaced37 Source requested for foo.js38 Source requested for source2.js39 Source requested for source1.js40 Source requested for compiled.js41 -
trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt
r107615 r107708 3 3 4 4 Running: testInitialLoad 5 Dumping ScriptsNavigator 'Scripts' tab: 6 bar.js 7 baz.js 8 foo.js 9 Dumping ScriptsNavigator 'Content scripts' tab: 10 Source requested for baz.js 11 12 Running: testInitialLoadWithComboBoxFileSelector 5 13 Source requested for foo.js 6 14 Dump files select: … … 10 18 Source requested for baz.js 11 19 12 Running: testHistory13 Source requested for index.html14 Source requested for script1.js15 Source requested for script2.js16 Source requested for script3.js17 18 Running: testFilesSelect19 ?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/bar25 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/baz29 script.js(<root>/foo/baz/script.js)30 — Content scripts —31 LayoutTests/inspector/debugger/foo/bar32 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 36 20 Running: testSourceReplaced 37 Source requested for foo.js 21 Dumping ScriptsNavigator 'Scripts' tab: 22 compiled.js 23 foo.js 24 Dumping ScriptsNavigator 'Content scripts' tab: 25 Dumping ScriptsNavigator 'Scripts' tab: 26 foo.js 27 source1.js 28 source2.js 29 Dumping ScriptsNavigator 'Content scripts' tab: 38 30 Source requested for source2.js 39 31 Source requested for source1.js 40 32 Source requested for compiled.js 33 Dumping ScriptsNavigator 'Scripts' tab: 34 compiled.js 35 foo.js 36 Dumping ScriptsNavigator 'Content scripts' tab: 41 37 38 Running: testSourceReplacedWithComboBoxFileSelector 39 Source requested for foo.js 40 Dumping ComboBoxFileSelector: 41 compiled.js(compiled.js) 42 foo.js(foo.js) 43 Dumping ComboBoxFileSelector: 44 foo.js(foo.js) 45 source1.js(source1.js) 46 source2.js(source2.js) 47 Source requested for source2.js 48 Source requested for source1.js 49 Source requested for compiled.js 50 Dumping ComboBoxFileSelector: 51 compiled.js(compiled.js) 52 foo.js(foo.js) 53 -
trunk/LayoutTests/inspector/debugger/scripts-panel.html
r107615 r107708 2 2 <head> 3 3 <script src="../../http/tests/inspector/inspector-test.js"></script> 4 <script src="../../http/tests/inspector/debugger-test.js"></script> 4 5 5 6 <script> … … 10 11 WebInspector._isMac = false; 11 12 13 var uiSourceCodes; 12 14 function createDebuggerPresentationModelMock() 13 15 { … … 16 18 model.messagesForUISourceCode = function() { return []; }; 17 19 model.canEditScriptSource = function() { return true; }; 20 uiSourceCodes = []; 21 model.uiSourceCodes = function() { return uiSourceCodes.slice(); }; 18 22 return model; 19 23 } … … 26 30 callback(""); 27 31 }; 32 uiSourceCodes.push(uiSourceCode); 28 33 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 }41 34 } 42 35 … … 46 39 var model = createDebuggerPresentationModelMock(); 47 40 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); 48 63 panel.show(); 49 64 … … 69 84 }, 70 85 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 167 86 function testSourceReplaced(next) 168 87 { … … 175 94 panel._uiSourceCodeAdded({ data: compiledSourceCode }); 176 95 177 InspectorTest. assertEquals(2, panel._fileSelector._filesSelectElement.length);96 InspectorTest.dumpScriptsNavigator(panel._navigator); 178 97 179 98 // Plug compiler source mapping. … … 182 101 panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [compiledSourceCode], uiSourceCodeList: [source1SourceCode, source2SourceCode] }}); 183 102 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); 187 105 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 } 191 109 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 } 194 153 } 195 154 ]); -
trunk/LayoutTests/inspector/debugger/scripts-sorting-expected.txt
r107615 r107708 1 1 Tests scripts sorting in the scripts panel. 2 2 3 Debugger was enabled.4 3 5 4 WebInspector.settings.showScriptFolders = true 6 *Non*URL*path 5 Dumping ComboBoxFileSelector: 6 *Non*URL*path(*Non*URL*path) 7 7 — bar.com — 8 8 /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) 11 11 — 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) 29 extension-name 30 bar.js(extension-schema://extension-name/bar.js) 31 extension-name/folder 32 baz.js(extension-schema://extension-name/folder/baz.js) 33 Dumping 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 12 49 block.js?block=foo 13 50 ga.js … … 15 52 lenta.ban?pg=5309&ifr=1 16 53 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 55 Dumping ScriptsNavigator 'Content scripts' tab: 56 extension-name 57 folder 58 baz.js 30 59 bar.js 31 extension-name/folder 32 baz.js 60 *Non*URL*path 33 61 34 62 WebInspector.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 63 Dumping ComboBoxFileSelector: 64 *Non*URL*path(*Non*URL*path) 65 bar.js?file=bar/zzz.js(http://foo.com/foo/path/bar.js?file=bar/zzz.js) 66 bar.js?file=bar/zzz.js(http://bar.com/foo/path/bar.js?file=bar/zzz.js) 67 block.js?block=foo(http://foo.com/block.js?block=foo) 68 foo.js?file=bar/aaa.js(http://foo.com/foo/path/foo.js?file=bar/aaa.js) 69 foo.js?file=bar/aaa.js(http://bar.com/foo/path/foo.js?file=bar/aaa.js) 70 ga.js(http://foo.com/ga.js) 71 jquery-1.5.1.min.js(http://foo.com/i/js/jquery-1.5.1.min.js) 72 jquery.cookie.js(http://foo.com/i/js/jquery.cookie.js) 73 lenta.ban?pg=4883&ifr=1(http://foo.com/lenta.ban?pg=4883&ifr=1) 74 lenta.ban?pg=5309&ifr=1(http://foo.com/lenta.ban?pg=5309&ifr=1) 75 motor.js?1308927432(http://foo.com/_js/production/motor.js?1308927432) 76 top100.jcn?80674(http://foo.com/top100.jcn?80674) 77 xgemius.js(http://foo.com/i/xgemius.js) 49 78 — Content scripts — 50 *Non*URL*path 51 extension-name/bar.js 52 extension-name/folder/baz.js 79 *Non*URL*path(*Non*URL*path) 80 extension-name/bar.js(extension-schema://extension-name/bar.js) 81 extension-name/folder/baz.js(extension-schema://extension-name/folder/baz.js) 82 Dumping 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 97 Dumping ScriptsNavigator 'Content scripts' tab: 98 *Non*URL*path 99 bar.js 100 baz.js 53 101 54 102 WebInspector.settings.showScriptFolders = true 55 *Non*URL*path 103 Dumping ComboBoxFileSelector: 104 *Non*URL*path(*Non*URL*path) 56 105 — bar.com — 57 106 /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) 60 109 — 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) 127 extension-name 128 bar.js(extension-schema://extension-name/bar.js) 129 extension-name/folder 130 baz.js(extension-schema://extension-name/folder/baz.js) 131 Dumping 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 61 147 block.js?block=foo 62 148 ga.js … … 64 150 lenta.ban?pg=5309&ifr=1 65 151 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 153 Dumping ScriptsNavigator 'Content scripts' tab: 154 extension-name 155 folder 156 baz.js 79 157 bar.js 80 extension-name/folder 81 baz.js 82 Debugger was disabled. 158 *Non*URL*path 83 159 -
trunk/LayoutTests/inspector/debugger/scripts-sorting.html
r107615 r107708 10 10 WebInspector._isMac = false; 11 11 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(); 55 14 56 15 var nextId = 1; 57 58 function addOption(url, isContentScript) 16 function addUISourceCode(url, isContentScript) 59 17 { 60 18 var uiSourceCode = new WebInspector.UISourceCode(nextId++, url, null, null); 61 19 uiSourceCode.isContentScript = isContentScript; 62 WebInspector.panels.scripts._fileSelector._addOptionToFilesSelect(uiSourceCode); 20 navigatorFileSelector.addUISourceCode(uiSourceCode); 21 comboBoxFileSelector.addUISourceCode(uiSourceCode); 63 22 } 64 23 … … 67 26 InspectorTest.addResult(""); 68 27 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); 77 31 } 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(); 78 71 } 79 72 </script> -
trunk/LayoutTests/inspector/debugger/source-frame-count.html
r107615 r107708 18 18 var sourceFrameCount = 0; 19 19 20 InspectorTest.showScriptSource("source-frame-count.html", didShowScriptSource);20 InspectorTest.showScriptSource("source-frame-count.html", step2); 21 21 22 function didShowScriptSource()22 function step2() 23 23 { 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) 25 35 { 26 36 sourceFrameCount += 1; 27 37 } 28 InspectorTest.addSniffer( panel, "_createSourceFrame", didCreateSourceFrame, true);38 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "wasShown", didCreateSourceFrame, true); 29 39 InspectorTest.reloadPage(didReload); 30 40 } … … 32 42 function didReload() 33 43 { 34 InspectorTest.showScriptSource("s ource-frame-count.html", didShowScriptSourceAgain);44 InspectorTest.showScriptSource("script3.js", didShowScriptSourceAgain); 35 45 } 36 46 37 47 function didShowScriptSourceAgain() 38 48 { 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"); 42 55 next(); 43 56 } -
trunk/Source/WebCore/ChangeLog
r107707 r107708 1 2012-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 1 30 2012-02-14 No'am Rosenthal <noam.rosenthal@nokia.com> 2 31 -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r107615 r107708 184 184 var result = []; 185 185 for (var i = 0; i < this._rawSourceCodes.length; ++i) { 186 if (!this._rawSourceCodes[i].sourceMapping) 187 continue; 186 188 var uiSourceCodeList = this._rawSourceCodes[i].sourceMapping.uiSourceCodeList(); 187 189 for (var j = 0; j < uiSourceCodeList.length; ++j) -
trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js
r107615 r107708 218 218 treeElement = parent; 219 219 } 220 this._scriptTreeElementsByUISourceCode.remove(uiSourceCode); 220 221 }, 221 222 … … 228 229 this.addUISourceCode(uiSourceCodes[i]); 229 230 230 this.revealUISourceCode(this._lastSelectedUISourceCode); 231 if (this._lastSelectedUISourceCode) 232 this.revealUISourceCode(this._lastSelectedUISourceCode); 231 233 }, 232 234 -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r107615 r107708 61 61 this.splitView.installResizer(this.debugSidebarResizeWidgetElement); 62 62 63 if (WebInspector.experimentsSettings.useScriptsNavigator.isEnabled()) { 63 WebInspector.settings.useScriptsNavigator = WebInspector.settings.createSetting("useScriptsNavigator", true); 64 if (WebInspector.settings.useScriptsNavigator.get()) { 64 65 const initialNavigatorWidth = 225; 65 66 const minimalViewsContainerWidthPercent = 50; … … 259 260 return; 260 261 } 262 263 this._addUISourceCode(uiSourceCode); 264 }, 265 266 /** 267 * @param {WebInspector.UISourceCode} uiSourceCode 268 */ 269 _addUISourceCode: function(uiSourceCode) 270 { 261 271 this._fileSelector.addUISourceCode(uiSourceCode); 262 272 this._editorContainer.uiSourceCodeAdded(uiSourceCode); … … 605 615 606 616 // Anonymous scripts are not added to files select by default. 607 this._ fileSelector.addUISourceCode(uiLocation.uiSourceCode);617 this._addUISourceCode(uiLocation.uiSourceCode); 608 618 609 619 var sourceFrame = this._showFile(uiLocation.uiSourceCode); -
trunk/Source/WebCore/inspector/front-end/Settings.js
r107615 r107708 169 169 170 170 // 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");173 171 this.sourceFrameAlwaysEditable = this._createExperiment("sourceFrameAlwaysEditable", "Make resources always editable"); 174 172 this.freeFlowDOMEditing = this._createExperiment("freeFlowDOMEditing", "Enable free flow DOM editing"); -
trunk/Source/WebCore/inspector/front-end/SettingsScreen.js
r107615 r107708 73 73 74 74 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)); 75 76 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show script folders"), WebInspector.settings.showScriptFolders)); 76 77 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts)); -
trunk/Source/WebKit/chromium/ChangeLog
r107700 r107708 1 2012-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 1 16 2012-02-14 Hayato Ito <hayato@chromium.org> 2 17 -
trunk/Source/WebKit/chromium/src/js/Tests.js
r105846 r107708 309 309 this.showPanel("scripts"); 310 310 311 312 311 function switchToElementsTab() { 313 312 test.showPanel("elements"); … … 321 320 322 321 function checkScriptsPanel() { 323 test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view.");324 322 test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Some scripts are missing."); 325 323 checkNoDuplicates(); … … 328 326 329 327 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)); 336 333 } 337 334 } … … 585 582 586 583 /** 587 * Serializes options collectionto string.588 * @param { HTMLOptionsCollection} options584 * Serializes array of uiSourceCodes to string. 585 * @param {Array.<WebInspectorUISourceCode>} uiSourceCodes 589 586 * @return {string} 590 587 */ 591 TestSuite.prototype. optionsToString_ = function(options)588 TestSuite.prototype.uiSourceCodesToString_ = function(uiSourceCodes) 592 589 { 593 590 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 + '"'); 596 593 return names.join(","); 597 594 }; … … 599 596 600 597 /** 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 */ 601 TestSuite.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); 651 610 }; 652 611 … … 681 640 TestSuite.prototype._scriptsAreParsed = function(expected) 682 641 { 683 var scriptSelect = document.getElementById("scripts-files"); 684 var options = scriptSelect.options; 685 642 var uiSourceCodes = this.nonAnonymousUISourceCodes_(); 686 643 // Check that at least all the expected scripts are present. 687 644 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) { 691 648 missing.splice(j, 1); 692 649 break; … … 745 702 callback(); 746 703 else 747 test.addSniffer(WebInspector.panels.scripts, "_ uiSourceCodeAdded", waitForAllScripts);704 test.addSniffer(WebInspector.panels.scripts, "_addUISourceCode", waitForAllScripts); 748 705 } 749 706
Note: See TracChangeset
for help on using the changeset viewer.