Title: [92827] trunk/Source/WebCore
Revision
92827
Author
[email protected]
Date
2011-08-11 00:56:16 -0700 (Thu, 11 Aug 2011)

Log Message

Web Inspector: do not evaluate watch expressions on load.
https://bugs.webkit.org/show_bug.cgi?id=66002

Patch by Pavel Feldman <[email protected]> on 2011-08-11
Reviewed by Yury Semikhatsky.

* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.show):
(WebInspector.ScriptsPanel.prototype.hide):
(WebInspector.ScriptsPanel.prototype.reset):
* inspector/front-end/WatchExpressionsSidebarPane.js:
(WebInspector.WatchExpressionsSidebarPane):
(WebInspector.WatchExpressionsSidebarPane.prototype.hide):
(WebInspector.WatchExpressionsSidebarPane.prototype.reset):
(WebInspector.WatchExpressionsSidebarPane.prototype.refreshExpressions):
(WebInspector.WatchExpressionsSidebarPane.prototype._refreshExpressionsIfNeeded):
(WebInspector.WatchExpressionsSidebarPane.prototype._refreshButtonClicked):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92826 => 92827)


--- trunk/Source/WebCore/ChangeLog	2011-08-11 07:25:02 UTC (rev 92826)
+++ trunk/Source/WebCore/ChangeLog	2011-08-11 07:56:16 UTC (rev 92827)
@@ -1,3 +1,22 @@
+2011-08-11  Pavel Feldman  <[email protected]>
+
+        Web Inspector: do not evaluate watch expressions on load.
+        https://bugs.webkit.org/show_bug.cgi?id=66002
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.show):
+        (WebInspector.ScriptsPanel.prototype.hide):
+        (WebInspector.ScriptsPanel.prototype.reset):
+        * inspector/front-end/WatchExpressionsSidebarPane.js:
+        (WebInspector.WatchExpressionsSidebarPane):
+        (WebInspector.WatchExpressionsSidebarPane.prototype.hide):
+        (WebInspector.WatchExpressionsSidebarPane.prototype.reset):
+        (WebInspector.WatchExpressionsSidebarPane.prototype.refreshExpressions):
+        (WebInspector.WatchExpressionsSidebarPane.prototype._refreshExpressionsIfNeeded):
+        (WebInspector.WatchExpressionsSidebarPane.prototype._refreshButtonClicked):
+
 2011-08-10  Ryosuke Niwa  <[email protected]>
 
         Copying can result in span around block elements on the clipboard

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


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-08-11 07:25:02 UTC (rev 92826)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-08-11 07:56:16 UTC (rev 92827)
@@ -214,6 +214,7 @@
 
         if (this.visibleView)
             this.visibleView.show(this.viewsContainerElement);
+        this.sidebarPanes.watchExpressions.show();
     },
 
     hide: function()
@@ -221,6 +222,7 @@
         if (this.visibleView)
             this.visibleView.hide();
         WebInspector.Panel.prototype.hide.call(this);
+        this.sidebarPanes.watchExpressions.hide();
     },
 
     get breakpointsActivated()
@@ -540,7 +542,7 @@
         this.viewsContainerElement.removeChildren();
 
         this.sidebarPanes.jsBreakpoints.reset();
-        this.sidebarPanes.watchExpressions.refreshExpressions();
+        this.sidebarPanes.watchExpressions.reset();
         if (!preserveItems && this.sidebarPanes.workers)
             this.sidebarPanes.workers.reset();
     },

Modified: trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js (92826 => 92827)


--- trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js	2011-08-11 07:25:02 UTC (rev 92826)
+++ trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js	2011-08-11 07:56:16 UTC (rev 92827)
@@ -31,31 +31,60 @@
 WebInspector.WatchExpressionsSidebarPane = function()
 {
     WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions"));
-    this.reset();
+
+    this.section = new WebInspector.WatchExpressionsSection();
+    this.bodyElement.appendChild(this.section.element);
+
+    var refreshButton = document.createElement("button");
+    refreshButton.className = "pane-title-button refresh";
+    refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+    this.titleElement.appendChild(refreshButton);
+
+    var addButton = document.createElement("button");
+    addButton.className = "pane-title-button add";
+    addButton.addEventListener("click", this._addButtonClicked.bind(this), false);
+    this.titleElement.appendChild(addButton);
+    this._requiresUpdate = true;
 }
 
 WebInspector.WatchExpressionsSidebarPane.prototype = {
-    reset: function()
+    show: function()
     {
-        this.bodyElement.removeChildren();
+        this._visible = true;
 
-        this.expanded = WebInspector.settings.watchExpressions.get().length > 0;
-        this.section = new WebInspector.WatchExpressionsSection();
-        this.bodyElement.appendChild(this.section.element);
+        // Expand and update watches first time they are shown.
+        if (!this._wasShown && WebInspector.settings.watchExpressions.get().length > 0)
+            this.expanded = true;
 
-        var refreshButton = document.createElement("button");
-        refreshButton.className = "pane-title-button refresh";
-        refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
-        this.titleElement.appendChild(refreshButton);
+        this._refreshExpressionsIfNeeded();
+        this._wasShown = true;
+    },
 
-        var addButton = document.createElement("button");
-        addButton.className = "pane-title-button add";
-        addButton.addEventListener("click", this._addButtonClicked.bind(this), false);
-        this.titleElement.appendChild(addButton);
+    hide: function()
+    {
+        this._visible = false;
+    },
 
-        this._onexpand_ = this.refreshExpressions.bind(this);
+    reset: function()
+    {
+        this.refreshExpressions();
     },
 
+    refreshExpressions: function()
+    {
+        this._requiresUpdate = true;
+        this._refreshExpressionsIfNeeded();
+    },
+
+    _refreshExpressionsIfNeeded: function()
+    {
+        if (this._requiresUpdate && this._visible) {
+            this.section.update();
+            delete this._requiresUpdate;
+        } else
+            this._requiresUpdate = true;
+    },
+
     _addButtonClicked: function(event)
     {
         event.stopPropagation();
@@ -67,11 +96,6 @@
     {
         event.stopPropagation();
         this.refreshExpressions();
-    },
-
-    refreshExpressions: function()
-    {
-        this.section.update();
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to