Fixes a bug where a timer would keep firing after the Inspector
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 May 2008 06:34:40 +0000 (06:34 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 May 2008 06:34:40 +0000 (06:34 +0000)
was closed. It turns out this timer wasn't needed anymore now
that we can add an event listener to the inspected page and have
it get called in the Inspector's context.

https://bugs.webkit.org/show_bug.cgi?id=18577

Reviewed by Mark Rowe.

* page/inspector/ElementsPanel.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34104 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/inspector/ElementsPanel.js

index cd8c123..1498def 100644 (file)
@@ -1,3 +1,16 @@
+2008-05-23  Timothy Hatcher  <timothy@apple.com>
+
+        Fixes a bug where a timer would keep firing after the Inspector
+        was closed. It turns out this timer wasn't needed anymore now
+        that we can add an event listener to the inspected page and have
+        it get called in the Inspector's context.
+
+        https://bugs.webkit.org/show_bug.cgi?id=18577
+
+        Reviewed by Mark Rowe.
+
+        * page/inspector/ElementsPanel.js:
+
 2008-05-23  Anthony Ricaud  <rik24d@gmail.com>
 
         Changes the largerResourcesButton tooltip to toggle.
index 7e8b3bc..6bf1407 100644 (file)
@@ -133,30 +133,16 @@ WebInspector.ElementsPanel.prototype = {
             return;
 
         if (!inspectedWindow.document.firstChild) {
-            // FIXME: This whole if block can be simplified once we can add an event listener to
-            // the inspected page and have it get called in the Inspector's context.
-
-            var elementsPanel = this;
-            var contentLoaded = InspectorController.wrapCallback(function()
+            function contentLoaded()
             {
-                // This function will be called in the inspected page's context.
-                elementsPanel._domContentLoaded = true;
-            });
+                inspectedWindow.document.removeEventListener("DOMContentLoaded", contentLoadedCallback, false);
 
-            function checkContentLoaded()
-            {
-                if (!this._domContentLoaded)
-                    return;
                 this.reset();
-                inspectedWindow.document.removeEventListener("DOMContentLoaded", contentLoaded, false);
-                clearInterval(contentLoadedPollingInterval);
-                delete this._domContentLoaded;
             }
 
-            this._domContentLoaded = false;
-            var contentLoadedPollingInterval = setInterval(checkContentLoaded.bind(this), 100);
+            var contentLoadedCallback = InspectorController.wrapCallback(contentLoaded.bind(this));
 
-            inspectedWindow.document.addEventListener("DOMContentLoaded", contentLoaded, false);
+            inspectedWindow.document.addEventListener("DOMContentLoaded", contentLoadedCallback, false);
             return;
         }