Web Inspector: Uncaught Exception: null is not an object (evaluating 'this.ownerDocum...
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / QuickConsole.js
index caaac60..5187b30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.QuickConsole = class QuickConsole extends WebInspector.Object
+WI.QuickConsole = class QuickConsole extends WI.View
 {
     constructor(element)
     {
-        super();
+        super(element);
 
-        this._toggleOrFocusKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape, this._toggleOrFocus.bind(this));
+        this._toggleOrFocusKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape, this._toggleOrFocus.bind(this));
+        this._toggleOrFocusKeyboardShortcut.implicitlyPreventsDefault = false;
 
-        var mainFrameExecutionContext = new WebInspector.ExecutionContext(WebInspector.QuickConsole.MainFrameContextExecutionIdentifier, WebInspector.UIString("Main Frame"), true, null);
-        this._mainFrameExecutionContextPathComponent = this._createExecutionContextPathComponent(mainFrameExecutionContext.name, mainFrameExecutionContext.identifier);
-        this._selectedExecutionContextPathComponent = this._mainFrameExecutionContextPathComponent;
+        this._automaticExecutionContextPathComponent = this._createExecutionContextPathComponent(null, WI.UIString("Auto"));
+        this._automaticExecutionContextPathComponent.tooltip = WI.UIString("Execution context for $0");
 
+        this._mainExecutionContextPathComponent = null;
         this._otherExecutionContextPathComponents = [];
-        this._frameIdentifierToExecutionContextPathComponentMap = {};
 
-        this._element = element || document.createElement("div");
-        this._element.classList.add("quick-console");
+        this._frameToPathComponent = new Map;
+        this._targetToPathComponent = new Map;
 
-        this.prompt = new WebInspector.ConsolePrompt(null, "text/javascript");
-        this.prompt.element.classList.add(WebInspector.QuickConsole.TextPromptStyleClassName);
-        this._element.appendChild(this.prompt.element);
+        this._shouldAutomaticallySelectExecutionContext = true;
+        this._restoreSelectedExecutionContextForFrame = false;
+
+        this.element.classList.add("quick-console");
+        this.element.addEventListener("mousedown", this._handleMouseDown.bind(this));
+
+        this.prompt = new WI.ConsolePrompt(null, "text/javascript");
+        this.addSubview(this.prompt);
 
         // FIXME: CodeMirror 4 has a default "Esc" key handler that always prevents default.
         // Our keyboard shortcut above will respect the default prevented and ignore the event
         // and not toggle the console. Install our own Escape key handler that will trigger
         // when the ConsolePrompt is empty, to restore toggling behavior. A better solution
         // would be for CodeMirror's event handler to pass if it doesn't do anything.
-        this.prompt.escapeKeyHandlerWhenEmpty = function() { WebInspector.toggleSplitConsole(); };
-
-        this.prompt.shown();
+        this.prompt.escapeKeyHandlerWhenEmpty = function() { WI.toggleSplitConsole(); };
 
-        this._navigationBar = new WebInspector.QuickConsoleNavigationBar;
-        this._element.appendChild(this._navigationBar.element);
+        this._navigationBar = new WI.QuickConsoleNavigationBar;
+        this.addSubview(this._navigationBar);
 
-        this._executionContextSelectorItem = new WebInspector.HierarchicalPathNavigationItem;
+        this._executionContextSelectorItem = new WI.HierarchicalPathNavigationItem;
         this._executionContextSelectorItem.showSelectorArrows = true;
         this._navigationBar.addNavigationItem(this._executionContextSelectorItem);
 
-        this._executionContextSelectorDivider = new WebInspector.DividerNavigationItem;
+        this._executionContextSelectorDivider = new WI.DividerNavigationItem;
         this._navigationBar.addNavigationItem(this._executionContextSelectorDivider);
 
-        this._rebuildExecutionContextPathComponents();
+        this.initializeMainExecutionContextPathComponent();
 
-        // COMPATIBILITY (iOS 6): Execution contexts did not exist, evaluation worked with frame ids.
-        if (WebInspector.ExecutionContext.supported()) {
-            WebInspector.Frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextsChanged, this);
-            WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
-        } else {
-            WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameAdded, this);
-            WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasRemoved, this._frameRemoved, this);
-            WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._frameMainResourceChanged, this);
-        }
+        WI.consoleDrawer.toggleButtonShortcutTooltip(this._toggleOrFocusKeyboardShortcut);
+        WI.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._updateStyles, this);
+
+        WI.Frame.addEventListener(WI.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextsChanged, this);
+        WI.Frame.addEventListener(WI.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._debuggerActiveCallFrameDidChange, this);
+        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._debuggerActiveCallFrameDidChange, this);
+
+        WI.runtimeManager.addEventListener(WI.RuntimeManager.Event.ActiveExecutionContextChanged, this._activeExecutionContextChanged, this);
+
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, this._targetAdded, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
+
+        WI.domManager.addEventListener(WI.DOMManager.Event.InspectedNodeChanged, this._handleInspectedNodeChanged, this);
+
+        WI.TabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._updateStyles, this);
     }
 
     // Public
 
-    get element()
+    get navigationBar()
     {
-        return this._element;
+        return this._navigationBar;
     }
 
-    get navigationBar()
+    closed()
     {
-        return this._navigationBar;
+        WI.Frame.removeEventListener(null, null, this);
+        WI.debuggerManager.removeEventListener(null, null, this);
+        WI.runtimeManager.removeEventListener(null, null, this);
+        WI.targetManager.removeEventListener(null, null, this);
+        WI.consoleDrawer.removeEventListener(null, null, this);
+        WI.TabBrowser.removeEventListener(null, null, this);
+
+        super.closed();
     }
 
-    get executionContextIdentifier()
+    initializeMainExecutionContextPathComponent()
     {
-        return this._selectedExecutionContextPathComponent._executionContextIdentifier;
+        if (!WI.mainTarget || !WI.mainTarget.executionContext)
+            return;
+
+        this._mainExecutionContextPathComponent = this._createExecutionContextPathComponent(WI.mainTarget.executionContext);
+        this._mainExecutionContextPathComponent.previousSibling = this._automaticExecutionContextPathComponent;
+
+        this._automaticExecutionContextPathComponent.nextSibling = this._mainExecutionContextPathComponent;
+
+        this._shouldAutomaticallySelectExecutionContext = true;
+        this._selectExecutionContext(WI.mainTarget.executionContext);
+        this._rebuildExecutionContextPathComponents();
     }
 
-    updateLayout()
+    // Protected
+
+    layout()
     {
         // A hard maximum size of 33% of the window.
-        var maximumAllowedHeight = Math.round(window.innerHeight * 0.33);
+        let maximumAllowedHeight = Math.round(window.innerHeight * 0.33);
         this.prompt.element.style.maxHeight = maximumAllowedHeight + "px";
     }
 
-    consoleLogVisibilityChanged(visible)
+    // Private
+
+    _preferredNameForFrame(frame)
     {
-        if (visible)
-            this.element.classList.add(WebInspector.QuickConsole.ShowingLogClassName);
-        else
-            this.element.classList.remove(WebInspector.QuickConsole.ShowingLogClassName);
+        if (frame.name)
+            return WI.UIString("%s (%s)").format(frame.name, frame.mainResource.displayName);
+        return frame.mainResource.displayName;
+    }
 
-        this.dispatchEventToListeners(WebInspector.QuickConsole.Event.DidResize);
+    _selectExecutionContext(executionContext)
+    {
+        let preferredName = null;
+
+        let inspectedNode = WI.domManager.inspectedNode;
+        if (inspectedNode) {
+            let frame = inspectedNode.frame;
+            if (frame) {
+                if (this._shouldAutomaticallySelectExecutionContext)
+                    executionContext = frame.pageExecutionContext;
+                preferredName = this._preferredNameForFrame(frame);
+            }
+        }
+
+        console.assert(executionContext);
+        if (!executionContext)
+            executionContext = WI.mainTarget.executionContext;
+
+        WI.runtimeManager.activeExecutionContext = executionContext;
+
+        this._automaticExecutionContextPathComponent.displayName = WI.UIString("Auto - %s").format(preferredName || executionContext.name);
     }
 
-    // Private
+    _handleMouseDown(event)
+    {
+        if (event.target !== this.element)
+            return;
+
+        event.preventDefault();
+        this.prompt.focus();
+    }
 
     _executionContextPathComponentsToDisplay()
     {
         // If we are in the debugger the console will use the active call frame, don't show the selector.
-        if (WebInspector.debuggerManager.activeCallFrame)
+        if (WI.debuggerManager.activeCallFrame)
             return [];
 
-        // If there is only the Main Frame, don't show the selector.
+        // If there is only the Main ExecutionContext, don't show the selector.
         if (!this._otherExecutionContextPathComponents.length)
             return [];
 
-        return [this._selectedExecutionContextPathComponent];
+        if (this._shouldAutomaticallySelectExecutionContext)
+            return [this._automaticExecutionContextPathComponent];
+
+        if (WI.runtimeManager.activeExecutionContext === WI.mainTarget.executionContext)
+            return [this._mainExecutionContextPathComponent];
+
+        return this._otherExecutionContextPathComponents.filter((component) => component.representedObject === WI.runtimeManager.activeExecutionContext);
     }
 
     _rebuildExecutionContextPathComponents()
     {
-        var components = this._executionContextPathComponentsToDisplay();
-        var isEmpty = !components.length;
+        let components = this._executionContextPathComponentsToDisplay();
+        let isEmpty = !components.length;
 
+        this._executionContextSelectorItem.element.classList.toggle("automatic-execution-context", this._shouldAutomaticallySelectExecutionContext);
         this._executionContextSelectorItem.components = components;
 
         this._executionContextSelectorItem.hidden = isEmpty;
         this._executionContextSelectorDivider.hidden = isEmpty;
+
     }
 
     _framePageExecutionContextsChanged(event)
     {
-        var frame = event.target;
+        let frame = event.target;
 
-        var shouldAutomaticallySelect = this._restoreSelectedExecutionContextForFrame === frame;
+        let newExecutionContextPathComponent = this._insertExecutionContextPathComponentForFrame(frame);
 
-        var newExecutionContextPathComponent = this._insertExecutionContextPathComponentForFrame(frame, shouldAutomaticallySelect);
+        if (this._restoreSelectedExecutionContextForFrame === frame) {
+            this._restoreSelectedExecutionContextForFrame = null;
 
-        if (shouldAutomaticallySelect) {
-            delete this._restoreSelectedExecutionContextForFrame;
-            this._selectedExecutionContextPathComponent = newExecutionContextPathComponent;
-            this._rebuildExecutionContextPathComponents();
+            this._selectExecutionContext(newExecutionContextPathComponent.representedObject);
         }
     }
 
     _frameExecutionContextsCleared(event)
     {
-        var frame = event.target;
+        let frame = event.target;
 
         // If this frame is navigating and it is selected in the UI we want to reselect its new item after navigation.
         if (event.data.committingProvisionalLoad && !this._restoreSelectedExecutionContextForFrame) {
-            var executionContextPathComponent = this._frameIdentifierToExecutionContextPathComponentMap[frame.id];
-            if (this._selectedExecutionContextPathComponent === executionContextPathComponent) {
+            let executionContextPathComponent = this._frameToPathComponent.get(frame);
+            if (executionContextPathComponent && executionContextPathComponent.representedObject === WI.runtimeManager.activeExecutionContext) {
                 this._restoreSelectedExecutionContextForFrame = frame;
                 // As a fail safe, if the frame never gets an execution context, clear the restore value.
-                setTimeout(function() { delete this._restoreSelectedExecutionContextForFrame; }.bind(this), 10);
+                setTimeout(() => {
+                    this._restoreSelectedExecutionContextForFrame = false;
+                }, 10);
             }
         }
 
         this._removeExecutionContextPathComponentForFrame(frame);
     }
 
-    _frameAdded(event)
-    {
-        var frame = event.data.frame;
-        this._insertExecutionContextPathComponentForFrame(frame);
-    }
-
-    _frameRemoved(event)
+    _activeExecutionContextChanged(event)
     {
-        var frame = event.data.frame;
-        this._removeExecutionContextPathComponentForFrame(frame);
+        this._rebuildExecutionContextPathComponents();
     }
 
-    _frameMainResourceChanged(event)
+    _createExecutionContextPathComponent(executionContext, preferredName)
     {
-        var frame = event.target;
-        this._updateExecutionContextPathComponentForFrame(frame);
-    }
+        console.assert(!executionContext || executionContext instanceof WI.ExecutionContext);
 
-    _createExecutionContextPathComponent(name, identifier)
-    {
-        var pathComponent = new WebInspector.HierarchicalPathComponent(name, "execution-context", identifier, true, true);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
-        pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
+        let pathComponent = new WI.HierarchicalPathComponent(preferredName || executionContext.name, "execution-context", executionContext, true, true);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+        pathComponent.addEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
         pathComponent.truncatedDisplayNameLength = 50;
-        pathComponent._executionContextIdentifier = identifier;
         return pathComponent;
     }
 
-    _createExecutionContextPathComponentFromFrame(frame)
+    _compareExecutionContextPathComponents(a, b)
     {
-        var name = frame.name ? frame.name + " \u2014 " + frame.mainResource.displayName : frame.mainResource.displayName;
-        var identifier = WebInspector.ExecutionContext.supported() ? frame.pageExecutionContext.id : frame.id;
-
-        var pathComponent = this._createExecutionContextPathComponent(name, identifier);
-        pathComponent._frame = frame;
+        let aExecutionContext = a.representedObject;
+        let bExecutionContext = b.representedObject;
 
-        return pathComponent;
-    }
+        // "Targets" (workers) at the top.
+        let aNonMainTarget = aExecutionContext.target !== WI.mainTarget;
+        let bNonMainTarget = bExecutionContext.target !== WI.mainTarget;
+        if (aNonMainTarget && !bNonMainTarget)
+            return -1;
+        if (bNonMainTarget && !aNonMainTarget)
+            return 1;
+        if (aNonMainTarget && bNonMainTarget)
+            return a.displayName.extendedLocaleCompare(b.displayName);
 
-    _compareExecutionContextPathComponents(a, b)
-    {
-        // "Main Frame" always on top.
-        if (!a._frame)
+        // "Main Frame" follows.
+        if (aExecutionContext === WI.mainTarget.executionContext)
             return -1;
-        if (!b._frame)
+        if (bExecutionContext === WI.mainTarget.executionContext)
             return 1;
 
+        // Only Frame contexts remain.
+        console.assert(aExecutionContext.frame);
+        console.assert(bExecutionContext.frame);
+
         // Frames with a name above frames without a name.
-        if (a._frame.name && !b._frame.name)
+        if (aExecutionContext.frame.name && !bExecutionContext.frame.name)
             return -1;
-        if (!a._frame.name && b._frame.name)
+        if (!aExecutionContext.frame.name && bExecutionContext.frame.name)
             return 1;
 
-        return a.displayName.localeCompare(b.displayName);
+        return a.displayName.extendedLocaleCompare(b.displayName);
     }
 
-    _insertExecutionContextPathComponentForFrame(frame, skipRebuild)
+    _insertOtherExecutionContextPathComponent(executionContextPathComponent)
     {
-        if (frame.isMainFrame())
-            return this._mainFrameExecutionContextPathComponent;
-
-        console.assert(!this._frameIdentifierToExecutionContextPathComponentMap[frame.id]);
-        if (this._frameIdentifierToExecutionContextPathComponentMap[frame.id])
-            return null;
+        let index = insertionIndexForObjectInListSortedByFunction(executionContextPathComponent, this._otherExecutionContextPathComponents, this._compareExecutionContextPathComponents);
 
-        var executionContextPathComponent = this._createExecutionContextPathComponentFromFrame(frame);
-
-        var index = insertionIndexForObjectInListSortedByFunction(executionContextPathComponent, this._otherExecutionContextPathComponents, this._compareExecutionContextPathComponents);
-
-        var prev = index > 0 ? this._otherExecutionContextPathComponents[index - 1] : this._mainFrameExecutionContextPathComponent;
-        var next = this._otherExecutionContextPathComponents[index] || null;
+        let prev = index > 0 ? this._otherExecutionContextPathComponents[index - 1] : this._mainExecutionContextPathComponent;
+        let next = this._otherExecutionContextPathComponents[index] || null;
         if (prev) {
             prev.nextSibling = executionContextPathComponent;
             executionContextPathComponent.previousSibling = prev;
@@ -252,72 +301,83 @@ WebInspector.QuickConsole = class QuickConsole extends WebInspector.Object
         }
 
         this._otherExecutionContextPathComponents.splice(index, 0, executionContextPathComponent);
-        this._frameIdentifierToExecutionContextPathComponentMap[frame.id] = executionContextPathComponent;
-
-        if (!skipRebuild)
-            this._rebuildExecutionContextPathComponents();
 
-        return executionContextPathComponent;
+        this._rebuildExecutionContextPathComponents();
     }
 
-    _removeExecutionContextPathComponentForFrame(frame, skipRebuild)
+    _removeOtherExecutionContextPathComponent(executionContextPathComponent)
     {
-        if (frame.isMainFrame())
-            return;
-
-        var executionContextPathComponent = this._frameIdentifierToExecutionContextPathComponentMap[frame.id];
-        console.assert(executionContextPathComponent);
-        if (!executionContextPathComponent)
-            return;
+        executionContextPathComponent.removeEventListener(WI.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
+        executionContextPathComponent.removeEventListener(WI.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
 
-        executionContextPathComponent.removeEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
-        executionContextPathComponent.removeEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked, this._pathComponentClicked, this);
-
-        var prev = executionContextPathComponent.previousSibling;
-        var next = executionContextPathComponent.nextSibling;
+        let prev = executionContextPathComponent.previousSibling;
+        let next = executionContextPathComponent.nextSibling;
         if (prev)
             prev.nextSibling = next;
         if (next)
             next.previousSibling = prev;
 
-        if (this._selectedExecutionContextPathComponent === executionContextPathComponent)
-            this._selectedExecutionContextPathComponent = this._mainFrameExecutionContextPathComponent;
-
         this._otherExecutionContextPathComponents.remove(executionContextPathComponent, true);
-        delete this._frameIdentifierToExecutionContextPathComponentMap[frame.id];
 
-        if (!skipRebuild)
-            this._rebuildExecutionContextPathComponents();
+        this._rebuildExecutionContextPathComponents();
     }
 
-    _updateExecutionContextPathComponentForFrame(frame)
+    _insertExecutionContextPathComponentForFrame(frame)
     {
         if (frame.isMainFrame())
-            return;
+            return this._mainExecutionContextPathComponent;
 
-        var executionContextPathComponent = this._frameIdentifierToExecutionContextPathComponentMap[frame.id];
-        if (!executionContextPathComponent)
+        let executionContextPathComponent = this._createExecutionContextPathComponent(frame.pageExecutionContext, this._preferredNameForFrame(frame));
+        this._insertOtherExecutionContextPathComponent(executionContextPathComponent);
+        this._frameToPathComponent.set(frame, executionContextPathComponent);
+        return executionContextPathComponent;
+    }
+
+    _removeExecutionContextPathComponentForFrame(frame)
+    {
+        if (frame.isMainFrame()) {
+            this._shouldAutomaticallySelectExecutionContext = true;
             return;
+        }
 
-        var wasSelected = this._selectedExecutionContextPathComponent === executionContextPathComponent;
+        let executionContextPathComponent = this._frameToPathComponent.take(frame);
+        this._removeOtherExecutionContextPathComponent(executionContextPathComponent);
+    }
 
-        this._removeExecutionContextPathComponentForFrame(frame, true);
-        var newExecutionContextPathComponent = this._insertExecutionContextPathComponentForFrame(frame, true);
+    _targetAdded(event)
+    {
+        let target = event.data.target;
+        if (target.type !== WI.Target.Type.Worker)
+            return;
 
-        if (wasSelected)
-            this._selectedExecutionContextPathComponent = newExecutionContextPathComponent;
+        console.assert(target.type === WI.Target.Type.Worker);
+        let preferredName = WI.UIString("Worker \u2014 %s").format(target.displayName);
+        let executionContextPathComponent = this._createExecutionContextPathComponent(target.executionContext, preferredName);
 
-        this._rebuildExecutionContextPathComponents();
+        this._targetToPathComponent.set(target, executionContextPathComponent);
+        this._insertOtherExecutionContextPathComponent(executionContextPathComponent);
     }
 
-    _pathComponentSelected(event)
+    _targetRemoved(event)
     {
-        if (event.data.pathComponent === this._selectedExecutionContextPathComponent)
+        let target = event.data.target;
+        if (target.type !== WI.Target.Type.Worker)
             return;
 
-        this._selectedExecutionContextPathComponent = event.data.pathComponent;
+        let executionContextPathComponent = this._targetToPathComponent.take(target);
 
-        this._rebuildExecutionContextPathComponents();
+        if (WI.runtimeManager.activeExecutionContext === executionContextPathComponent.representedObject) {
+            this._shouldAutomaticallySelectExecutionContext = true;
+            this._selectExecutionContext();
+        }
+
+        this._removeOtherExecutionContextPathComponent(executionContextPathComponent);
+    }
+
+    _pathComponentSelected(event)
+    {
+        this._shouldAutomaticallySelectExecutionContext = event.data.pathComponent === this._automaticExecutionContextPathComponent;
+        this._selectExecutionContext(event.data.pathComponent.representedObject);
     }
 
     _pathComponentClicked(event)
@@ -332,24 +392,22 @@ WebInspector.QuickConsole = class QuickConsole extends WebInspector.Object
 
     _toggleOrFocus(event)
     {
-        if (this.prompt.focused)
-            WebInspector.toggleSplitConsole();
-        else if (!WebInspector.isEditingAnyField() && !WebInspector.isEventTargetAnEditableField(event))
+        if (this.prompt.focused) {
+            WI.toggleSplitConsole();
+            event.preventDefault();
+        } else if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event)) {
             this.prompt.focus();
+            event.preventDefault();
+        }
     }
-};
-
-WebInspector.QuickConsole.ShowingLogClassName = "showing-log";
-WebInspector.QuickConsole.NavigationBarContainerStyleClassName = "navigation-bar-container";
-WebInspector.QuickConsole.NavigationBarSpacerStyleClassName = "navigation-bar-spacer";
-WebInspector.QuickConsole.TextPromptStyleClassName = "text-prompt";
 
-WebInspector.QuickConsole.ToolbarSingleLineHeight = 21;
-WebInspector.QuickConsole.ToolbarPromptPadding = 4;
-WebInspector.QuickConsole.ToolbarTopBorder = 1;
-
-WebInspector.QuickConsole.MainFrameContextExecutionIdentifier = undefined;
+    _updateStyles()
+    {
+        this.element.classList.toggle("showing-log", WI.isShowingConsoleTab() || WI.isShowingSplitConsole());
+    }
 
-WebInspector.QuickConsole.Event = {
-    DidResize: "quick-console-did-resize"
+    _handleInspectedNodeChanged(event)
+    {
+        this._selectExecutionContext(WI.runtimeManager.activeExecutionContext);
+    }
 };