Title: [97732] trunk
Revision
97732
Author
podivi...@chromium.org
Date
2011-10-18 02:28:14 -0700 (Tue, 18 Oct 2011)

Log Message

Web Inspector: support displaying multiple sources per single script in ScriptsPanel.
https://bugs.webkit.org/show_bug.cgi?id=69847

Reviewed by Pavel Feldman.

Source/WebCore:

* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._removeSourceFrame):
(WebInspector.ScriptsPanel.prototype._uiSourceCodeReplaced):

LayoutTests:

* inspector/debugger/scripts-panel-expected.txt:
* inspector/debugger/scripts-panel.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97731 => 97732)


--- trunk/LayoutTests/ChangeLog	2011-10-18 09:18:18 UTC (rev 97731)
+++ trunk/LayoutTests/ChangeLog	2011-10-18 09:28:14 UTC (rev 97732)
@@ -1,3 +1,13 @@
+2011-10-11  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: support displaying multiple sources per single script in ScriptsPanel.
+        https://bugs.webkit.org/show_bug.cgi?id=69847
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/scripts-panel-expected.txt:
+        * inspector/debugger/scripts-panel.html:
+
 2011-10-18  Kentaro Hara  <hara...@chromium.org>
 
         Unreviewed, rolling out r97697.

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt (97731 => 97732)


--- trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2011-10-18 09:18:18 UTC (rev 97731)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2011-10-18 09:28:14 UTC (rev 97732)
@@ -35,5 +35,7 @@
 
 Running: testSourceReplaced
 Source requested for foo.js
-Source requested for bar.js
+Source requested for source2.js
+Source requested for source1.js
+Source requested for compiled.js
 

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (97731 => 97732)


--- trunk/LayoutTests/inspector/debugger/scripts-panel.html	2011-10-18 09:18:18 UTC (rev 97731)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html	2011-10-18 09:28:14 UTC (rev 97732)
@@ -17,7 +17,7 @@
         model.canEditScriptSource = function() { return true; };
         return model;
     }
-    function addUISouceCode(model, url)
+    function createUISouceCode(url)
     {
         var uiSourceCode = {
             url: url,
@@ -29,7 +29,6 @@
             messages: []
         };
         uiSourceCode.__proto__ = WebInspector.Object.prototype;
-        model.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, uiSourceCode);
         return uiSourceCode;
     }
 
@@ -51,9 +50,9 @@
             var model = createDebuggerPresentationModelMock();
             var panel = new WebInspector.ScriptsPanel(model);
 
-            addUISouceCode(model, "foo.js");
-            addUISouceCode(model, "bar.js");
-            addUISouceCode(model, "baz.js");
+            panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
+            panel._uiSourceCodeAdded({ data: createUISouceCode("bar.js") });
+            panel._uiSourceCodeAdded({ data: createUISouceCode("baz.js") });
 
             InspectorTest.addResult("Dump files select:");
             var select = panel._filesSelectElement;
@@ -78,7 +77,7 @@
 
             var files = ["index.html", "script1.js", "script2.js", "script3.js"];
             for (var i = 0; i < files.length; ++i)
-                addUISouceCode(model, files[i]);
+                panel._uiSourceCodeAdded({ data: createUISouceCode(files[i]) });
 
             function checkCurrentlySelectedFileName(fileName)
             {
@@ -165,10 +164,25 @@
             var model = createDebuggerPresentationModelMock();
             var panel = new WebInspector.ScriptsPanel(model);
 
-            addUISouceCode(model, "foo.js");
-            var uiSourceCode = addUISouceCode(model, "bar.js");
-            panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [uiSourceCode], uiSourceCodeList: [uiSourceCode] }});
-            showSourceFrame(panel, "bar.js");
+            panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
+            var compiledSourceCode = createUISouceCode("compiled.js");
+            panel._uiSourceCodeAdded({ data: compiledSourceCode });
+
+            InspectorTest.assertEquals(2, panel._filesSelectElement.length);
+
+            // Plug compiler source mapping.
+            var source1SourceCode = createUISouceCode("source1.js");
+            var source2SourceCode = createUISouceCode("source2.js");
+            panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [compiledSourceCode], uiSourceCodeList: [source1SourceCode, source2SourceCode] }});
+
+            InspectorTest.assertEquals(3, panel._filesSelectElement.length);
+            showSourceFrame(panel, "source2.js");
+            showSourceFrame(panel, "source1.js");
+
+            // Unplug compiler source mapping.
+            panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [source1SourceCode, source2SourceCode], uiSourceCodeList: [compiledSourceCode] }});
+            InspectorTest.assertEquals(2, panel._filesSelectElement.length);
+
             next();
         }
     ]);

Modified: trunk/Source/WebCore/ChangeLog (97731 => 97732)


--- trunk/Source/WebCore/ChangeLog	2011-10-18 09:18:18 UTC (rev 97731)
+++ trunk/Source/WebCore/ChangeLog	2011-10-18 09:28:14 UTC (rev 97732)
@@ -1,3 +1,14 @@
+2011-10-11  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: support displaying multiple sources per single script in ScriptsPanel.
+        https://bugs.webkit.org/show_bug.cgi?id=69847
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._removeSourceFrame):
+        (WebInspector.ScriptsPanel.prototype._uiSourceCodeReplaced):
+
 2011-10-18  Nikolas Zimmermann  <nzimmerm...@rim.com>
 
         Prepare SVGImage intrinsic size negotiation: Add intrinsic size & ratio calculation functionality to Image

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (97731 => 97732)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-10-18 09:18:18 UTC (rev 97731)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-10-18 09:28:14 UTC (rev 97732)
@@ -698,6 +698,10 @@
 
     _removeSourceFrame: function(uiSourceCode)
     {
+        var option = uiSourceCode._option;
+        if (option)
+            this._filesSelectElement.removeChild(option);
+
         var sourceFrame = uiSourceCode._sourceFrame;
         if (!sourceFrame)
             return;
@@ -708,22 +712,22 @@
 
     _uiSourceCodeReplaced: function(event)
     {
-        // FIXME: support multiple entries.
-        var oldUISourceCode = event.data.oldUISourceCodeList[0];
-        var uiSourceCode = event.data.uiSourceCodeList[0];
+        var oldUISourceCodeList = event.data.oldUISourceCodeList;
+        var uiSourceCodeList = event.data.uiSourceCodeList;
 
-        // Re-bind file select option from old source file to new one.
-        var option = oldUISourceCode._option;
-        if (!option)
-            return;
-        delete oldUISourceCode._option;
-        option._uiSourceCode = uiSourceCode;
-        uiSourceCode._option = option;
+        var visible = false;
+        for (var i = 0; i < oldUISourceCodeList.length; ++i) {
+            var uiSourceCode = oldUISourceCodeList[i];
+            if (uiSourceCode._sourceFrame === this.visibleView)
+                visible = true;
+            this._removeSourceFrame(uiSourceCode);
+        }
 
-        // Remove old source frame and create new one if needed.
-        this._removeSourceFrame(oldUISourceCode);
-        if (option === this._filesSelectElement[this._filesSelectElement.selectedIndex])
-            this._showSourceFrame(uiSourceCode);
+        for (var i = 0; i < uiSourceCodeList.length; ++i)
+            this._uiSourceCodeAdded({ data: uiSourceCodeList[i] });
+
+        if (visible)
+            this._showSourceFrame(uiSourceCodeList[0]);
     },
 
     _sourceFrameLoaded: function(event)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to