REGRESSION (r211829): Web Inspector: Elements tab is blank when added after page...
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Feb 2017 21:17:37 +0000 (21:17 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Feb 2017 21:17:37 +0000 (21:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168142

Reviewed by Brian Burg.

The Elements tab can be shown in two ways: by adding the Elements tab
from the "New Tab" tab, or via Inspect Element. In both cases we should
be checking that the ContentView exists, and create it if needed.

* UserInterface/Views/ElementsTabContentView.js:
(WebInspector.ElementsTabContentView.prototype.showRepresentedObject):
(WebInspector.ElementsTabContentView.prototype.shown):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js

index b72f29e..d817ac1 100644 (file)
@@ -1,3 +1,18 @@
+2017-02-10  Matt Baker  <mattbaker@apple.com>
+
+        REGRESSION (r211829): Web Inspector: Elements tab is blank when added after page load
+        https://bugs.webkit.org/show_bug.cgi?id=168142
+
+        Reviewed by Brian Burg.
+
+        The Elements tab can be shown in two ways: by adding the Elements tab
+        from the "New Tab" tab, or via Inspect Element. In both cases we should
+        be checking that the ContentView exists, and create it if needed.
+
+        * UserInterface/Views/ElementsTabContentView.js:
+        (WebInspector.ElementsTabContentView.prototype.showRepresentedObject):
+        (WebInspector.ElementsTabContentView.prototype.shown):
+
 2017-02-09  Devin Rousso  <dcrousso+webkit@gmail.com>
 
         Web Inspector: changing dock side from windowed to bottom should cause split console to collapse on Timeline and Network tabs
index 69551d0..2edcb8e 100644 (file)
@@ -67,16 +67,15 @@ WebInspector.ElementsTabContentView = class ElementsTabContentView extends WebIn
 
     showRepresentedObject(representedObject, cookie)
     {
-        var domTreeContentView = this.contentBrowser.currentContentView;
-        console.assert(!domTreeContentView || domTreeContentView instanceof WebInspector.DOMTreeContentView);
-        if (!domTreeContentView || !(domTreeContentView instanceof WebInspector.DOMTreeContentView)) {
-            // FIXME: Remember inspected node for later when _mainFrameDidChange.
-            return;
-        }
+        if (!this.contentBrowser.currentContentView)
+            this._showDOMTreeContentView();
 
         if (!cookie || !cookie.nodeToSelect)
             return;
 
+        let domTreeContentView = this.contentBrowser.currentContentView;
+        console.assert(domTreeContentView instanceof WebInspector.DOMTreeContentView, "Unexpected DOMTreeContentView representedObject.", domTreeContentView);
+
         domTreeContentView.selectAndRevealDOMNode(cookie.nodeToSelect);
 
         // Because nodeToSelect is ephemeral, we don't want to keep
@@ -84,6 +83,14 @@ WebInspector.ElementsTabContentView = class ElementsTabContentView extends WebIn
         cookie.nodeToSelect = undefined;
     }
 
+    shown()
+    {
+        super.shown();
+
+        if (!this.contentBrowser.currentContentView)
+            this._showDOMTreeContentView();
+    }
+
     closed()
     {
         super.closed();