Title: [104563] trunk/Source/WebCore
Revision
104563
Author
pfeld...@chromium.org
Date
2012-01-10 05:49:04 -0800 (Tue, 10 Jan 2012)

Log Message

Web Inspector: fix DebuggerPresentationModel::uiSourceCodes - do not iterate
over same raw source code multiple times.
https://bugs.webkit.org/show_bug.cgi?id=75953

Reviewed by Yury Semikhatsky.

* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel):
(WebInspector.DebuggerPresentationModel.prototype._bindScriptToRawSourceCode):
(WebInspector.DebuggerPresentationModel.prototype.uiSourceCodes):
(WebInspector.DebuggerPresentationModel.prototype.setFormatSource):
(WebInspector.DebuggerPresentationModel.prototype._consoleCleared):
(WebInspector.DebuggerPresentationModel.prototype._debuggerReset):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104562 => 104563)


--- trunk/Source/WebCore/ChangeLog	2012-01-10 13:46:54 UTC (rev 104562)
+++ trunk/Source/WebCore/ChangeLog	2012-01-10 13:49:04 UTC (rev 104563)
@@ -1,3 +1,19 @@
+2012-01-10  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: fix DebuggerPresentationModel::uiSourceCodes - do not iterate
+        over same raw source code multiple times.
+        https://bugs.webkit.org/show_bug.cgi?id=75953
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel):
+        (WebInspector.DebuggerPresentationModel.prototype._bindScriptToRawSourceCode):
+        (WebInspector.DebuggerPresentationModel.prototype.uiSourceCodes):
+        (WebInspector.DebuggerPresentationModel.prototype.setFormatSource):
+        (WebInspector.DebuggerPresentationModel.prototype._consoleCleared):
+        (WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
+
 2012-01-10  No'am Rosenthal  <noam.rosent...@nokia.com>
 
         [Qt] Enable CSS_FILTERS in Qt build

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (104562 => 104563)


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-01-10 13:46:54 UTC (rev 104562)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-01-10 13:49:04 UTC (rev 104563)
@@ -36,6 +36,7 @@
 {
     // FIXME: apply formatter from outside as a generic mapping.
     this._formatter = new WebInspector.ScriptFormatter();
+    this._rawSourceCodes = [];
     this._rawSourceCodeForScriptId = {};
     this._rawSourceCodeForURL = {};
     this._rawSourceCodeForDocumentURL = {};
@@ -143,7 +144,8 @@
         if (WebInspector.settings.sourceMapsEnabled.get() && script.sourceMapURL)
             compilerSourceMapping = new WebInspector.ClosureCompilerSourceMapping(script.sourceMapURL, script.sourceURL);
 
-        rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource, compilerSourceMapping);
+        var rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource, compilerSourceMapping);
+        this._rawSourceCodes.push(rawSourceCode);
         this._bindScriptToRawSourceCode(script, rawSourceCode);
 
         if (isInlineScript)
@@ -180,10 +182,10 @@
     uiSourceCodes: function()
     {
         var result = [];
-        for (var id in this._rawSourceCodeForScriptId) {
-            var uiSourceCodeList = this._rawSourceCodeForScriptId[id].sourceMapping.uiSourceCodeList();
-            for (var i = 0; i < uiSourceCodeList.length; ++i)
-                result.push(uiSourceCodeList[i]);
+        for (var i = 0; i < this._rawSourceCodes.length; ++i) {
+            var uiSourceCodeList = this._rawSourceCodes[i].sourceMapping.uiSourceCodeList();
+            for (var j = 0; j < uiSourceCodeList.length; ++j)
+                result.push(uiSourceCodeList[j]);
         }
         return result;
     },
@@ -335,8 +337,8 @@
 
         this._formatSource = formatSource;
         this._breakpointManager.reset();
-        for (var id in this._rawSourceCodeForScriptId)
-            this._rawSourceCodeForScriptId[id].setFormatted(this._formatSource);
+        for (var i = 0; i < this._rawSourceCodes.length; ++i)
+            this._rawSourceCodes[i].setFormatted(this._formatSource);
     },
 
     /**
@@ -376,8 +378,8 @@
 
     _consoleCleared: function()
     {
-        for (var id in this._rawSourceCodeForScriptId)
-            this._rawSourceCodeForScriptId[id].messages = [];
+        for (var i = 0; i < this._rawSourceCodes.length; ++i)
+            this._rawSourceCodes[i].messages = [];
         this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessagesCleared);
     },
 
@@ -655,15 +657,16 @@
 
     _debuggerReset: function()
     {
-        for (var id in this._rawSourceCodeForScriptId) {
-            var rawSourceCode = this._rawSourceCodeForScriptId[id];
+        for (var i = 0; i < this._rawSourceCodes.length; ++i) {
+            var rawSourceCode = this._rawSourceCodes[i];
             if (rawSourceCode.sourceMapping) {
                 var uiSourceCodeList = rawSourceCode.sourceMapping.uiSourceCodeList();
-                for (var i = 0; i < uiSourceCodeList.length; ++i)
-                    this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, uiSourceCodeList[i]);
+                for (var j = 0; j < uiSourceCodeList.length; ++j)
+                    this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, uiSourceCodeList[j]);
             }
             rawSourceCode.removeAllListeners();
         }
+        this._rawSourceCodes = [];
         this._rawSourceCodeForScriptId = {};
         this._rawSourceCodeForURL = {};
         this._rawSourceCodeForDocumentURL = {};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to