Changeset 55241 in webkit


Ignore:
Timestamp:
Feb 25, 2010 9:55:45 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-02-25 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Dimitri Glazkov.

Web Inspector: make script lines count calculation lazy.

https://bugs.webkit.org/show_bug.cgi?id=35392

  • inspector/front-end/Script.js: (WebInspector.Script): (WebInspector.Script.prototype.get linesCount):
  • inspector/front-end/ScriptsPanel.js:
  • inspector/front-end/SourceView.js: (WebInspector.SourceView.prototype._addBreakpoint):
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55240 r55241  
     12010-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
    1162010-02-25  James Choi  <jchoi42@pha.jhu.edu>
    217
  • trunk/WebCore/inspector/front-end/Script.js

    r55231 r55241  
    3333    this.errorMessage = errorMessage;
    3434
    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 
    4235    // if no URL, look for "//@ sourceURL=" decorator
    4336    // note that this sourceURL comment decorator is behavior that FireBug added
     
    5548
    5649WebInspector.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    }
    5761}
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r55231 r55241  
    678678        option.url = displayName;
    679679        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);
    681681
    682682        function optionCompare(a, b)
  • trunk/WebCore/inspector/front-end/SourceView.js

    r55231 r55241  
    9393    {
    9494        var sourceID = null;
     95        var closestStartingLine = 0;
    9596        var scripts = this.resource.scripts;
    9697        for (var i = 0; i < scripts.length; ++i) {
    9798            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;
    99101                sourceID = script.sourceID;
    100                 break;
    101102            }
    102103        }
  • trunk/WebKit/chromium/ChangeLog

    r55239 r55241  
     12010-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
    1172010-02-24  Darin Fisher  <darin@chromium.org>
    218
  • trunk/WebKit/chromium/src/js/Tests.js

    r54592 r55241  
    296296            if (!resource || !resource.url)
    297297                return;
    298             if (resource.url.search("image.html$") !== -1) {
     298            if (resource.url.search("image.html") !== -1) {
    299299              var expectedLength = 87;
    300300              test.assertTrue(
     
    471471    var test = this;
    472472    // There should be at least main page script.
    473     this._waitUntilScriptsAreParsed(["debugger_test_page.html$"],
     473    this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
    474474        function() {
    475475            test.releaseControl();
     
    503503        for (var id in parsed) {
    504504            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) {
    506506                checkScriptsPanel();
    507507                return;
     
    513513    function checkScriptsPanel() {
    514514        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");
    516516        test.releaseControl();
    517517    }
     
    531531
    532532    test._waitUntilScriptsAreParsed(
    533         ["page_with_content_script.html$", "simple_content_script.js$"],
     533        ["page_with_content_script.html", "simple_content_script.js"],
    534534        function() {
    535535          test.releaseControl();
     
    569569    function checkScriptsPanel() {
    570570        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.");
    572572        checkNoDuplicates();
    573573        test.releaseControl();
     
    585585
    586586    test._waitUntilScriptsAreParsed(
    587         ["debugger_test_page.html$"],
     587        ["debugger_test_page.html"],
    588588        function() {
    589589            checkNoDuplicates();
     
    644644    }
    645645
    646     this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html$"]);
     646    this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]);
    647647
    648648    this._waitForScriptPause(
     
    914914    this.showPanel("scripts");
    915915    var test = this;
    916     this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html$"]);
     916    this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html"]);
    917917
    918918    this._waitForScriptPause(
     
    975975        // contains a syntax error.
    976976        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)
    978978                test.fail("Script with syntax error should not be in the list of parsed scripts.");
    979979        }
     
    11741174TestSuite.prototype._executeFunctionForStepTest = function()
    11751175{
    1176     this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html$", "debugger_step.js$"]);
     1176    this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]);
    11771177};
    11781178
     
    14381438    var test = this;
    14391439
    1440     this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html$"]);
     1440    this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]);
    14411441
    14421442    this._waitForScriptPause(
     
    15521552    var test = this;
    15531553
    1554     this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html$"]);
     1554    this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]);
    15551555
    15561556    this._waitForScriptPause(
Note: See TracChangeset for help on using the changeset viewer.