Web Inspector: Console: execution context picker doesn't update when switching to...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Aug 2019 07:37:00 +0000 (07:37 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Aug 2019 07:37:00 +0000 (07:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200279

Reviewed by Joseph Pecoraro.

The `representedObject` of the "auto" execution context path component is shared with that
execution context's actual path component, meaning that if the user switches from "auto" to
that execution context's path component, the underlying `representedObject` wouldn't change,
and therfore the `RuntimeManager.Event.ActiveExecutionContextChanged` wouldn't fire. In this
case, update the visible ("selected") execution context path component manually.

* UserInterface/Views/QuickConsole.js:
(WI.QuickConsole.prototype._selectExecutionContext):
(WI.QuickConsole.prototype._pathComponentSelected):

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

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

index cf96d14..b3e42f9 100644 (file)
@@ -1,3 +1,20 @@
+2019-08-03  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Console: execution context picker doesn't update when switching to the inferred context from auto
+        https://bugs.webkit.org/show_bug.cgi?id=200279
+
+        Reviewed by Joseph Pecoraro.
+
+        The `representedObject` of the "auto" execution context path component is shared with that
+        execution context's actual path component, meaning that if the user switches from "auto" to
+        that execution context's path component, the underlying `representedObject` wouldn't change,
+        and therfore the `RuntimeManager.Event.ActiveExecutionContextChanged` wouldn't fire. In this
+        case, update the visible ("selected") execution context path component manually.
+
+        * UserInterface/Views/QuickConsole.js:
+        (WI.QuickConsole.prototype._selectExecutionContext):
+        (WI.QuickConsole.prototype._pathComponentSelected):
+
 2019-08-02  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Console: all navigation items should be shown in the split console
index 01eea3d..672deaa 100644 (file)
@@ -159,9 +159,12 @@ WI.QuickConsole = class QuickConsole extends WI.View
         if (!executionContext)
             executionContext = WI.mainTarget.executionContext;
 
-        WI.runtimeManager.activeExecutionContext = executionContext;
-
         this._automaticExecutionContextPathComponent.displayName = WI.UIString("Auto - %s").format(preferredName || executionContext.name);
+
+        let changed = WI.runtimeManager.activeExecutionContext !== executionContext;
+        if (changed)
+            WI.runtimeManager.activeExecutionContext = executionContext;
+        return changed;
     }
 
     _handleMouseDown(event)
@@ -405,7 +408,11 @@ WI.QuickConsole = class QuickConsole extends WI.View
     _pathComponentSelected(event)
     {
         this._shouldAutomaticallySelectExecutionContext = event.data.pathComponent === this._automaticExecutionContextPathComponent;
-        this._selectExecutionContext(event.data.pathComponent.representedObject);
+
+        // Only manually rebuild the execution context path components if the newly selected
+        // execution context matches the previously selected one.
+        if (!this._selectExecutionContext(event.data.pathComponent.representedObject))
+            this._rebuildExecutionContextPathComponents();
     }
 
     _pathComponentClicked(event)