Changeset 55241 in webkit
- Timestamp:
- Feb 25, 2010 9:55:45 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r55240 r55241 1 2010-02-25 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Web Inspector: make script lines count calculation lazy. 6 7 https://bugs.webkit.org/show_bug.cgi?id=35392 8 9 * inspector/front-end/Script.js: 10 (WebInspector.Script): 11 (WebInspector.Script.prototype.get linesCount): 12 * inspector/front-end/ScriptsPanel.js: 13 * inspector/front-end/SourceView.js: 14 (WebInspector.SourceView.prototype._addBreakpoint): 15 1 16 2010-02-25 James Choi <jchoi42@pha.jhu.edu> 2 17 -
trunk/WebCore/inspector/front-end/Script.js
r55231 r55241 33 33 this.errorMessage = errorMessage; 34 34 35 this.linesCount = 0;36 var lastIndex = source.indexOf("\n");37 while (lastIndex !== -1) {38 lastIndex = source.indexOf("\n", lastIndex + 1)39 this.linesCount++;40 }41 42 35 // if no URL, look for "//@ sourceURL=" decorator 43 36 // note that this sourceURL comment decorator is behavior that FireBug added … … 55 48 56 49 WebInspector.Script.prototype = { 50 get linesCount() 51 { 52 if (!this.source) 53 return 0; 54 this._linesCount = 0; 55 var lastIndex = this.source.indexOf("\n"); 56 while (lastIndex !== -1) { 57 lastIndex = this.source.indexOf("\n", lastIndex + 1) 58 this._linesCount++; 59 } 60 } 57 61 } -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r55231 r55241 678 678 option.url = displayName; 679 679 option.startingLine = script.startingLine; 680 option.text = script.resource ? displayName : String.sprintf("%s (%d - %d)", displayName, script.startingLine, script.startingLine + script.linesCount);680 option.text = script.resource ? displayName : String.sprintf("%s:%d", displayName, script.startingLine); 681 681 682 682 function optionCompare(a, b) -
trunk/WebCore/inspector/front-end/SourceView.js
r55231 r55241 93 93 { 94 94 var sourceID = null; 95 var closestStartingLine = 0; 95 96 var scripts = this.resource.scripts; 96 97 for (var i = 0; i < scripts.length; ++i) { 97 98 var script = scripts[i]; 98 if (script.startingLine <= line && script.startingLine + script.linesCount > line) { 99 if (script.startingLine <= line && script.startingLine >= closestStartingLine) { 100 closestStartingLine = script.startingLine; 99 101 sourceID = script.sourceID; 100 break;101 102 } 102 103 } -
trunk/WebKit/chromium/ChangeLog
r55239 r55241 1 2010-02-25 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Web Inspector: make script lines count calculation lazy. 6 7 https://bugs.webkit.org/show_bug.cgi?id=35392 8 9 * src/js/Tests.js: 10 (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.waitUntilScriptIsParsed): 11 (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh.checkScriptsPanel): 12 (.TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh): 13 (.TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch.checkScriptsPanel): 14 (.TestSuite.prototype.testAutoContinueOnSyntaxError.checkScriptsList): 15 (.TestSuite.prototype._executeFunctionForStepTest): 16 1 17 2010-02-24 Darin Fisher <darin@chromium.org> 2 18 -
trunk/WebKit/chromium/src/js/Tests.js
r54592 r55241 296 296 if (!resource || !resource.url) 297 297 return; 298 if (resource.url.search("image.html $") !== -1) {298 if (resource.url.search("image.html") !== -1) { 299 299 var expectedLength = 87; 300 300 test.assertTrue( … … 471 471 var test = this; 472 472 // There should be at least main page script. 473 this._waitUntilScriptsAreParsed(["debugger_test_page.html $"],473 this._waitUntilScriptsAreParsed(["debugger_test_page.html"], 474 474 function() { 475 475 test.releaseControl(); … … 503 503 for (var id in parsed) { 504 504 var url = parsed[id].getUrl(); 505 if (url && url.search("debugger_test_page.html $") !== -1) {505 if (url && url.search("debugger_test_page.html") !== -1) { 506 506 checkScriptsPanel(); 507 507 return; … … 513 513 function checkScriptsPanel() { 514 514 test.showPanel("scripts"); 515 test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html $"]), "Inspected script not found in the scripts list");515 test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Inspected script not found in the scripts list"); 516 516 test.releaseControl(); 517 517 } … … 531 531 532 532 test._waitUntilScriptsAreParsed( 533 ["page_with_content_script.html $", "simple_content_script.js$"],533 ["page_with_content_script.html", "simple_content_script.js"], 534 534 function() { 535 535 test.releaseControl(); … … 569 569 function checkScriptsPanel() { 570 570 test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view."); 571 test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html $"]), "Some scripts are missing.");571 test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Some scripts are missing."); 572 572 checkNoDuplicates(); 573 573 test.releaseControl(); … … 585 585 586 586 test._waitUntilScriptsAreParsed( 587 ["debugger_test_page.html $"],587 ["debugger_test_page.html"], 588 588 function() { 589 589 checkNoDuplicates(); … … 644 644 } 645 645 646 this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html $"]);646 this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]); 647 647 648 648 this._waitForScriptPause( … … 914 914 this.showPanel("scripts"); 915 915 var test = this; 916 this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html $"]);916 this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html"]); 917 917 918 918 this._waitForScriptPause( … … 975 975 // contains a syntax error. 976 976 for (var i = 0 ; i < options.length; i++) { 977 if (options[i].text.search("script_syntax_error.html $") !== -1)977 if (options[i].text.search("script_syntax_error.html") !== -1) 978 978 test.fail("Script with syntax error should not be in the list of parsed scripts."); 979 979 } … … 1174 1174 TestSuite.prototype._executeFunctionForStepTest = function() 1175 1175 { 1176 this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html $", "debugger_step.js$"]);1176 this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]); 1177 1177 }; 1178 1178 … … 1438 1438 var test = this; 1439 1439 1440 this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html $"]);1440 this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]); 1441 1441 1442 1442 this._waitForScriptPause( … … 1552 1552 var test = this; 1553 1553 1554 this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html $"]);1554 this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]); 1555 1555 1556 1556 this._waitForScriptPause(
Note: See TracChangeset
for help on using the changeset viewer.