[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

podivilov at chromium.org podivilov at chromium.org
Sun Feb 20 22:57:34 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 32a1875c3598cda793a4df0f2e4c64386d26fd06
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 14 15:58:16 2011 +0000

    2011-01-14  Pavel Podivilov  <podivilov at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: breakpoint text snippet in breakpoints sidebar pane disappears after reload.
            https://bugs.webkit.org/show_bug.cgi?id=52215
    
            * inspector/front-end/Breakpoint.js:
            (WebInspector.Breakpoint):
            (WebInspector.Breakpoint.prototype.populateLabelElement):
            * inspector/front-end/Script.js:
            (WebInspector.Script.prototype.get linesCount):
            (WebInspector.Script.prototype.sourceLine):
            (WebInspector.Script.prototype.sourceLine.didRequestSource):
            (WebInspector.Script.prototype.set source):
            (WebInspector.Script.prototype.requestSource.didGetScriptSource):
            (WebInspector.Script.prototype.requestSource):
            * inspector/front-end/ScriptView.js:
            (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded.didRequestSource):
            (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded):
            * inspector/front-end/SourceFrame.js:
            (WebInspector.SourceFrame.prototype._addBreakpoint):
            * inspector/front-end/utilities.js:
            (String.prototype.findAll):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75795 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index c8ccd35..60ee13e 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -2,6 +2,31 @@
 
         Reviewed by Yury Semikhatsky.
 
+        Web Inspector: breakpoint text snippet in breakpoints sidebar pane disappears after reload.
+        https://bugs.webkit.org/show_bug.cgi?id=52215
+
+        * inspector/front-end/Breakpoint.js:
+        (WebInspector.Breakpoint):
+        (WebInspector.Breakpoint.prototype.populateLabelElement):
+        * inspector/front-end/Script.js:
+        (WebInspector.Script.prototype.get linesCount):
+        (WebInspector.Script.prototype.sourceLine):
+        (WebInspector.Script.prototype.sourceLine.didRequestSource):
+        (WebInspector.Script.prototype.set source):
+        (WebInspector.Script.prototype.requestSource.didGetScriptSource):
+        (WebInspector.Script.prototype.requestSource):
+        * inspector/front-end/ScriptView.js:
+        (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded.didRequestSource):
+        (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype._addBreakpoint):
+        * inspector/front-end/utilities.js:
+        (String.prototype.findAll):
+
+2011-01-14  Pavel Podivilov  <podivilov at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
         Web Inspector: provide script column offset to frontend.
         https://bugs.webkit.org/show_bug.cgi?id=52377
 
diff --git a/Source/WebCore/inspector/front-end/Breakpoint.js b/Source/WebCore/inspector/front-end/Breakpoint.js
index 0a888d2..e5e1768 100644
--- a/Source/WebCore/inspector/front-end/Breakpoint.js
+++ b/Source/WebCore/inspector/front-end/Breakpoint.js
@@ -37,7 +37,6 @@ WebInspector.Breakpoint = function(debuggerModel, breakpointId, sourceID, url, l
     this.sourceID = sourceID;
     this._enabled = enabled;
     this._condition = condition || "";
-    this._sourceText = "";
     this._hit = false;
     this._debuggerModel = debuggerModel;
 }
@@ -56,17 +55,6 @@ WebInspector.Breakpoint.prototype = {
         WebInspector.debuggerModel.setBreakpoint(this.sourceID, this.line, enabled, this.condition);
     },
 
-    get sourceText()
-    {
-        return this._sourceText;
-    },
-
-    set sourceText(text)
-    {
-        this._sourceText = text;
-        this.dispatchEventToListeners("label-changed");
-    },
-
     get condition()
     {
         return this._condition;
@@ -99,14 +87,19 @@ WebInspector.Breakpoint.prototype = {
 
     populateLabelElement: function(element)
     {
-        var displayName = this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)");
-        var labelElement = document.createTextNode(displayName + ":" + this.line);
-        element.appendChild(labelElement);
+        function didGetSourceLine(text)
+        {
+            var displayName = this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)");
+            var labelElement = document.createTextNode(displayName + ":" + this.line);
+            element.appendChild(labelElement);
 
-        var sourceTextElement = document.createElement("div");
-        sourceTextElement.textContent = this.sourceText;
-        sourceTextElement.className = "source-text monospace";
-        element.appendChild(sourceTextElement);
+            var sourceTextElement = document.createElement("div");
+            sourceTextElement.textContent = text;
+            sourceTextElement.className = "source-text monospace";
+            element.appendChild(sourceTextElement);
+        }
+        var script = this._debuggerModel.scriptForSourceID(this.sourceID);
+        script.sourceLine(this.line, didGetSourceLine.bind(this));
     },
 
     remove: function()
diff --git a/Source/WebCore/inspector/front-end/Script.js b/Source/WebCore/inspector/front-end/Script.js
index d5f0243..89b2121 100644
--- a/Source/WebCore/inspector/front-end/Script.js
+++ b/Source/WebCore/inspector/front-end/Script.js
@@ -68,15 +68,30 @@ WebInspector.Script.prototype = {
     {
         if (!this.source)
             return 0;
-        if (this._linesCount)
-            return this._linesCount;
-        this._linesCount = 0;
-        var lastIndex = this.source.indexOf("\n");
-        while (lastIndex !== -1) {
-            lastIndex = this.source.indexOf("\n", lastIndex + 1)
-            this._linesCount++;
+        if (!this._lineEndings)
+            this._lineEndings = this._source.findAll("\n");
+        return this._lineEndings.length + 1;
+    },
+
+    sourceLine: function(lineNumber, callback)
+    {
+        function extractSourceLine()
+        {
+            lineNumber -= this.startingLine;
+            callback(this._source.substring(this._lineEndings[lineNumber - 1], this._lineEndings[lineNumber]));
+        }
+
+        if (this._lineEndings) {
+            extractSourceLine.call(this);
+            return;
+        }
+
+        function didRequestSource()
+        {
+            this._lineEndings = this._source.findAll("\n");
+            extractSourceLine.call(this);
         }
-        return this._linesCount;
+        this.requestSource(didRequestSource.bind(this));
     },
 
     get source()
@@ -87,5 +102,20 @@ WebInspector.Script.prototype = {
     set source(source)
     {
         this._source = source;
+    },
+
+    requestSource: function(callback)
+    {
+        if (this._source) {
+            callback(this._source);
+            return;
+        }
+
+        function didGetScriptSource(source)
+        {
+            this._source = source;
+            callback(this._source);
+        }
+        InspectorBackend.getScriptSource(this.sourceID, didGetScriptSource.bind(this));
     }
 }
diff --git a/Source/WebCore/inspector/front-end/ScriptView.js b/Source/WebCore/inspector/front-end/ScriptView.js
index f135475..e441a50 100644
--- a/Source/WebCore/inspector/front-end/ScriptView.js
+++ b/Source/WebCore/inspector/front-end/ScriptView.js
@@ -53,22 +53,13 @@ WebInspector.ScriptView.prototype = {
 
         this.attach();
 
-        if (this.script.source)
-            this._sourceFrameSetupFinished();
-        else
-            InspectorBackend.getScriptSource(this.script.sourceID, this._didGetScriptSource.bind(this));
-    },
-
-    _didGetScriptSource: function(source)
-    {
-        this.script.source = source || WebInspector.UIString("<source is not available>");
-        this._sourceFrameSetupFinished();
-    },
-
-    _sourceFrameSetupFinished: function()
-    {
-        this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source));
-        this._sourceFrameSetup = true;
+        function didRequestSource(source)
+        {
+            source = source || WebInspector.UIString("<source is not available>");
+            this.sourceFrame.setContent("text/javascript", this._prependWhitespace(source));
+            this._sourceFrameSetup = true;
+        }
+        this.script.requestSource(didRequestSource.bind(this));
     },
 
     _prependWhitespace: function(content) {
diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js
index 42c98f5..3d1c926 100644
--- a/Source/WebCore/inspector/front-end/SourceFrame.js
+++ b/Source/WebCore/inspector/front-end/SourceFrame.js
@@ -432,7 +432,6 @@ WebInspector.SourceFrame.prototype = {
         breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
         breakpoint.addEventListener("removed", this._breakpointRemoved, this);
 
-        breakpoint.sourceText = this._textModel.line(breakpoint.line - 1);
         this._setBreakpointDecoration(breakpoint.line, breakpoint.enabled, !!breakpoint.condition);
     },
 
diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js
index 53247e4..4320ba8 100644
--- a/Source/WebCore/inspector/front-end/utilities.js
+++ b/Source/WebCore/inspector/front-end/utilities.js
@@ -388,6 +388,17 @@ String.prototype.hasSubstring = function(string, caseInsensitive)
     return this.match(new RegExp(string.escapeForRegExp(), "i"));
 }
 
+String.prototype.findAll = function(string)
+{
+    var matches = [];
+    var i = this.indexOf(string);
+    while (i !== -1) {
+        matches.push(i);
+        i = this.indexOf(string, i + string.length);
+    }
+    return matches;
+}
+
 String.prototype.asParsedURL = function()
 {
     // RegExp groups:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list