Title: [98710] trunk
Revision
98710
Author
[email protected]
Date
2011-10-28 02:09:29 -0700 (Fri, 28 Oct 2011)

Log Message

Web Inspector: CallStackSidebarPane should remove discarded Placards from RawSourceCode listeners list
https://bugs.webkit.org/show_bug.cgi?id=70996

Reviewed by Pavel Feldman.

Source/WebCore:

Test: inspector/debugger/callstack-placards-discarded.html

* inspector/front-end/CallStackSidebarPane.js:
(WebInspector.CallStackSidebarPane.prototype.update):
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype.createPlacard):
(WebInspector.DebuggerPresentationModel.CallFramePlacard):
(WebInspector.DebuggerPresentationModel.CallFramePlacard.prototype.discard):
(WebInspector.DebuggerPresentationModel.CallFramePlacard.prototype._update):
* inspector/front-end/Placard.js:
(WebInspector.Placard.prototype.toggleSelected):
(WebInspector.Placard.prototype.discard):

LayoutTests:

* inspector/debugger/callstack-placards-discarded-expected.txt: Added.
* inspector/debugger/callstack-placards-discarded.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98709 => 98710)


--- trunk/LayoutTests/ChangeLog	2011-10-28 08:48:16 UTC (rev 98709)
+++ trunk/LayoutTests/ChangeLog	2011-10-28 09:09:29 UTC (rev 98710)
@@ -1,3 +1,13 @@
+2011-10-28  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: CallStackSidebarPane should remove discarded Placards from RawSourceCode listeners list
+        https://bugs.webkit.org/show_bug.cgi?id=70996
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/callstack-placards-discarded-expected.txt: Added.
+        * inspector/debugger/callstack-placards-discarded.html: Added.
+
 2011-10-28  Jochen Eisinger  <[email protected]>
 
         Add allowScriptFromSource callback to FrameLoaderClient

Added: trunk/LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt (0 => 98710)


--- trunk/LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt	2011-10-28 09:09:29 UTC (rev 98710)
@@ -0,0 +1,20 @@
+Tests that RawSourceCode listeners count won't grow on each script pause. Bug 70996
+
+Debugger was enabled.
+
+Running: testCallStackPlacardsDiscarded
+Script source was shown.
+Set timer for test function.
+Received DebuggerPaused event.
+Function name: testFunction
+Listeners length: 3
+Script execution paused.
+Script execution resumed.
+Set timer for test function.
+Received DebuggerPaused event.
+Function name: testFunction
+Listeners length: 3
+Script execution paused.
+Script execution resumed.
+Debugger was disabled.
+
Property changes on: trunk/LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/debugger/callstack-placards-discarded.html (0 => 98710)


--- trunk/LayoutTests/inspector/debugger/callstack-placards-discarded.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/callstack-placards-discarded.html	2011-10-28 09:09:29 UTC (rev 98710)
@@ -0,0 +1,67 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function testFunction()
+{
+    debugger;
+}
+
+var test = function()
+{
+    InspectorTest.runDebuggerTestSuite([
+        function testCallStackPlacardsDiscarded(next)
+        {
+            WebInspector.debuggerPresentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerPaused, didPause, this);
+            var previousListenerLength = undefined;
+            function didPause(event)
+            {
+                InspectorTest.addResult("Received DebuggerPaused event.");
+                var callFrame = event.data.callFrames[0];
+                InspectorTest.addResult("Function name: " + callFrame._callFrame.functionName);
+                var rawSourceCode = callFrame._rawSourceCode;
+                var listeners = rawSourceCode._listeners[WebInspector.RawSourceCode.Events.SourceMappingUpdated]
+                InspectorTest.addResult("Listeners length: " + listeners.length);
+                if (previousListenerLength !== undefined && listeners.length !== previousListenerLength)
+                    InspectorTest.addResult("FAILED: RawSourceCode listeners count has changed!");
+                previousListenerLength = listeners.length;
+            }
+
+            InspectorTest.showScriptSource("callstack-placards-discarded.html", didShowScriptSource);
+            function didShowScriptSource(sourceFrame)
+            {
+                InspectorTest.addResult("Script source was shown.");
+                InspectorTest.runTestFunctionAndWaitUntilPaused(didPause1);
+            }
+            function didPause1()
+            {
+                InspectorTest.resumeExecution(didResume1)
+            }
+            function didResume1()
+            {
+                InspectorTest.runTestFunctionAndWaitUntilPaused(didPause2);
+            }
+            function didPause2()
+            {
+                InspectorTest.resumeExecution(didResume2)
+            }
+            function didResume2()
+            {
+                next();
+            }
+        },
+    ]);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that RawSourceCode listeners count won't grow on each script pause. <a href="" 70996</a>
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/debugger/callstack-placards-discarded.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (98709 => 98710)


--- trunk/Source/WebCore/ChangeLog	2011-10-28 08:48:16 UTC (rev 98709)
+++ trunk/Source/WebCore/ChangeLog	2011-10-28 09:09:29 UTC (rev 98710)
@@ -1,3 +1,23 @@
+2011-10-28  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: CallStackSidebarPane should remove discarded Placards from RawSourceCode listeners list
+        https://bugs.webkit.org/show_bug.cgi?id=70996
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/debugger/callstack-placards-discarded.html
+
+        * inspector/front-end/CallStackSidebarPane.js:
+        (WebInspector.CallStackSidebarPane.prototype.update):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype.createPlacard):
+        (WebInspector.DebuggerPresentationModel.CallFramePlacard):
+        (WebInspector.DebuggerPresentationModel.CallFramePlacard.prototype.discard):
+        (WebInspector.DebuggerPresentationModel.CallFramePlacard.prototype._update):
+        * inspector/front-end/Placard.js:
+        (WebInspector.Placard.prototype.toggleSelected):
+        (WebInspector.Placard.prototype.discard):
+
 2011-10-28  Jochen Eisinger  <[email protected]>
 
         Add allowScriptFromSource callback to FrameLoaderClient

Modified: trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js (98709 => 98710)


--- trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js	2011-10-28 08:48:16 UTC (rev 98709)
+++ trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js	2011-10-28 09:09:29 UTC (rev 98710)
@@ -40,6 +40,10 @@
     {
         this.bodyElement.removeChildren();
 
+        if (this.placards) {
+            for (var i = 0; i < this.placards.length; ++i)
+                this.placards[i].discard();
+        }
         this.placards = [];
 
         if (!callFrames) {

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


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-10-28 08:48:16 UTC (rev 98709)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-10-28 09:09:29 UTC (rev 98710)
@@ -83,20 +83,7 @@
      */
     createPlacard: function(callFrame)
     {
-        var title = callFrame._callFrame.functionName || WebInspector.UIString("(anonymous function)");
-        var placard = new WebInspector.Placard(title, "");
-
-        var rawSourceCode = callFrame._rawSourceCode;
-        function updatePlacard()
-        {
-            var uiLocation = rawSourceCode.sourceMapping.rawLocationToUILocation(callFrame._callFrame.location);
-            placard.subtitle = WebInspector.displayNameForURL(uiLocation.uiSourceCode.url) + ":" + (uiLocation.lineNumber + 1);
-            placard._text = WebInspector.UIString("%s() at %s", placard.title, placard.subtitle);
-        }
-        if (rawSourceCode.sourceMapping)
-            updatePlacard.call(this);
-        rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, updatePlacard, this);
-        return placard;
+        return new WebInspector.DebuggerPresentationModel.CallFramePlacard(callFrame);
     },
 
     /**
@@ -764,6 +751,37 @@
 
 /**
  * @constructor
+ * @extends {WebInspector.Placard}
+ * @param {WebInspector.PresentationCallFrame} callFrame
+ */
+WebInspector.DebuggerPresentationModel.CallFramePlacard = function(callFrame)
+{
+    WebInspector.Placard.call(this, callFrame._callFrame.functionName || WebInspector.UIString("(anonymous function)"), "");
+    this._callFrame = callFrame;
+    var rawSourceCode = callFrame._rawSourceCode;
+    if (rawSourceCode.sourceMapping)
+        this._update();
+    rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._update, this);
+}
+
+WebInspector.DebuggerPresentationModel.CallFramePlacard.prototype = {
+    discard: function()
+    {
+        this._callFrame._rawSourceCode.removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._update, this);
+    },
+
+    _update: function()
+    {
+        var rawSourceCode = this._callFrame._rawSourceCode;
+        var uiLocation = rawSourceCode.sourceMapping.rawLocationToUILocation(this._callFrame._callFrame.location);
+        this.subtitle = WebInspector.displayNameForURL(uiLocation.uiSourceCode.url) + ":" + (uiLocation.lineNumber + 1);
+    }
+}
+
+WebInspector.DebuggerPresentationModel.CallFramePlacard.prototype.__proto__ = WebInspector.Placard.prototype;
+
+/**
+ * @constructor
  * @implements {WebInspector.ResourceDomainModelBinding}
  * @param {WebInspector.DebuggerPresentationModel} model
  */

Modified: trunk/Source/WebCore/inspector/front-end/Placard.js (98709 => 98710)


--- trunk/Source/WebCore/inspector/front-end/Placard.js	2011-10-28 08:48:16 UTC (rev 98709)
+++ trunk/Source/WebCore/inspector/front-end/Placard.js	2011-10-28 09:09:29 UTC (rev 98710)
@@ -105,5 +105,9 @@
     toggleSelected: function()
     {
         this.selected = !this.selected;
+    },
+
+    discard: function()
+    {
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to