Changeset 244266 in webkit


Ignore:
Timestamp:
Apr 15, 2019 10:24:54 AM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: replace all uses of this with WI in Main.js/Test.js
https://bugs.webkit.org/show_bug.cgi?id=196795
<rdar://problem/49796618>

Reviewed by Timothy Hatcher.

  • UserInterface/Base/Main.js:
  • UserInterface/Test/Test.js:
Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r244265 r244266  
     12019-04-15  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: replace all uses of `this` with `WI` in Main.js/Test.js
     4        https://bugs.webkit.org/show_bug.cgi?id=196795
     5        <rdar://problem/49796618>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Base/Main.js:
     10        * UserInterface/Test/Test.js:
     11
    1122019-04-15  Devin Rousso  <drousso@apple.com>
    213
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r244180 r244266  
    9595    // Listen for the ProvisionalLoadStarted event before registering for events so our code gets called before any managers or sidebars.
    9696    // This lets us save a state cookie before any managers or sidebars do any resets that would affect state (namely TimelineManager).
    97     WI.Frame.addEventListener(WI.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
     97    WI.Frame.addEventListener(WI.Frame.Event.ProvisionalLoadStarted, WI._provisionalLoadStarted,);
    9898
    9999    // Populate any UIStrings that must be done early after localized strings have loaded.
     
    126126
    127127    // Register for events.
    128     WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
    129     WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
    130     WI.domManager.addEventListener(WI.DOMManager.Event.InspectModeStateChanged, this._inspectModeStateChanged, this);
    131     WI.domManager.addEventListener(WI.DOMManager.Event.DOMNodeWasInspected, this._domNodeWasInspected, this);
    132     WI.domStorageManager.addEventListener(WI.DOMStorageManager.Event.DOMStorageObjectWasInspected, this._domStorageWasInspected, this);
    133     WI.databaseManager.addEventListener(WI.DatabaseManager.Event.DatabaseWasInspected, this._databaseWasInspected, this);
    134     WI.networkManager.addEventListener(WI.NetworkManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
    135     WI.networkManager.addEventListener(WI.NetworkManager.Event.FrameWasAdded, this._frameWasAdded, this);
    136 
    137     WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
    138 
    139     document.addEventListener("DOMContentLoaded", this.contentLoaded.bind(this));
     128    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, WI._debuggerDidPause);
     129    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, WI._debuggerDidResume);
     130    WI.domManager.addEventListener(WI.DOMManager.Event.InspectModeStateChanged, WI._inspectModeStateChanged);
     131    WI.domManager.addEventListener(WI.DOMManager.Event.DOMNodeWasInspected, WI._domNodeWasInspected);
     132    WI.domStorageManager.addEventListener(WI.DOMStorageManager.Event.DOMStorageObjectWasInspected, WI._domStorageWasInspected);
     133    WI.databaseManager.addEventListener(WI.DatabaseManager.Event.DatabaseWasInspected, WI._databaseWasInspected);
     134    WI.networkManager.addEventListener(WI.NetworkManager.Event.MainFrameDidChange, WI._mainFrameDidChange);
     135    WI.networkManager.addEventListener(WI.NetworkManager.Event.FrameWasAdded, WI._frameWasAdded);
     136
     137    WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, WI._mainResourceDidChange);
     138
     139    document.addEventListener("DOMContentLoaded", WI.contentLoaded);
    140140
    141141    // Create settings.
    142     this._showingSplitConsoleSetting = new WI.Setting("showing-split-console", false);
    143     this._openTabsSetting = new WI.Setting("open-tab-types", [
     142    WI._showingSplitConsoleSetting = new WI.Setting("showing-split-console", false);
     143    WI._openTabsSetting = new WI.Setting("open-tab-types", [
    144144        WI.ElementsTabContentView.Type,
    145145        WI.NetworkTabContentView.Type,
     
    152152        WI.ConsoleTabContentView.Type,
    153153    ]);
    154     this._selectedTabIndexSetting = new WI.Setting("selected-tab-index", 0);
     154    WI._selectedTabIndexSetting = new WI.Setting("selected-tab-index", 0);
    155155
    156156    // State.
    157     this.printStylesEnabled = false;
    158     this.setZoomFactor(WI.settings.zoomFactor.value);
    159     this.mouseCoords = {x: 0, y: 0};
    160     this.modifierKeys = {altKey: false, metaKey: false, shiftKey: false};
    161     this.visible = false;
    162     this._windowKeydownListeners = [];
    163     this._targetsAvailablePromise = new WI.WrappedPromise;
     157    WI.printStylesEnabled = false;
     158    WI.setZoomFactor(WI.settings.zoomFactor.value);
     159    WI.mouseCoords = {x: 0, y: 0};
     160    WI.modifierKeys = {altKey: false, metaKey: false, shiftKey: false};
     161    WI.visible = false;
     162    WI._windowKeydownListeners = [];
     163    WI._targetsAvailablePromise = new WI.WrappedPromise;
    164164    WI._overridenDeviceUserAgent = null;
    165165    WI._overridenDeviceSettings = new Map;
     
    189189    WI.resetMainExecutionContext();
    190190
    191     this._targetsAvailablePromise.resolve();
     191    WI._targetsAvailablePromise.resolve();
    192192};
    193193
     
    217217
    218218    // Actions to transition the page target.
    219     this.notifications.dispatchEventToListeners(WI.Notification.TransitionPageTarget);
     219    WI.notifications.dispatchEventToListeners(WI.Notification.TransitionPageTarget);
    220220    WI.domManager.transitionPageTarget();
    221221    WI.networkManager.transitionPageTarget();
     
    268268
    269269    // Register for global events.
    270     document.addEventListener("beforecopy", this._beforecopy.bind(this));
    271     document.addEventListener("copy", this._copy.bind(this));
    272 
    273     document.addEventListener("click", this._mouseWasClicked.bind(this));
    274     document.addEventListener("dragover", this._dragOver.bind(this));
    275     document.addEventListener("focus", WI._focusChanged.bind(this), true);
    276 
    277     window.addEventListener("focus", this._windowFocused.bind(this));
    278     window.addEventListener("blur", this._windowBlurred.bind(this));
    279     window.addEventListener("resize", this._windowResized.bind(this));
    280     window.addEventListener("keydown", this._windowKeyDown.bind(this));
    281     window.addEventListener("keyup", this._windowKeyUp.bind(this));
    282     window.addEventListener("mousedown", this._mouseDown.bind(this), true);
    283     window.addEventListener("mousemove", this._mouseMoved.bind(this), true);
    284     window.addEventListener("pagehide", this._pageHidden.bind(this));
    285     window.addEventListener("contextmenu", this._contextMenuRequested.bind(this));
     270    document.addEventListener("beforecopy", WI._beforecopy);
     271    document.addEventListener("copy", WI._copy);
     272
     273    document.addEventListener("click", WI._mouseWasClicked);
     274    document.addEventListener("dragover", WI._dragOver);
     275    document.addEventListener("focus", WI._focusChanged, true);
     276
     277    window.addEventListener("focus", WI._windowFocused);
     278    window.addEventListener("blur", WI._windowBlurred);
     279    window.addEventListener("resize", WI._windowResized);
     280    window.addEventListener("keydown", WI._windowKeyDown);
     281    window.addEventListener("keyup", WI._windowKeyUp);
     282    window.addEventListener("mousedown", WI._mouseDown, true);
     283    window.addEventListener("mousemove", WI._mouseMoved, true);
     284    window.addEventListener("pagehide", WI._pageHidden);
     285    window.addEventListener("contextmenu", WI._contextMenuRequested);
    286286
    287287    // Add platform style classes so the UI can be tweaked per-platform.
     
    300300
    301301    document.body.classList.add(WI.sharedApp.debuggableType);
    302     document.body.setAttribute("dir", this.resolvedLayoutDirection());
    303 
    304     WI.settings.showJavaScriptTypeInformation.addEventListener(WI.Setting.Event.Changed, this._showJavaScriptTypeInformationSettingChanged, this);
    305     WI.settings.enableControlFlowProfiler.addEventListener(WI.Setting.Event.Changed, this._enableControlFlowProfilerSettingChanged, this);
    306     WI.settings.resourceCachingDisabled.addEventListener(WI.Setting.Event.Changed, this._resourceCachingDisabledSettingChanged, this);
     302    document.body.setAttribute("dir", WI.resolvedLayoutDirection());
     303
     304    WI.settings.showJavaScriptTypeInformation.addEventListener(WI.Setting.Event.Changed, WI._showJavaScriptTypeInformationSettingChanged);
     305    WI.settings.enableControlFlowProfiler.addEventListener(WI.Setting.Event.Changed, WI._enableControlFlowProfilerSettingChanged);
     306    WI.settings.resourceCachingDisabled.addEventListener(WI.Setting.Event.Changed, WI._resourceCachingDisabledSettingChanged);
    307307
    308308    function setTabSize() {
     
    324324    setWhitespaceCharacterClassName();
    325325
    326     this.settingsTabContentView = new WI.SettingsTabContentView;
    327 
    328     this._settingsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Comma, this._showSettingsTab.bind(this));
     326    WI.settingsTabContentView = new WI.SettingsTabContentView;
     327
     328    WI._settingsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Comma, WI._showSettingsTab);
    329329
    330330    // Create the user interface elements.
    331     this.toolbar = new WI.Toolbar(document.getElementById("toolbar"));
     331    WI.toolbar = new WI.Toolbar(document.getElementById("toolbar"));
    332332
    333333    if (WI.settings.experimentalEnableNewTabBar.value)
    334         this.tabBar = new WI.TabBar(document.getElementById("tab-bar"));
     334        WI.tabBar = new WI.TabBar(document.getElementById("tab-bar"));
    335335    else {
    336         this.tabBar = new WI.LegacyTabBar(document.getElementById("tab-bar"));
    337         this.tabBar.addEventListener(WI.TabBar.Event.OpenDefaultTab, this._openDefaultTab, this);
    338     }
    339 
    340     this._contentElement = document.getElementById("content");
    341     this._contentElement.setAttribute("role", "main");
    342     this._contentElement.setAttribute("aria-label", WI.UIString("Content"));
    343 
    344     this.clearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "K", this._clear.bind(this));
     336        WI.tabBar = new WI.LegacyTabBar(document.getElementById("tab-bar"));
     337        WI.tabBar.addEventListener(WI.TabBar.Event.OpenDefaultTab, WI._openDefaultTab);
     338    }
     339
     340    WI._contentElement = document.getElementById("content");
     341    WI._contentElement.setAttribute("role", "main");
     342    WI._contentElement.setAttribute("aria-label", WI.UIString("Content"));
     343
     344    WI.clearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "K", WI._clear);
    345345
    346346    // FIXME: <https://webkit.org/b/151310> Web Inspector: Command-E should propagate to other search fields (including the system)
    347     this.populateFindKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "E", this._populateFind.bind(this));
    348     this.populateFindKeyboardShortcut.implicitlyPreventsDefault = false;
    349     this.findNextKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._findNext.bind(this));
    350     this.findPreviousKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._findPrevious.bind(this));
    351 
    352     this.consoleDrawer = new WI.ConsoleDrawer(document.getElementById("console-drawer"));
    353     this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._consoleDrawerCollapsedStateDidChange, this);
    354     this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.Resized, this._consoleDrawerDidResize, this);
    355 
    356     this.quickConsole = new WI.QuickConsole(document.getElementById("quick-console"));
    357 
    358     this._consoleRepresentedObject = new WI.LogObject;
    359     this.consoleContentView = this.consoleDrawer.contentViewForRepresentedObject(this._consoleRepresentedObject);
    360     this.consoleLogViewController = this.consoleContentView.logViewController;
    361     this.breakpointPopoverController = new WI.BreakpointPopoverController;
     347    WI.populateFindKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "E", WI._populateFind);
     348    WI.populateFindKeyboardShortcut.implicitlyPreventsDefault = false;
     349    WI.findNextKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "G", WI._findNext);
     350    WI.findPreviousKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "G", WI._findPrevious);
     351
     352    WI.consoleDrawer = new WI.ConsoleDrawer(document.getElementById("console-drawer"));
     353    WI.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, WI._consoleDrawerCollapsedStateDidChange);
     354    WI.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.Resized, WI._consoleDrawerDidResize);
     355
     356    WI.quickConsole = new WI.QuickConsole(document.getElementById("quick-console"));
     357
     358    WI._consoleRepresentedObject = new WI.LogObject;
     359    WI.consoleContentView = WI.consoleDrawer.contentViewForRepresentedObject(WI._consoleRepresentedObject);
     360    WI.consoleLogViewController = WI.consoleContentView.logViewController;
     361    WI.breakpointPopoverController = new WI.BreakpointPopoverController;
    362362
    363363    // FIXME: The sidebars should be flipped in RTL languages.
    364     this.navigationSidebar = new WI.Sidebar(document.getElementById("navigation-sidebar"), WI.Sidebar.Sides.Left);
    365     this.navigationSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
    366 
    367     this.detailsSidebar = new WI.Sidebar(document.getElementById("details-sidebar"), WI.Sidebar.Sides.Right, null, null, WI.UIString("Details"), true);
    368     this.detailsSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
    369 
    370     this.searchKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "F", this._focusSearchField.bind(this));
    371     this._findKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "F", this._find.bind(this));
    372     this.saveKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this));
    373     this._saveAsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "S", this._saveAs.bind(this));
    374 
    375     this.openResourceKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "O", this._showOpenResourceDialog.bind(this));
    376     new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "P", this._showOpenResourceDialog.bind(this));
    377 
    378     this.navigationSidebarKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "0", this.toggleNavigationSidebar.bind(this));
    379     this.detailsSidebarKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "0", this.toggleDetailsSidebar.bind(this));
    380 
    381     let boundIncreaseZoom = this._increaseZoom.bind(this);
    382     let boundDecreaseZoom = this._decreaseZoom.bind(this);
    383     this._increaseZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
    384     this._decreaseZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
    385     this._increaseZoomKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, WI.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
    386     this._decreaseZoomKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, WI.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
    387     this._resetZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "0", this._resetZoom.bind(this));
    388 
    389     this._showTabAtIndexKeyboardShortcuts = [1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, `${i}`, this._showTabAtIndex.bind(this, i)));
    390     this._openNewTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "T", this.showNewTabTab.bind(this));
    391 
    392     this.tabBrowser = new WI.TabBrowser(document.getElementById("tab-browser"), this.tabBar, this.navigationSidebar, this.detailsSidebar);
    393     this.tabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
    394 
    395     this._reloadPageKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "R", this._reloadPage.bind(this));
    396     this._reloadPageFromOriginKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "R", this._reloadPageFromOrigin.bind(this));
    397     this._reloadPageKeyboardShortcut.implicitlyPreventsDefault = this._reloadPageFromOriginKeyboardShortcut.implicitlyPreventsDefault = false;
    398 
    399     this._consoleTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.CommandOrControl, "C", this._showConsoleTab.bind(this));
    400     this._quickConsoleKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control, WI.KeyboardShortcut.Key.Apostrophe, this._focusConsolePrompt.bind(this));
    401 
    402     this._inspectModeKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "C", this._toggleInspectMode.bind(this));
    403 
    404     this._undoKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "Z", this._undoKeyboardShortcut.bind(this));
    405     this._redoKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "Z", this._redoKeyboardShortcut.bind(this));
    406     this._undoKeyboardShortcut.implicitlyPreventsDefault = this._redoKeyboardShortcut.implicitlyPreventsDefault = false;
    407 
    408     this.toggleBreakpointsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "Y", this.debuggerToggleBreakpoints.bind(this));
    409     this.pauseOrResumeKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control | WI.KeyboardShortcut.Modifier.CommandOrControl, "Y", this.debuggerPauseResumeToggle.bind(this));
    410     this.stepOverKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F6, this.debuggerStepOver.bind(this));
    411     this.stepIntoKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F7, this.debuggerStepInto.bind(this));
    412     this.stepOutKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F8, this.debuggerStepOut.bind(this));
    413 
    414     this.pauseOrResumeAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Backslash, this.debuggerPauseResumeToggle.bind(this));
    415     this.stepOverAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.SingleQuote, this.debuggerStepOver.bind(this));
    416     this.stepIntoAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Semicolon, this.debuggerStepInto.bind(this));
    417     this.stepOutAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Semicolon, this.debuggerStepOut.bind(this));
    418 
    419     this._closeToolbarButton = new WI.ControlToolbarItem("dock-close", WI.UIString("Close"), "Images/Close.svg", 16, 14);
    420     this._closeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this.close, this);
    421 
    422     this._undockToolbarButton = new WI.ButtonToolbarItem("undock", WI.UIString("Detach into separate window"), "Images/Undock.svg");
    423     this._undockToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
    424     this._undockToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._undock, this);
     364    WI.navigationSidebar = new WI.Sidebar(document.getElementById("navigation-sidebar"), WI.Sidebar.Sides.Left);
     365    WI.navigationSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, WI._sidebarWidthDidChange);
     366
     367    WI.detailsSidebar = new WI.Sidebar(document.getElementById("details-sidebar"), WI.Sidebar.Sides.Right, null, null, WI.UIString("Details"), true);
     368    WI.detailsSidebar.addEventListener(WI.Sidebar.Event.WidthDidChange, WI._sidebarWidthDidChange);
     369
     370    WI.searchKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "F", WI._focusSearchField);
     371    WI._findKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "F", WI._find);
     372    WI.saveKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "S", WI._save);
     373    WI._saveAsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "S", WI._saveAs);
     374
     375    WI.openResourceKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "O", WI._showOpenResourceDialog);
     376    new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "P", WI._showOpenResourceDialog);
     377
     378    WI.navigationSidebarKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "0", WI.toggleNavigationSidebar);
     379    WI.detailsSidebarKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "0", WI.toggleDetailsSidebar);
     380
     381    let boundIncreaseZoom = WI._increaseZoom;
     382    let boundDecreaseZoom = WI._decreaseZoom;
     383    WI._increaseZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
     384    WI._decreaseZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
     385    WI._increaseZoomKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, WI.KeyboardShortcut.Key.Plus, boundIncreaseZoom);
     386    WI._decreaseZoomKeyboardShortcut2 = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, WI.KeyboardShortcut.Key.Minus, boundDecreaseZoom);
     387    WI._resetZoomKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "0", WI._resetZoom);
     388
     389    WI._showTabAtIndexKeyboardShortcuts = [1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, `${i}`, (event) => { WI._showTabAtIndex(i); }));
     390    WI._openNewTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "T", WI.showNewTabTab);
     391
     392    WI.tabBrowser = new WI.TabBrowser(document.getElementById("tab-browser"), WI.tabBar, WI.navigationSidebar, WI.detailsSidebar);
     393    WI.tabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, WI._tabBrowserSelectedTabContentViewDidChange);
     394
     395    WI._reloadPageKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "R", WI._reloadPage);
     396    WI._reloadPageFromOriginKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "R", WI._reloadPageFromOrigin);
     397    WI._reloadPageKeyboardShortcut.implicitlyPreventsDefault = WI._reloadPageFromOriginKeyboardShortcut.implicitlyPreventsDefault = false;
     398
     399    WI._consoleTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.CommandOrControl, "C", WI._showConsoleTab);
     400    WI._quickConsoleKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control, WI.KeyboardShortcut.Key.Apostrophe, WI._focusConsolePrompt);
     401
     402    WI._inspectModeKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "C", WI._toggleInspectMode);
     403
     404    WI._undoKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "Z", WI._undoKeyboardShortcut);
     405    WI._redoKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "Z", WI._redoKeyboardShortcut);
     406    WI._undoKeyboardShortcut.implicitlyPreventsDefault = WI._redoKeyboardShortcut.implicitlyPreventsDefault = false;
     407
     408    WI.toggleBreakpointsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "Y", WI.debuggerToggleBreakpoints);
     409    WI.pauseOrResumeKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control | WI.KeyboardShortcut.Modifier.CommandOrControl, "Y", WI.debuggerPauseResumeToggle);
     410    WI.stepOverKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F6, WI.debuggerStepOver);
     411    WI.stepIntoKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F7, WI.debuggerStepInto);
     412    WI.stepOutKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.F8, WI.debuggerStepOut);
     413
     414    WI.pauseOrResumeAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Backslash, WI.debuggerPauseResumeToggle);
     415    WI.stepOverAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.SingleQuote, WI.debuggerStepOver);
     416    WI.stepIntoAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Semicolon, WI.debuggerStepInto);
     417    WI.stepOutAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Semicolon, WI.debuggerStepOut);
     418
     419    WI._closeToolbarButton = new WI.ControlToolbarItem("dock-close", WI.UIString("Close"), "Images/Close.svg", 16, 14);
     420    WI._closeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI.close);
     421
     422    WI._undockToolbarButton = new WI.ButtonToolbarItem("undock", WI.UIString("Detach into separate window"), "Images/Undock.svg");
     423    WI._undockToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
     424    WI._undockToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._undock);
    425425
    426426    let dockImage = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? "Images/DockLeft.svg" : "Images/DockRight.svg";
    427     this._dockToSideToolbarButton = new WI.ButtonToolbarItem("dock-right", WI.UIString("Dock to side of window"), dockImage);
    428     this._dockToSideToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
    429 
    430     let dockToSideCallback = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? this._dockLeft : this._dockRight;
    431     this._dockToSideToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, dockToSideCallback, this);
    432 
    433     this._dockBottomToolbarButton = new WI.ButtonToolbarItem("dock-bottom", WI.UIString("Dock to bottom of window"), "Images/DockBottom.svg");
    434     this._dockBottomToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
    435     this._dockBottomToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._dockBottom, this);
    436 
    437     this._togglePreviousDockConfigurationKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "D", this._togglePreviousDockConfiguration.bind(this));
     427    WI._dockToSideToolbarButton = new WI.ButtonToolbarItem("dock-right", WI.UIString("Dock to side of window"), dockImage);
     428    WI._dockToSideToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
     429
     430    let dockToSideCallback = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? WI._dockLeft : WI._dockRight;
     431    WI._dockToSideToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, dockToSideCallback);
     432
     433    WI._dockBottomToolbarButton = new WI.ButtonToolbarItem("dock-bottom", WI.UIString("Dock to bottom of window"), "Images/DockBottom.svg");
     434    WI._dockBottomToolbarButton.element.classList.add(WI.Popover.IgnoreAutoDismissClassName);
     435    WI._dockBottomToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._dockBottom);
     436
     437    WI._togglePreviousDockConfigurationKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "D", WI._togglePreviousDockConfiguration);
    438438
    439439    let reloadToolTip;
    440440    if (WI.sharedApp.debuggableType === WI.DebuggableType.JavaScript)
    441         reloadToolTip = WI.UIString("Restart (%s)").format(this._reloadPageKeyboardShortcut.displayName);
     441        reloadToolTip = WI.UIString("Restart (%s)").format(WI._reloadPageKeyboardShortcut.displayName);
    442442    else
    443         reloadToolTip = WI.UIString("Reload page (%s)\nReload page ignoring cache (%s)").format(this._reloadPageKeyboardShortcut.displayName, this._reloadPageFromOriginKeyboardShortcut.displayName);
    444     this._reloadToolbarButton = new WI.ButtonToolbarItem("reload", reloadToolTip, "Images/ReloadToolbar.svg");
    445     this._reloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._reloadToolbarButtonClicked, this);
    446 
    447     this._downloadToolbarButton = new WI.ButtonToolbarItem("download", WI.UIString("Download Web Archive"), "Images/DownloadArrow.svg");
    448     this._downloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._downloadWebArchive, this);
     443        reloadToolTip = WI.UIString("Reload page (%s)\nReload page ignoring cache (%s)").format(WI._reloadPageKeyboardShortcut.displayName, WI._reloadPageFromOriginKeyboardShortcut.displayName);
     444    WI._reloadToolbarButton = new WI.ButtonToolbarItem("reload", reloadToolTip, "Images/ReloadToolbar.svg");
     445    WI._reloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._reloadToolbarButtonClicked);
     446
     447    WI._downloadToolbarButton = new WI.ButtonToolbarItem("download", WI.UIString("Download Web Archive"), "Images/DownloadArrow.svg");
     448    WI._downloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._downloadWebArchive);
    449449
    450450    let elementSelectionToolTip = WI.UIString("Start element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
    451451    let activatedElementSelectionToolTip = WI.UIString("Stop element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
    452     this._inspectModeToolbarButton = new WI.ActivateButtonToolbarItem("inspect", elementSelectionToolTip, activatedElementSelectionToolTip, "Images/Crosshair.svg");
    453     this._inspectModeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleInspectMode, this);
     452    WI._inspectModeToolbarButton = new WI.ActivateButtonToolbarItem("inspect", elementSelectionToolTip, activatedElementSelectionToolTip, "Images/Crosshair.svg");
     453    WI._inspectModeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._toggleInspectMode);
    454454
    455455    // COMPATIBILITY (iOS 12.2): Page.overrideSetting did not exist.
     
    457457        const deviceSettingsTooltip = WI.UIString("Device Settings");
    458458        WI._deviceSettingsToolbarButton = new WI.ActivateButtonToolbarItem("device-settings", deviceSettingsTooltip, deviceSettingsTooltip, "Images/Device.svg");
    459         WI._deviceSettingsToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._handleDeviceSettingsToolbarButtonClicked, this);
     459        WI._deviceSettingsToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, WI._handleDeviceSettingsToolbarButtonClicked);
    460460
    461461        WI._deviceSettingsPopover = null;
    462462    }
    463463
    464     this._updateReloadToolbarButton();
    465     this._updateDownloadToolbarButton();
    466     this._updateInspectModeToolbarButton();
    467 
    468     this._dashboards = {
     464    WI._updateReloadToolbarButton();
     465    WI._updateDownloadToolbarButton();
     466    WI._updateInspectModeToolbarButton();
     467
     468    WI._dashboards = {
    469469        default: new WI.DefaultDashboard,
    470470        debugger: new WI.DebuggerDashboard,
    471471    };
    472472
    473     this._dashboardContainer = new WI.DashboardContainerView;
    474     this._dashboardContainer.showDashboardViewForRepresentedObject(this._dashboards.default);
    475 
    476     this.toolbar.addToolbarItem(this._closeToolbarButton, WI.Toolbar.Section.Control);
    477 
    478     this.toolbar.addToolbarItem(this._undockToolbarButton, WI.Toolbar.Section.Left);
    479     this.toolbar.addToolbarItem(this._dockToSideToolbarButton, WI.Toolbar.Section.Left);
    480     this.toolbar.addToolbarItem(this._dockBottomToolbarButton, WI.Toolbar.Section.Left);
    481 
    482     this.toolbar.addToolbarItem(this._reloadToolbarButton, WI.Toolbar.Section.CenterLeft);
    483     this.toolbar.addToolbarItem(this._downloadToolbarButton, WI.Toolbar.Section.CenterLeft);
    484 
    485     this.toolbar.addToolbarItem(this._dashboardContainer.toolbarItem, WI.Toolbar.Section.Center);
    486 
    487     this.toolbar.addToolbarItem(this._inspectModeToolbarButton, WI.Toolbar.Section.CenterRight);
     473    WI._dashboardContainer = new WI.DashboardContainerView;
     474    WI._dashboardContainer.showDashboardViewForRepresentedObject(WI._dashboards.default);
     475
     476    WI.toolbar.addToolbarItem(WI._closeToolbarButton, WI.Toolbar.Section.Control);
     477
     478    WI.toolbar.addToolbarItem(WI._undockToolbarButton, WI.Toolbar.Section.Left);
     479    WI.toolbar.addToolbarItem(WI._dockToSideToolbarButton, WI.Toolbar.Section.Left);
     480    WI.toolbar.addToolbarItem(WI._dockBottomToolbarButton, WI.Toolbar.Section.Left);
     481
     482    WI.toolbar.addToolbarItem(WI._reloadToolbarButton, WI.Toolbar.Section.CenterLeft);
     483    WI.toolbar.addToolbarItem(WI._downloadToolbarButton, WI.Toolbar.Section.CenterLeft);
     484
     485    WI.toolbar.addToolbarItem(WI._dashboardContainer.toolbarItem, WI.Toolbar.Section.Center);
     486
     487    WI.toolbar.addToolbarItem(WI._inspectModeToolbarButton, WI.Toolbar.Section.CenterRight);
    488488
    489489    if (WI._deviceSettingsToolbarButton)
    490         this.toolbar.addToolbarItem(WI._deviceSettingsToolbarButton, WI.Toolbar.Section.CenterRight);
    491 
    492     this._searchTabContentView = new WI.SearchTabContentView;
     490        WI.toolbar.addToolbarItem(WI._deviceSettingsToolbarButton, WI.Toolbar.Section.CenterRight);
     491
     492    WI._searchTabContentView = new WI.SearchTabContentView;
    493493
    494494    if (WI.settings.experimentalEnableNewTabBar.value) {
    495         this.tabBrowser.addTabForContentView(this._searchTabContentView, {suppressAnimations: true});
    496         this.tabBar.addTabBarItem(this.settingsTabContentView.tabBarItem, {suppressAnimations: true});
     495        WI.tabBrowser.addTabForContentView(WI._searchTabContentView, {suppressAnimations: true});
     496        WI.tabBar.addTabBarItem(WI.settingsTabContentView.tabBarItem, {suppressAnimations: true});
    497497    } else {
    498498        const incremental = false;
    499         this._searchToolbarItem = new WI.SearchBar("inspector-search", WI.UIString("Search"), incremental);
    500         this._searchToolbarItem.addEventListener(WI.SearchBar.Event.TextChanged, this._searchTextDidChange, this);
    501         this.toolbar.addToolbarItem(this._searchToolbarItem, WI.Toolbar.Section.Right);
     499        WI._searchToolbarItem = new WI.SearchBar("inspector-search", WI.UIString("Search"), incremental);
     500        WI._searchToolbarItem.addEventListener(WI.SearchBar.Event.TextChanged, WI._searchTextDidChange);
     501        WI.toolbar.addToolbarItem(WI._searchToolbarItem, WI.Toolbar.Section.Right);
    502502    }
    503503
    504504    let dockedResizerElement = document.getElementById("docked-resizer");
    505505    dockedResizerElement.classList.add(WI.Popover.IgnoreAutoDismissClassName);
    506     dockedResizerElement.addEventListener("mousedown", this._dockedResizerMouseDown.bind(this));
    507 
    508     this._dockingAvailable = false;
    509 
    510     this._updateDockNavigationItems();
    511     this._setupViewHierarchy();
     506    dockedResizerElement.addEventListener("mousedown", WI._dockedResizerMouseDown);
     507
     508    WI._dockingAvailable = false;
     509
     510    WI._updateDockNavigationItems();
     511    WI._setupViewHierarchy();
    512512
    513513    // These tabs are always available for selecting, modulo isTabAllowed().
     
    530530    ];
    531531
    532     this._knownTabClassesByType = new Map;
     532    WI._knownTabClassesByType = new Map;
    533533    // Set tab classes directly. The public API triggers other updates and
    534     // notifications that won't work or have no listeners at this point.
     534    // notifications that won't work or have no listeners at WI point.
    535535    for (let tabClass of productionTabClasses)
    536         this._knownTabClassesByType.set(tabClass.Type, tabClass);
    537 
    538     this._pendingOpenTabs = [];
    539 
    540     // Previously we may have stored duplicates in this setting. Avoid creating duplicate tabs.
    541     let openTabTypes = this._openTabsSetting.value;
     536        WI._knownTabClassesByType.set(tabClass.Type, tabClass);
     537
     538    WI._pendingOpenTabs = [];
     539
     540    // Previously we may have stored duplicates in WI setting. Avoid creating duplicate tabs.
     541    let openTabTypes = WI._openTabsSetting.value;
    542542    let seenTabTypes = new Set;
    543543
     
    549549        seenTabTypes.add(tabType);
    550550
    551         if (!this.isTabTypeAllowed(tabType)) {
    552             this._pendingOpenTabs.push({tabType, index: i});
     551        if (!WI.isTabTypeAllowed(tabType)) {
     552            WI._pendingOpenTabs.push({tabType, index: i});
    553553            continue;
    554554        }
    555555
    556         if (!this.isNewTabWithTypeAllowed(tabType))
     556        if (!WI.isNewTabWithTypeAllowed(tabType))
    557557            continue;
    558558
    559         let tabContentView = this._createTabContentViewForType(tabType);
     559        let tabContentView = WI._createTabContentViewForType(tabType);
    560560        if (!tabContentView)
    561561            continue;
    562         this.tabBrowser.addTabForContentView(tabContentView, {suppressAnimations: true});
    563     }
    564 
    565     this._restoreCookieForOpenTabs(WI.StateRestorationType.Load);
    566 
    567     this.tabBar.selectedTabBarItem = this._selectedTabIndexSetting.value;
    568 
    569     if (!this.tabBar.selectedTabBarItem)
    570         this.tabBar.selectedTabBarItem = 0;
    571 
    572     if (!this.tabBar.normalTabCount)
    573         this.showNewTabTab({suppressAnimations: true});
     562        WI.tabBrowser.addTabForContentView(tabContentView, {suppressAnimations: true});
     563    }
     564
     565    WI._restoreCookieForOpenTabs(WI.StateRestorationType.Load);
     566
     567    WI.tabBar.selectedTabBarItem = WI._selectedTabIndexSetting.value;
     568
     569    if (!WI.tabBar.selectedTabBarItem)
     570        WI.tabBar.selectedTabBarItem = 0;
     571
     572    if (!WI.tabBar.normalTabCount)
     573        WI.showNewTabTab({suppressAnimations: true});
    574574
    575575    // Listen to the events after restoring the saved tabs to avoid recursion.
    576     this.tabBar.addEventListener(WI.TabBar.Event.TabBarItemAdded, this._rememberOpenTabs, this);
    577     this.tabBar.addEventListener(WI.TabBar.Event.TabBarItemRemoved, this._rememberOpenTabs, this);
    578     this.tabBar.addEventListener(WI.TabBar.Event.TabBarItemsReordered, this._rememberOpenTabs, this);
     576    WI.tabBar.addEventListener(WI.TabBar.Event.TabBarItemAdded, WI._rememberOpenTabs);
     577    WI.tabBar.addEventListener(WI.TabBar.Event.TabBarItemRemoved, WI._rememberOpenTabs);
     578    WI.tabBar.addEventListener(WI.TabBar.Event.TabBarItemsReordered, WI._rememberOpenTabs);
    579579
    580580    // Signal that the frontend is now ready to receive messages.
     
    590590    InspectorFrontendHost.loaded();
    591591
    592     if (this._showingSplitConsoleSetting.value)
    593         this.showSplitConsole();
    594 
    595     // Store this on the window in case the WebInspector global gets corrupted.
     592    if (WI._showingSplitConsoleSetting.value)
     593        WI.showSplitConsole();
     594
     595    // Store WI on the window in case the WebInspector global gets corrupted.
    596596    window.__frontendCompletedLoad = true;
    597597
     
    638638WI.targetsAvailable = function()
    639639{
    640     return this._targetsAvailablePromise.settled;
     640    return WI._targetsAvailablePromise.settled;
    641641};
    642642
    643643WI.whenTargetsAvailable = function()
    644644{
    645     return this._targetsAvailablePromise.promise;
     645    return WI._targetsAvailablePromise.promise;
    646646};
    647647
    648648WI.isTabTypeAllowed = function(tabType)
    649649{
    650     let tabClass = this._knownTabClassesByType.get(tabType);
     650    let tabClass = WI._knownTabClassesByType.get(tabType);
    651651    if (!tabClass)
    652652        return false;
     
    657657WI.knownTabClasses = function()
    658658{
    659     return new Set(this._knownTabClassesByType.values());
     659    return new Set(WI._knownTabClassesByType.values());
    660660};
    661661
    662662WI._showOpenResourceDialog = function()
    663663{
    664     if (!this._openResourceDialog)
    665         this._openResourceDialog = new WI.OpenResourceDialog(this);
    666 
    667     if (this._openResourceDialog.visible)
    668         return;
    669 
    670     this._openResourceDialog.present(this._contentElement);
     664    if (!WI._openResourceDialog)
     665        WI._openResourceDialog = new WI.OpenResourceDialog(WI);
     666
     667    if (WI._openResourceDialog.visible)
     668        return;
     669
     670    WI._openResourceDialog.present(WI._contentElement);
    671671};
    672672
    673673WI._createTabContentViewForType = function(tabType)
    674674{
    675     let tabClass = this._knownTabClassesByType.get(tabType);
     675    let tabClass = WI._knownTabClassesByType.get(tabType);
    676676    if (!tabClass) {
    677677        console.error("Unknown tab type", tabType);
     
    688688    let openTabs = [];
    689689
    690     for (let tabBarItem of this.tabBar.tabBarItems) {
     690    for (let tabBarItem of WI.tabBar.tabBarItems) {
    691691        let tabContentView = tabBarItem.representedObject;
    692692        if (!(tabContentView instanceof WI.TabContentView))
     
    700700
    701701    // Keep currently unsupported tabs in the setting at their previous index.
    702     for (let {tabType, index} of this._pendingOpenTabs) {
     702    for (let {tabType, index} of WI._pendingOpenTabs) {
    703703        if (seenTabTypes.has(tabType))
    704704            continue;
     
    707707    }
    708708
    709     this._openTabsSetting.value = openTabs;
     709    WI._openTabsSetting.value = openTabs;
    710710};
    711711
    712712WI._openDefaultTab = function(event)
    713713{
    714     this.showNewTabTab({suppressAnimations: true});
     714    WI.showNewTabTab({suppressAnimations: true});
    715715};
    716716
     
    718718{
    719719    if (event.keyIdentifier === "U+002C") // ","
    720         this.tabBrowser.showTabForContentView(this.settingsTabContentView);
     720        WI.tabBrowser.showTabForContentView(WI.settingsTabContentView);
    721721};
    722722
     
    724724{
    725725    let stillPendingOpenTabs = [];
    726     for (let {tabType, index} of this._pendingOpenTabs) {
    727         if (!this.isTabTypeAllowed(tabType)) {
     726    for (let {tabType, index} of WI._pendingOpenTabs) {
     727        if (!WI.isTabTypeAllowed(tabType)) {
    728728            stillPendingOpenTabs.push({tabType, index});
    729729            continue;
    730730        }
    731731
    732         let tabContentView = this._createTabContentViewForType(tabType);
     732        let tabContentView = WI._createTabContentViewForType(tabType);
    733733        if (!tabContentView)
    734734            continue;
    735735
    736         this.tabBrowser.addTabForContentView(tabContentView, {
     736        WI.tabBrowser.addTabForContentView(tabContentView, {
    737737            suppressAnimations: true,
    738738            insertionIndex: index,
     
    742742    }
    743743
    744     this._pendingOpenTabs = stillPendingOpenTabs;
     744    WI._pendingOpenTabs = stillPendingOpenTabs;
    745745
    746746    if (!WI.settings.experimentalEnableNewTabBar.value)
    747         this.tabBar.updateNewTabTabBarItemState();
     747        WI.tabBar.updateNewTabTabBarItemState();
    748748};
    749749
    750750WI.showNewTabTab = function(options)
    751751{
    752     if (!this.isNewTabWithTypeAllowed(WI.NewTabContentView.Type))
    753         return;
    754 
    755     let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.NewTabContentView);
     752    if (!WI.isNewTabWithTypeAllowed(WI.NewTabContentView.Type))
     753        return;
     754
     755    let tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.NewTabContentView);
    756756    if (!tabContentView)
    757757        tabContentView = new WI.NewTabContentView;
    758     this.tabBrowser.showTabForContentView(tabContentView, options);
     758    WI.tabBrowser.showTabForContentView(tabContentView, options);
    759759};
    760760
    761761WI.isNewTabWithTypeAllowed = function(tabType)
    762762{
    763     let tabClass = this._knownTabClassesByType.get(tabType);
     763    let tabClass = WI._knownTabClassesByType.get(tabType);
    764764    if (!tabClass || !tabClass.isTabAllowed())
    765765        return false;
    766766
    767767    // Only allow one tab per class for now.
    768     for (let tabBarItem of this.tabBar.tabBarItems) {
     768    for (let tabBarItem of WI.tabBar.tabBarItems) {
    769769        let tabContentView = tabBarItem.representedObject;
    770770        if (!(tabContentView instanceof WI.TabContentView))
     
    775775
    776776    if (tabClass === WI.NewTabContentView) {
    777         let allTabs = Array.from(this.knownTabClasses());
     777        let allTabs = Array.from(WI.knownTabClasses());
    778778        let addableTabs = allTabs.filter((tabClass) => !tabClass.tabInfo().isEphemeral);
    779779        let canMakeNewTab = addableTabs.some((tabClass) => WI.isNewTabWithTypeAllowed(tabClass.Type));
     
    786786WI.createNewTabWithType = function(tabType, options = {})
    787787{
    788     console.assert(this.isNewTabWithTypeAllowed(tabType));
     788    console.assert(WI.isNewTabWithTypeAllowed(tabType));
    789789
    790790    let {referencedView, shouldReplaceTab, shouldShowNewTab} = options;
     
    792792    console.assert(!shouldReplaceTab || referencedView, "Must provide a reference view to replace a tab.");
    793793
    794     let tabContentView = this._createTabContentViewForType(tabType);
     794    let tabContentView = WI._createTabContentViewForType(tabType);
    795795    const suppressAnimations = true;
    796     this.tabBrowser.addTabForContentView(tabContentView, {
     796    WI.tabBrowser.addTabForContentView(tabContentView, {
    797797        suppressAnimations,
    798         insertionIndex: referencedView ? this.tabBar.tabBarItems.indexOf(referencedView.tabBarItem) : undefined,
     798        insertionIndex: referencedView ? WI.tabBar.tabBarItems.indexOf(referencedView.tabBarItem) : undefined,
    799799    });
    800800
    801801    if (shouldReplaceTab)
    802         this.tabBrowser.closeTabForContentView(referencedView, {suppressAnimations});
     802        WI.tabBrowser.closeTabForContentView(referencedView, {suppressAnimations});
    803803
    804804    if (shouldShowNewTab)
    805         this.tabBrowser.showTabForContentView(tabContentView);
     805        WI.tabBrowser.showTabForContentView(tabContentView);
    806806};
    807807
    808808WI.activateExtraDomains = function(domains)
    809809{
    810     this.notifications.dispatchEventToListeners(WI.Notification.ExtraDomainsActivated, {domains});
     810    WI.notifications.dispatchEventToListeners(WI.Notification.ExtraDomainsActivated, {domains});
    811811
    812812    if (WI.mainTarget) {
     
    824824    }
    825825
    826     this._updateReloadToolbarButton();
    827     this._updateDownloadToolbarButton();
    828     this._updateInspectModeToolbarButton();
    829 
    830     this._tryToRestorePendingTabs();
     826    WI._updateReloadToolbarButton();
     827    WI._updateDownloadToolbarButton();
     828    WI._updateInspectModeToolbarButton();
     829
     830    WI._tryToRestorePendingTabs();
    831831};
    832832
    833833WI.updateWindowTitle = function()
    834834{
    835     var mainFrame = this.networkManager.mainFrame;
     835    var mainFrame = WI.networkManager.mainFrame;
    836836    if (!mainFrame)
    837837        return;
     
    848848    // Build a title based on the URL components.
    849849    if (urlComponents.host && lastPathComponent)
    850         var title = this.displayNameForHost(urlComponents.host) + " \u2014 " + lastPathComponent;
     850        var title = WI.displayNameForHost(urlComponents.host) + " \u2014 " + lastPathComponent;
    851851    else if (urlComponents.host)
    852         var title = this.displayNameForHost(urlComponents.host);
     852        var title = WI.displayNameForHost(urlComponents.host);
    853853    else if (lastPathComponent)
    854854        var title = lastPathComponent;
     
    856856        var title = mainFrame.url;
    857857
    858     // The name "inspectedURLChanged" sounds like the whole URL is required, however this is only
     858    // The name "inspectedURLChanged" sounds like the whole URL is required, however WI is only
    859859    // used for updating the window title and it can be any string.
    860860    InspectorFrontendHost.inspectedURLChanged(title);
     
    863863WI.updateDockingAvailability = function(available)
    864864{
    865     this._dockingAvailable = available;
    866 
    867     this._updateDockNavigationItems();
     865    WI._dockingAvailable = available;
     866
     867    WI._updateDockNavigationItems();
    868868};
    869869
    870870WI.updateDockedState = function(side)
    871871{
    872     if (this._dockConfiguration === side)
    873         return;
    874 
    875     this._previousDockConfiguration = this._dockConfiguration;
    876 
    877     if (!this._previousDockConfiguration) {
     872    if (WI._dockConfiguration === side)
     873        return;
     874
     875    WI._previousDockConfiguration = WI._dockConfiguration;
     876
     877    if (!WI._previousDockConfiguration) {
    878878        if (side === WI.DockConfiguration.Right || side === WI.DockConfiguration.Left)
    879             this._previousDockConfiguration = WI.DockConfiguration.Bottom;
     879            WI._previousDockConfiguration = WI.DockConfiguration.Bottom;
    880880        else
    881             this._previousDockConfiguration = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? WI.DockConfiguration.Left : WI.DockConfiguration.Right;
    882     }
    883 
    884     this._dockConfiguration = side;
    885 
    886     this.docked = side !== WI.DockConfiguration.Undocked;
    887 
    888     this._ignoreToolbarModeDidChangeEvents = true;
     881            WI._previousDockConfiguration = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL ? WI.DockConfiguration.Left : WI.DockConfiguration.Right;
     882    }
     883
     884    WI._dockConfiguration = side;
     885
     886    WI.docked = side !== WI.DockConfiguration.Undocked;
     887
     888    WI._ignoreToolbarModeDidChangeEvents = true;
    889889
    890890    if (side === WI.DockConfiguration.Bottom) {
     
    900900        document.body.classList.remove("docked", WI.DockConfiguration.Right, WI.DockConfiguration.Left, WI.DockConfiguration.Bottom);
    901901
    902     this._ignoreToolbarModeDidChangeEvents = false;
    903 
    904     this._updateDockNavigationItems();
    905 
    906     if (!this.dockedConfigurationSupportsSplitContentBrowser() && !this.doesCurrentTabSupportSplitContentBrowser())
    907         this.hideSplitConsole();
     902    WI._ignoreToolbarModeDidChangeEvents = false;
     903
     904    WI._updateDockNavigationItems();
     905
     906    if (!WI.dockedConfigurationSupportsSplitContentBrowser() && !WI.doesCurrentTabSupportSplitContentBrowser())
     907        WI.hideSplitConsole();
    908908};
    909909
    910910WI.updateVisibilityState = function(visible)
    911911{
    912     this.visible = visible;
    913     this.notifications.dispatchEventToListeners(WI.Notification.VisibilityStateDidChange);
     912    WI.visible = visible;
     913    WI.notifications.dispatchEventToListeners(WI.Notification.VisibilityStateDidChange);
    914914};
    915915
     
    929929    event.stopPropagation();
    930930
    931     this.openURL(anchorElement.href, frame, {
     931    WI.openURL(anchorElement.href, frame, {
    932932        ...options,
    933933        lineNumber: anchorElement.lineNumber,
     
    957957    let searchChildFrames = false;
    958958    if (!frame) {
    959         frame = this.networkManager.mainFrame;
     959        frame = WI.networkManager.mainFrame;
    960960        searchChildFrames = true;
    961961    }
     
    971971    if (resource) {
    972972        let positionToReveal = new WI.SourceCodePosition(options.lineNumber, 0);
    973         this.showSourceCode(resource, {...options, positionToReveal});
     973        WI.showSourceCode(resource, {...options, positionToReveal});
    974974        return;
    975975    }
     
    980980WI.close = function()
    981981{
    982     if (this._isClosing)
    983         return;
    984 
    985     this._isClosing = true;
     982    if (WI._isClosing)
     983        return;
     984
     985    WI._isClosing = true;
    986986
    987987    InspectorFrontendHost.closeWindow();
     
    990990WI.isConsoleFocused = function()
    991991{
    992     return this.quickConsole.prompt.focused;
     992    return WI.quickConsole.prompt.focused;
    993993};
    994994
    995995WI.isShowingSplitConsole = function()
    996996{
    997     return !this.consoleDrawer.collapsed;
     997    return !WI.consoleDrawer.collapsed;
    998998};
    999999
    10001000WI.dockedConfigurationSupportsSplitContentBrowser = function()
    10011001{
    1002     return this._dockConfiguration !== WI.DockConfiguration.Bottom;
     1002    return WI._dockConfiguration !== WI.DockConfiguration.Bottom;
    10031003};
    10041004
    10051005WI.doesCurrentTabSupportSplitContentBrowser = function()
    10061006{
    1007     var currentContentView = this.tabBrowser.selectedTabContentView;
     1007    var currentContentView = WI.tabBrowser.selectedTabContentView;
    10081008    return !currentContentView || currentContentView.supportsSplitContentBrowser;
    10091009};
     
    10111011WI.toggleSplitConsole = function()
    10121012{
    1013     if (!this.doesCurrentTabSupportSplitContentBrowser()) {
    1014         this.showConsoleTab();
    1015         return;
    1016     }
    1017 
    1018     if (this.isShowingSplitConsole())
    1019         this.hideSplitConsole();
     1013    if (!WI.doesCurrentTabSupportSplitContentBrowser()) {
     1014        WI.showConsoleTab();
     1015        return;
     1016    }
     1017
     1018    if (WI.isShowingSplitConsole())
     1019        WI.hideSplitConsole();
    10201020    else
    1021         this.showSplitConsole();
     1021        WI.showSplitConsole();
    10221022};
    10231023
    10241024WI.showSplitConsole = function()
    10251025{
    1026     if (!this.doesCurrentTabSupportSplitContentBrowser()) {
    1027         this.showConsoleTab();
    1028         return;
    1029     }
    1030 
    1031     this.consoleDrawer.collapsed = false;
    1032 
    1033     if (this.consoleDrawer.currentContentView === this.consoleContentView)
    1034         return;
    1035 
    1036     this.consoleDrawer.showContentView(this.consoleContentView);
     1026    if (!WI.doesCurrentTabSupportSplitContentBrowser()) {
     1027        WI.showConsoleTab();
     1028        return;
     1029    }
     1030
     1031    WI.consoleDrawer.collapsed = false;
     1032
     1033    if (WI.consoleDrawer.currentContentView === WI.consoleContentView)
     1034        return;
     1035
     1036    WI.consoleDrawer.showContentView(WI.consoleContentView);
    10371037};
    10381038
    10391039WI.hideSplitConsole = function()
    10401040{
    1041     if (!this.isShowingSplitConsole())
    1042         return;
    1043 
    1044     this.consoleDrawer.collapsed = true;
     1041    if (!WI.isShowingSplitConsole())
     1042        return;
     1043
     1044    WI.consoleDrawer.collapsed = true;
    10451045};
    10461046
     
    10491049    requestedScope = requestedScope || WI.LogContentView.Scopes.All;
    10501050
    1051     this.hideSplitConsole();
    1052 
    1053     this.consoleContentView.scopeBar.item(requestedScope).selected = true;
    1054 
    1055     this.showRepresentedObject(this._consoleRepresentedObject);
    1056 
    1057     console.assert(this.isShowingConsoleTab());
     1051    WI.hideSplitConsole();
     1052
     1053    WI.consoleContentView.scopeBar.item(requestedScope).selected = true;
     1054
     1055    WI.showRepresentedObject(WI._consoleRepresentedObject);
     1056
     1057    console.assert(WI.isShowingConsoleTab());
    10581058};
    10591059
    10601060WI.isShowingConsoleTab = function()
    10611061{
    1062     return this.tabBrowser.selectedTabContentView instanceof WI.ConsoleTabContentView;
     1062    return WI.tabBrowser.selectedTabContentView instanceof WI.ConsoleTabContentView;
    10631063};
    10641064
    10651065WI.showElementsTab = function()
    10661066{
    1067     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.ElementsTabContentView);
     1067    var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.ElementsTabContentView);
    10681068    if (!tabContentView)
    10691069        tabContentView = new WI.ElementsTabContentView;
    1070     this.tabBrowser.showTabForContentView(tabContentView);
     1070    WI.tabBrowser.showTabForContentView(tabContentView);
    10711071};
    10721072
    10731073WI.isShowingElementsTab = function()
    10741074{
    1075     return this.tabBrowser.selectedTabContentView instanceof WI.ElementsTabContentView;
     1075    return WI.tabBrowser.selectedTabContentView instanceof WI.ElementsTabContentView;
    10761076};
    10771077
    10781078WI.showSourcesTab = function(options = {})
    10791079{
    1080     let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.SourcesTabContentView);
     1080    let tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.SourcesTabContentView);
    10811081    if (!tabContentView)
    10821082        tabContentView = new WI.SourcesTabContentView;
     
    10881088        tabContentView.showScopeChainDetailsSidebarPanel();
    10891089
    1090     this.tabBrowser.showTabForContentView(tabContentView);
     1090    WI.tabBrowser.showTabForContentView(tabContentView);
    10911091};
    10921092
    10931093WI.isShowingSourcesTab = function()
    10941094{
    1095     return this.tabBrowser.selectedTabContentView instanceof WI.SourcesTabContentView;
     1095    return WI.tabBrowser.selectedTabContentView instanceof WI.SourcesTabContentView;
    10961096};
    10971097
    10981098WI.showDebuggerTab = function(options)
    10991099{
    1100     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.DebuggerTabContentView);
     1100    var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.DebuggerTabContentView);
    11011101    if (!tabContentView)
    11021102        tabContentView = new WI.DebuggerTabContentView;
     
    11081108        tabContentView.showScopeChainDetailsSidebarPanel();
    11091109
    1110     this.tabBrowser.showTabForContentView(tabContentView);
     1110    WI.tabBrowser.showTabForContentView(tabContentView);
    11111111};
    11121112
    11131113WI.isShowingDebuggerTab = function()
    11141114{
    1115     return this.tabBrowser.selectedTabContentView instanceof WI.DebuggerTabContentView;
     1115    return WI.tabBrowser.selectedTabContentView instanceof WI.DebuggerTabContentView;
    11161116};
    11171117
    11181118WI.showResourcesTab = function()
    11191119{
    1120     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.ResourcesTabContentView);
     1120    var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.ResourcesTabContentView);
    11211121    if (!tabContentView)
    11221122        tabContentView = new WI.ResourcesTabContentView;
    1123     this.tabBrowser.showTabForContentView(tabContentView);
     1123    WI.tabBrowser.showTabForContentView(tabContentView);
    11241124};
    11251125
    11261126WI.isShowingResourcesTab = function()
    11271127{
    1128     return this.tabBrowser.selectedTabContentView instanceof WI.ResourcesTabContentView;
     1128    return WI.tabBrowser.selectedTabContentView instanceof WI.ResourcesTabContentView;
    11291129};
    11301130
    11311131WI.showStorageTab = function()
    11321132{
    1133     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.StorageTabContentView);
     1133    var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.StorageTabContentView);
    11341134    if (!tabContentView)
    11351135        tabContentView = new WI.StorageTabContentView;
    1136     this.tabBrowser.showTabForContentView(tabContentView);
     1136    WI.tabBrowser.showTabForContentView(tabContentView);
    11371137};
    11381138
    11391139WI.showNetworkTab = function()
    11401140{
    1141     let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.NetworkTabContentView);
     1141    let tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.NetworkTabContentView);
    11421142    if (!tabContentView)
    11431143        tabContentView = new WI.NetworkTabContentView;
    11441144
    1145     this.tabBrowser.showTabForContentView(tabContentView);
     1145    WI.tabBrowser.showTabForContentView(tabContentView);
    11461146};
    11471147
    11481148WI.isShowingNetworkTab = function()
    11491149{
    1150     return this.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView;
     1150    return WI.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView;
    11511151};
    11521152
    11531153WI.isShowingSearchTab = function()
    11541154{
    1155     return this.tabBrowser.selectedTabContentView instanceof WI.SearchTabContentView;
     1155    return WI.tabBrowser.selectedTabContentView instanceof WI.SearchTabContentView;
    11561156};
    11571157
    11581158WI.showTimelineTab = function()
    11591159{
    1160     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.TimelineTabContentView);
     1160    var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.TimelineTabContentView);
    11611161    if (!tabContentView)
    11621162        tabContentView = new WI.TimelineTabContentView;
    1163     this.tabBrowser.showTabForContentView(tabContentView);
     1163    WI.tabBrowser.showTabForContentView(tabContentView);
    11641164};
    11651165
    11661166WI.showLayersTab = function(options = {})
    11671167{
    1168     let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.LayersTabContentView);
     1168    let tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.LayersTabContentView);
    11691169    if (!tabContentView)
    11701170        tabContentView = new WI.LayersTabContentView;
    11711171    if (options.nodeToSelect)
    11721172        tabContentView.selectLayerForNode(options.nodeToSelect);
    1173     this.tabBrowser.showTabForContentView(tabContentView);
     1173    WI.tabBrowser.showTabForContentView(tabContentView);
    11741174};
    11751175
    11761176WI.isShowingLayersTab = function()
    11771177{
    1178     return this.tabBrowser.selectedTabContentView instanceof WI.LayersTabContentView;
     1178    return WI.tabBrowser.selectedTabContentView instanceof WI.LayersTabContentView;
    11791179};
    11801180
     
    11881188WI.restoreFocusFromElement = function(element)
    11891189{
    1190     if (element && element.contains(this.currentFocusElement))
    1191         this.previousFocusElement.focus();
     1190    if (element && element.contains(WI.currentFocusElement))
     1191        WI.previousFocusElement.focus();
    11921192};
    11931193
    11941194WI.toggleNavigationSidebar = function(event)
    11951195{
    1196     if (!this.navigationSidebar.collapsed || !this.navigationSidebar.sidebarPanels.length) {
    1197         this.navigationSidebar.collapsed = true;
    1198         return;
    1199     }
    1200 
    1201     if (!this.navigationSidebar.selectedSidebarPanel)
    1202         this.navigationSidebar.selectedSidebarPanel = this.navigationSidebar.sidebarPanels[0];
    1203     this.navigationSidebar.collapsed = false;
     1196    if (!WI.navigationSidebar.collapsed || !WI.navigationSidebar.sidebarPanels.length) {
     1197        WI.navigationSidebar.collapsed = true;
     1198        return;
     1199    }
     1200
     1201    if (!WI.navigationSidebar.selectedSidebarPanel)
     1202        WI.navigationSidebar.selectedSidebarPanel = WI.navigationSidebar.sidebarPanels[0];
     1203    WI.navigationSidebar.collapsed = false;
    12041204};
    12051205
    12061206WI.toggleDetailsSidebar = function(event)
    12071207{
    1208     if (!this.detailsSidebar.collapsed || !this.detailsSidebar.sidebarPanels.length) {
    1209         this.detailsSidebar.collapsed = true;
    1210         return;
    1211     }
    1212 
    1213     if (!this.detailsSidebar.selectedSidebarPanel)
    1214         this.detailsSidebar.selectedSidebarPanel = this.detailsSidebar.sidebarPanels[0];
    1215     this.detailsSidebar.collapsed = false;
     1208    if (!WI.detailsSidebar.collapsed || !WI.detailsSidebar.sidebarPanels.length) {
     1209        WI.detailsSidebar.collapsed = true;
     1210        return;
     1211    }
     1212
     1213    if (!WI.detailsSidebar.selectedSidebarPanel)
     1214        WI.detailsSidebar.selectedSidebarPanel = WI.detailsSidebar.sidebarPanels[0];
     1215    WI.detailsSidebar.collapsed = false;
    12161216};
    12171217
     
    12231223
    12241224    let minimumWidth = window.innerWidth - minimumContentBrowserWidth;
    1225     let tabContentView = this.tabBrowser.selectedTabContentView;
     1225    let tabContentView = WI.tabBrowser.selectedTabContentView;
    12261226    console.assert(tabContentView);
    12271227    if (!tabContentView)
     
    12291229
    12301230    let otherSidebar = null;
    1231     if (sidebar === this.navigationSidebar)
    1232         otherSidebar = tabContentView.detailsSidebarPanels.length ? this.detailsSidebar : null;
     1231    if (sidebar === WI.navigationSidebar)
     1232        otherSidebar = tabContentView.detailsSidebarPanels.length ? WI.detailsSidebar : null;
    12331233    else
    1234         otherSidebar = tabContentView.navigationSidebarPanel ? this.navigationSidebar : null;
     1234        otherSidebar = tabContentView.navigationSidebarPanel ? WI.navigationSidebar : null;
    12351235
    12361236    if (otherSidebar)
     
    12481248        return WI.TimelineTabContentView;
    12491249
    1250     // We only support one console tab right now. So this isn't an instanceof check.
    1251     if (representedObject === this._consoleRepresentedObject)
     1250    // We only support one console tab right now. So WI isn't an instanceof check.
     1251    if (representedObject === WI._consoleRepresentedObject)
    12521252        return WI.ConsoleTabContentView;
    12531253
     
    13031303WI.tabContentViewForRepresentedObject = function(representedObject, options = {})
    13041304{
    1305     let tabContentView = this.tabBrowser.bestTabContentViewForRepresentedObject(representedObject, options);
     1305    let tabContentView = WI.tabBrowser.bestTabContentViewForRepresentedObject(representedObject, options);
    13061306    if (tabContentView)
    13071307        return tabContentView;
    13081308
    1309     var tabContentViewClass = this.tabContentViewClassForRepresentedObject(representedObject);
     1309    var tabContentViewClass = WI.tabContentViewClassForRepresentedObject(representedObject);
    13101310    if (!tabContentViewClass) {
    13111311        console.error("Unknown representedObject, couldn't create TabContentView.", representedObject);
     
    13151315    tabContentView = new tabContentViewClass;
    13161316
    1317     this.tabBrowser.addTabForContentView(tabContentView);
     1317    WI.tabBrowser.addTabForContentView(tabContentView);
    13181318
    13191319    return tabContentView;
     
    13221322WI.showRepresentedObject = function(representedObject, cookie, options = {})
    13231323{
    1324     let tabContentView = this.tabContentViewForRepresentedObject(representedObject, options);
     1324    let tabContentView = WI.tabContentViewForRepresentedObject(representedObject, options);
    13251325    console.assert(tabContentView);
    13261326    if (!tabContentView)
    13271327        return;
    13281328
    1329     this.tabBrowser.showTabForContentView(tabContentView, options);
     1329    WI.tabBrowser.showTabForContentView(tabContentView, options);
    13301330    tabContentView.showRepresentedObject(representedObject, cookie);
    13311331};
     
    13361336    if (!WI.networkManager.mainFrame)
    13371337        return;
    1338     this.showRepresentedObject(WI.networkManager.mainFrame.domTree, {nodeToSelect}, options);
     1338    WI.showRepresentedObject(WI.networkManager.mainFrame.domTree, {nodeToSelect}, options);
    13391339};
    13401340
     
    13431343    var frame = WI.networkManager.frameForIdentifier(frameIdentifier);
    13441344    if (!frame) {
    1345         this._frameIdentifierToShowSourceCodeWhenAvailable = frameIdentifier;
    1346         return;
    1347     }
    1348 
    1349     this._frameIdentifierToShowSourceCodeWhenAvailable = undefined;
    1350 
    1351     this.showRepresentedObject(frame, null, options);
     1345        WI._frameIdentifierToShowSourceCodeWhenAvailable = frameIdentifier;
     1346        return;
     1347    }
     1348
     1349    WI._frameIdentifierToShowSourceCodeWhenAvailable = undefined;
     1350
     1351    WI.showRepresentedObject(frame, null, options);
    13521352};
    13531353
     
    13651365
    13661366    var cookie = positionToReveal ? {lineNumber: positionToReveal.lineNumber, columnNumber: positionToReveal.columnNumber} : {};
    1367     this.showRepresentedObject(representedObject, cookie, options);
     1367    WI.showRepresentedObject(representedObject, cookie, options);
    13681368};
    13691369
    13701370WI.showSourceCodeLocation = function(sourceCodeLocation, options = {})
    13711371{
    1372     this.showSourceCode(sourceCodeLocation.displaySourceCode, {
     1372    WI.showSourceCode(sourceCodeLocation.displaySourceCode, {
    13731373        ...options,
    13741374        positionToReveal: sourceCodeLocation.displayPosition(),
     
    13781378WI.showOriginalUnformattedSourceCodeLocation = function(sourceCodeLocation, options = {})
    13791379{
    1380     this.showSourceCode(sourceCodeLocation.sourceCode, {
     1380    WI.showSourceCode(sourceCodeLocation.sourceCode, {
    13811381        ...options,
    13821382        positionToReveal: sourceCodeLocation.position(),
     
    13871387WI.showOriginalOrFormattedSourceCodeLocation = function(sourceCodeLocation, options = {})
    13881388{
    1389     this.showSourceCode(sourceCodeLocation.sourceCode, {
     1389    WI.showSourceCode(sourceCodeLocation.sourceCode, {
    13901390        ...options,
    13911391        positionToReveal: sourceCodeLocation.formattedPosition(),
     
    13961396{
    13971397    var textRangeToSelect = sourceCodeTextRange.formattedTextRange;
    1398     this.showSourceCode(sourceCodeTextRange.sourceCode, {
     1398    WI.showSourceCode(sourceCodeTextRange.sourceCode, {
    13991399        ...options,
    14001400        positionToReveal: textRangeToSelect.startPosition(),
     
    14051405WI.showResourceRequest = function(resource, options = {})
    14061406{
    1407     this.showRepresentedObject(resource, {[WI.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WI.ResourceClusterContentView.RequestIdentifier}, options);
     1407    WI.showRepresentedObject(resource, {[WI.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WI.ResourceClusterContentView.RequestIdentifier}, options);
    14081408};
    14091409
     
    14381438WI._searchTextDidChange = function(event)
    14391439{
    1440     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.SearchTabContentView);
     1440    var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.SearchTabContentView);
    14411441    if (!tabContentView)
    14421442        tabContentView = new WI.SearchTabContentView;
    14431443
    1444     var searchQuery = this._searchToolbarItem.text;
    1445     this._searchToolbarItem.text = "";
    1446 
    1447     this.tabBrowser.showTabForContentView(tabContentView);
     1444    var searchQuery = WI._searchToolbarItem.text;
     1445    WI._searchToolbarItem.text = "";
     1446
     1447    WI.tabBrowser.showTabForContentView(tabContentView);
    14481448
    14491449    tabContentView.performSearch(searchQuery);
     
    14531453{
    14541454    if (WI.settings.experimentalEnableNewTabBar.value)
    1455         this.tabBrowser.showTabForContentView(this._searchTabContentView);
    1456 
    1457     if (this.tabBrowser.selectedTabContentView instanceof WI.SearchTabContentView) {
    1458         this.tabBrowser.selectedTabContentView.focusSearchField();
    1459         return;
    1460     }
    1461 
    1462     if (this._searchToolbarItem)
    1463         this._searchToolbarItem.focus();
     1455        WI.tabBrowser.showTabForContentView(WI._searchTabContentView);
     1456
     1457    if (WI.tabBrowser.selectedTabContentView instanceof WI.SearchTabContentView) {
     1458        WI.tabBrowser.selectedTabContentView.focusSearchField();
     1459        return;
     1460    }
     1461
     1462    if (WI._searchToolbarItem)
     1463        WI._searchToolbarItem.focus();
    14641464};
    14651465
     
    14791479            if (codeMirror) {
    14801480                let codeMirrorElement = codeMirror.getWrapperElement();
    1481                 if (codeMirrorElement && codeMirrorElement !== this.currentFocusElement)
     1481                if (codeMirrorElement && codeMirrorElement !== WI.currentFocusElement)
    14821482                    newFocusElement = codeMirrorElement;
    14831483            }
     
    14851485
    14861486        if (newFocusElement) {
    1487             this.previousFocusElement = this.currentFocusElement;
    1488             this.currentFocusElement = newFocusElement;
     1487            WI.previousFocusElement = WI.currentFocusElement;
     1488            WI.currentFocusElement = newFocusElement;
    14891489        }
    14901490
    1491         // Due to the change in WI.isEventTargetAnEditableField (r196271), this return
     1491        // Due to the change in WI.isEventTargetAnEditableField (r196271), WI return
    14921492        // will also get run when WI.startEditing is called on an element. We do not want
    1493         // to return early in this case, as WI.EditingConfig handles its own editing
     1493        // to return early in WI case, as WI.EditingConfig handles its own editing
    14941494        // completion, so only return early if the focus change target is not from WI.startEditing.
    14951495        if (!WI.isBeingEdited(event.target))
     
    15031503    var element = event.target;
    15041504
    1505     if (element !== this.currentFocusElement) {
    1506         this.previousFocusElement = this.currentFocusElement;
    1507         this.currentFocusElement = element;
     1505    if (element !== WI.currentFocusElement) {
     1506        WI.previousFocusElement = WI.currentFocusElement;
     1507        WI.currentFocusElement = element;
    15081508    }
    15091509
     
    15211521WI._mouseWasClicked = function(event)
    15221522{
    1523     this.handlePossibleLinkClick(event);
     1523    WI.handlePossibleLinkClick(event);
    15241524};
    15251525
     
    15461546        WI.showDebuggerTab({showScopeChainSidebar: WI.settings.showScopeChainOnPause.value});
    15471547
    1548     this._dashboardContainer.showDashboardViewForRepresentedObject(this._dashboards.debugger);
     1548    WI._dashboardContainer.showDashboardViewForRepresentedObject(WI._dashboards.debugger);
    15491549
    15501550    InspectorFrontendHost.bringToFront();
     
    15531553WI._debuggerDidResume = function(event)
    15541554{
    1555     this._dashboardContainer.closeDashboardViewForRepresentedObject(this._dashboards.debugger);
     1555    WI._dashboardContainer.closeDashboardViewForRepresentedObject(WI._dashboards.debugger);
    15561556};
    15571557
    15581558WI._frameWasAdded = function(event)
    15591559{
    1560     if (!this._frameIdentifierToShowSourceCodeWhenAvailable)
     1560    if (!WI._frameIdentifierToShowSourceCodeWhenAvailable)
    15611561        return;
    15621562
    15631563    var frame = event.data.frame;
    1564     if (frame.id !== this._frameIdentifierToShowSourceCodeWhenAvailable)
     1564    if (frame.id !== WI._frameIdentifierToShowSourceCodeWhenAvailable)
    15651565        return;
    15661566
     
    15711571            ignoreSearchTab: true,
    15721572        };
    1573         this.showSourceCodeForFrame(frame.id, options);
     1573        WI.showSourceCodeForFrame(frame.id, options);
    15741574    }
    15751575
    15761576    // Delay showing the frame since FrameWasAdded is called before MainFrameChanged.
    15771577    // Calling showSourceCodeForFrame before MainFrameChanged will show the frame then close it.
    1578     setTimeout(delayedWork.bind(this));
     1578    setTimeout(delayedWork);
    15791579};
    15801580
    15811581WI._mainFrameDidChange = function(event)
    15821582{
    1583     this._updateDownloadToolbarButton();
    1584 
    1585     this.updateWindowTitle();
     1583    WI._updateDownloadToolbarButton();
     1584
     1585    WI.updateWindowTitle();
    15861586};
    15871587
     
    15931593    // Run cookie restoration after we are sure all of the Tabs and NavigationSidebarPanels
    15941594    // have updated with respect to the main resource change.
    1595     setTimeout(this._restoreCookieForOpenTabs.bind(this, WI.StateRestorationType.Navigation));
    1596 
    1597     this._updateDownloadToolbarButton();
    1598 
    1599     this.updateWindowTitle();
     1595    setTimeout(() => {
     1596        WI._restoreCookieForOpenTabs(WI.StateRestorationType.Navigation);
     1597    });
     1598
     1599    WI._updateDownloadToolbarButton();
     1600
     1601    WI.updateWindowTitle();
    16001602};
    16011603
     
    16051607        return;
    16061608
    1607     this._saveCookieForOpenTabs();
     1609    WI._saveCookieForOpenTabs();
    16081610};
    16091611
    16101612WI._restoreCookieForOpenTabs = function(restorationType)
    16111613{
    1612     for (var tabBarItem of this.tabBar.tabBarItems) {
     1614    for (var tabBarItem of WI.tabBar.tabBarItems) {
    16131615        var tabContentView = tabBarItem.representedObject;
    16141616        if (!(tabContentView instanceof WI.TabContentView))
     
    16201622WI._saveCookieForOpenTabs = function()
    16211623{
    1622     for (var tabBarItem of this.tabBar.tabBarItems) {
     1624    for (var tabBarItem of WI.tabBar.tabBarItems) {
    16231625        var tabContentView = tabBarItem.representedObject;
    16241626        if (!(tabContentView instanceof WI.TabContentView))
     
    16341636
    16351637    // FIXME: We should use the :window-inactive pseudo class once https://webkit.org/b/38927 is fixed.
    1636     document.body.classList.remove(this.docked ? "window-docked-inactive" : "window-inactive");
     1638    document.body.classList.remove(WI.docked ? "window-docked-inactive" : "window-inactive");
    16371639};
    16381640
     
    16431645
    16441646    // FIXME: We should use the :window-inactive pseudo class once https://webkit.org/b/38927 is fixed.
    1645     document.body.classList.add(this.docked ? "window-docked-inactive" : "window-inactive");
     1647    document.body.classList.add(WI.docked ? "window-docked-inactive" : "window-inactive");
    16461648};
    16471649
    16481650WI._windowResized = function(event)
    16491651{
    1650     this.toolbar.updateLayout(WI.View.LayoutReason.Resize);
    1651     this.tabBar.updateLayout(WI.View.LayoutReason.Resize);
    1652     this._tabBrowserSizeDidChange();
     1652    WI.toolbar.updateLayout(WI.View.LayoutReason.Resize);
     1653    WI.tabBar.updateLayout(WI.View.LayoutReason.Resize);
     1654    WI._tabBrowserSizeDidChange();
    16531655};
    16541656
     
    16621664    };
    16631665
    1664     let changed = !Object.shallowEqual(this.modifierKeys, keys);
    1665 
    1666     this.modifierKeys = keys;
    1667 
    1668     document.body.classList.toggle("alt-key-pressed", this.modifierKeys.altKey);
    1669     document.body.classList.toggle("ctrl-key-pressed", this.modifierKeys.ctrlKey);
    1670     document.body.classList.toggle("meta-key-pressed", this.modifierKeys.metaKey);
    1671     document.body.classList.toggle("shift-key-pressed", this.modifierKeys.shiftKey);
     1666    let changed = !Object.shallowEqual(WI.modifierKeys, keys);
     1667
     1668    WI.modifierKeys = keys;
     1669
     1670    document.body.classList.toggle("alt-key-pressed", WI.modifierKeys.altKey);
     1671    document.body.classList.toggle("ctrl-key-pressed", WI.modifierKeys.ctrlKey);
     1672    document.body.classList.toggle("meta-key-pressed", WI.modifierKeys.metaKey);
     1673    document.body.classList.toggle("shift-key-pressed", WI.modifierKeys.shiftKey);
    16721674
    16731675    if (changed)
    1674         this.notifications.dispatchEventToListeners(WI.Notification.GlobalModifierKeysDidChange, event);
     1676        WI.notifications.dispatchEventToListeners(WI.Notification.GlobalModifierKeysDidChange, event);
    16751677};
    16761678
    16771679WI._windowKeyDown = function(event)
    16781680{
    1679     this._updateModifierKeys(event);
     1681    WI._updateModifierKeys(event);
    16801682};
    16811683
    16821684WI._windowKeyUp = function(event)
    16831685{
    1684     this._updateModifierKeys(event);
     1686    WI._updateModifierKeys(event);
    16851687};
    16861688
    16871689WI._mouseDown = function(event)
    16881690{
    1689     if (this.toolbar.element.contains(event.target))
    1690         this._toolbarMouseDown(event);
     1691    if (WI.toolbar.element.contains(event.target))
     1692        WI._toolbarMouseDown(event);
    16911693};
    16921694
    16931695WI._mouseMoved = function(event)
    16941696{
    1695     this._updateModifierKeys(event);
    1696     this.mouseCoords = {
     1697    WI._updateModifierKeys(event);
     1698    WI.mouseCoords = {
    16971699        x: event.pageX,
    16981700        y: event.pageY
     
    17021704WI._pageHidden = function(event)
    17031705{
    1704     this._saveCookieForOpenTabs();
     1706    WI._saveCookieForOpenTabs();
    17051707};
    17061708
     
    17691771WI._togglePreviousDockConfiguration = function(event)
    17701772{
    1771     InspectorFrontendHost.requestSetDockSide(this._previousDockConfiguration);
     1773    InspectorFrontendHost.requestSetDockSide(WI._previousDockConfiguration);
    17721774};
    17731775
    17741776WI._updateDockNavigationItems = function()
    17751777{
    1776     if (this._dockingAvailable || this.docked) {
    1777         this._closeToolbarButton.hidden = !this.docked;
    1778         this._undockToolbarButton.hidden = this._dockConfiguration === WI.DockConfiguration.Undocked;
    1779         this._dockBottomToolbarButton.hidden = this._dockConfiguration === WI.DockConfiguration.Bottom;
    1780         this._dockToSideToolbarButton.hidden = this._dockConfiguration === WI.DockConfiguration.Right || this._dockConfiguration === WI.DockConfiguration.Left;
     1778    if (WI._dockingAvailable || WI.docked) {
     1779        WI._closeToolbarButton.hidden = !WI.docked;
     1780        WI._undockToolbarButton.hidden = WI._dockConfiguration === WI.DockConfiguration.Undocked;
     1781        WI._dockBottomToolbarButton.hidden = WI._dockConfiguration === WI.DockConfiguration.Bottom;
     1782        WI._dockToSideToolbarButton.hidden = WI._dockConfiguration === WI.DockConfiguration.Right || WI._dockConfiguration === WI.DockConfiguration.Left;
    17811783    } else {
    1782         this._closeToolbarButton.hidden = true;
    1783         this._undockToolbarButton.hidden = true;
    1784         this._dockBottomToolbarButton.hidden = true;
    1785         this._dockToSideToolbarButton.hidden = true;
     1784        WI._closeToolbarButton.hidden = true;
     1785        WI._undockToolbarButton.hidden = true;
     1786        WI._dockBottomToolbarButton.hidden = true;
     1787        WI._dockToSideToolbarButton.hidden = true;
    17861788    }
    17871789};
     
    17891791WI._tabBrowserSizeDidChange = function()
    17901792{
    1791     this.tabBrowser.updateLayout(WI.View.LayoutReason.Resize);
    1792     this.consoleDrawer.updateLayout(WI.View.LayoutReason.Resize);
    1793     this.quickConsole.updateLayout(WI.View.LayoutReason.Resize);
     1793    WI.tabBrowser.updateLayout(WI.View.LayoutReason.Resize);
     1794    WI.consoleDrawer.updateLayout(WI.View.LayoutReason.Resize);
     1795    WI.quickConsole.updateLayout(WI.View.LayoutReason.Resize);
    17941796};
    17951797
    17961798WI._consoleDrawerCollapsedStateDidChange = function(event)
    17971799{
    1798     this._showingSplitConsoleSetting.value = WI.isShowingSplitConsole();
     1800    WI._showingSplitConsoleSetting.value = WI.isShowingSplitConsole();
    17991801
    18001802    WI._consoleDrawerDidResize();
     
    18031805WI._consoleDrawerDidResize = function(event)
    18041806{
    1805     this.tabBrowser.updateLayout(WI.View.LayoutReason.Resize);
     1807    WI.tabBrowser.updateLayout(WI.View.LayoutReason.Resize);
    18061808};
    18071809
    18081810WI._sidebarWidthDidChange = function(event)
    18091811{
    1810     this._tabBrowserSizeDidChange();
     1812    WI._tabBrowserSizeDidChange();
    18111813};
    18121814
     
    18141816{
    18151817    let rootView = WI.View.rootView();
    1816     rootView.addSubview(this.toolbar);
    1817     rootView.addSubview(this.tabBar);
    1818     rootView.addSubview(this.navigationSidebar);
    1819     rootView.addSubview(this.tabBrowser);
    1820     rootView.addSubview(this.consoleDrawer);
    1821     rootView.addSubview(this.quickConsole);
    1822     rootView.addSubview(this.detailsSidebar);
     1818    rootView.addSubview(WI.toolbar);
     1819    rootView.addSubview(WI.tabBar);
     1820    rootView.addSubview(WI.navigationSidebar);
     1821    rootView.addSubview(WI.tabBrowser);
     1822    rootView.addSubview(WI.consoleDrawer);
     1823    rootView.addSubview(WI.quickConsole);
     1824    rootView.addSubview(WI.detailsSidebar);
    18231825};
    18241826
    18251827WI._tabBrowserSelectedTabContentViewDidChange = function(event)
    18261828{
    1827     if (this.tabBar.selectedTabBarItem && this.tabBar.selectedTabBarItem.representedObject.constructor.shouldSaveTab())
    1828         this._selectedTabIndexSetting.value = this.tabBar.tabBarItems.indexOf(this.tabBar.selectedTabBarItem);
    1829 
    1830     if (this.doesCurrentTabSupportSplitContentBrowser()) {
    1831         if (this._shouldRevealSpitConsoleIfSupported) {
    1832             this._shouldRevealSpitConsoleIfSupported = false;
    1833             this.showSplitConsole();
     1829    if (WI.tabBar.selectedTabBarItem && WI.tabBar.selectedTabBarItem.representedObject.constructor.shouldSaveTab())
     1830        WI._selectedTabIndexSetting.value = WI.tabBar.tabBarItems.indexOf(WI.tabBar.selectedTabBarItem);
     1831
     1832    if (WI.doesCurrentTabSupportSplitContentBrowser()) {
     1833        if (WI._shouldRevealSpitConsoleIfSupported) {
     1834            WI._shouldRevealSpitConsoleIfSupported = false;
     1835            WI.showSplitConsole();
    18341836        }
    18351837        return;
    18361838    }
    18371839
    1838     this._shouldRevealSpitConsoleIfSupported = this.isShowingSplitConsole();
    1839     this.hideSplitConsole();
     1840    WI._shouldRevealSpitConsoleIfSupported = WI.isShowingSplitConsole();
     1841    WI.hideSplitConsole();
    18401842};
    18411843
     
    18451847        return;
    18461848
    1847     if (this._dockConfiguration === WI.DockConfiguration.Right || this._dockConfiguration === WI.DockConfiguration.Left)
    1848         return;
    1849 
    1850     if (this.docked)
    1851         this._dockedResizerMouseDown(event);
     1849    if (WI._dockConfiguration === WI.DockConfiguration.Right || WI._dockConfiguration === WI.DockConfiguration.Left)
     1850        return;
     1851
     1852    if (WI.docked)
     1853        WI._dockedResizerMouseDown(event);
    18521854    else
    1853         this._moveWindowMouseDown(event);
     1855        WI._moveWindowMouseDown(event);
    18541856};
    18551857
     
    18591861        return;
    18601862
    1861     if (!this.docked)
     1863    if (!WI.docked)
    18621864        return;
    18631865
     
    18691871    event[WI.Popover.EventPreventDismissSymbol] = true;
    18701872
    1871     let windowProperty = this._dockConfiguration === WI.DockConfiguration.Bottom ? "innerHeight" : "innerWidth";
    1872     let eventScreenProperty = this._dockConfiguration === WI.DockConfiguration.Bottom ? "screenY" : "screenX";
    1873     let eventClientProperty = this._dockConfiguration === WI.DockConfiguration.Bottom ? "clientY" : "clientX";
     1873    let windowProperty = WI._dockConfiguration === WI.DockConfiguration.Bottom ? "innerHeight" : "innerWidth";
     1874    let eventScreenProperty = WI._dockConfiguration === WI.DockConfiguration.Bottom ? "screenY" : "screenX";
     1875    let eventClientProperty = WI._dockConfiguration === WI.DockConfiguration.Bottom ? "clientY" : "clientX";
    18741876
    18751877    var resizerElement = event.target;
     
    18881890        lastScreenPosition = position;
    18891891
    1890         if (this._dockConfiguration === WI.DockConfiguration.Left) {
     1892        if (WI._dockConfiguration === WI.DockConfiguration.Left) {
    18911893            // If the mouse is travelling rightward but is positioned left of the resizer, ignore the event.
    18921894            if (delta > 0 && clientPosition < firstClientPosition)
     
    19131915        // If zoomed in/out, there be greater/fewer document pixels shown, but the inspector's
    19141916        // width or height should be the same in device pixels regardless of the document zoom.
    1915         dimension *= this.getZoomFactor();
    1916 
    1917         if (this._dockConfiguration === WI.DockConfiguration.Bottom)
     1917        dimension *= WI.getZoomFactor();
     1918
     1919        if (WI._dockConfiguration === WI.DockConfiguration.Bottom)
    19181920            InspectorFrontendHost.setAttachedWindowHeight(dimension);
    19191921        else
     
    19291931    }
    19301932
    1931     WI.elementDragStart(resizerElement, dockedResizerDrag.bind(this), dockedResizerDragEnd.bind(this), event, this._dockConfiguration === WI.DockConfiguration.Bottom ? "row-resize" : "col-resize");
     1933    WI.elementDragStart(resizerElement, dockedResizerDrag, dockedResizerDragEnd, event, WI._dockConfiguration === WI.DockConfiguration.Bottom ? "row-resize" : "col-resize");
    19321934};
    19331935
    19341936WI._moveWindowMouseDown = function(event)
    19351937{
    1936     console.assert(!this.docked);
     1938    console.assert(!WI.docked);
    19371939
    19381940    if (event.button !== 0 || event.ctrlKey)
     
    19821984WI._domStorageWasInspected = function(event)
    19831985{
    1984     this.showStorageTab();
    1985     this.showRepresentedObject(event.data.domStorage, null, {ignoreSearchTab: true});
     1986    WI.showStorageTab();
     1987    WI.showRepresentedObject(event.data.domStorage, null, {ignoreSearchTab: true});
    19861988};
    19871989
    19881990WI._databaseWasInspected = function(event)
    19891991{
    1990     this.showStorageTab();
    1991     this.showRepresentedObject(event.data.database, null, {ignoreSearchTab: true});
     1992    WI.showStorageTab();
     1993    WI.showRepresentedObject(event.data.database, null, {ignoreSearchTab: true});
    19921994};
    19931995
    19941996WI._domNodeWasInspected = function(event)
    19951997{
    1996     this.domManager.highlightDOMNodeForTwoSeconds(event.data.node.id);
     1998    WI.domManager.highlightDOMNodeForTwoSeconds(event.data.node.id);
    19971999
    19982000    InspectorFrontendHost.bringToFront();
    19992001
    2000     this.showElementsTab();
    2001     this.showMainFrameDOMTree(event.data.node, {ignoreSearchTab: true});
     2002    WI.showElementsTab();
     2003    WI.showMainFrameDOMTree(event.data.node, {ignoreSearchTab: true});
    20022004};
    20032005
    20042006WI._inspectModeStateChanged = function(event)
    20052007{
    2006     this._inspectModeToolbarButton.activated = this.domManager.inspectModeEnabled;
     2008    WI._inspectModeToolbarButton.activated = WI.domManager.inspectModeEnabled;
    20072009};
    20082010
    20092011WI._toggleInspectMode = function(event)
    20102012{
    2011     this.domManager.inspectModeEnabled = !this.domManager.inspectModeEnabled;
     2013    WI.domManager.inspectModeEnabled = !WI.domManager.inspectModeEnabled;
    20122014};
    20132015
     
    21042106    const preferredEdges = [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_X, WI.RectEdge.MAX_X];
    21052107
    2106     WI._deviceSettingsPopover = new WI.Popover(this);
     2108    WI._deviceSettingsPopover = new WI.Popover(WI);
    21072109    WI._deviceSettingsPopover.windowResizeHandler = function(event) {
    21082110        WI._deviceSettingsPopover.present(calculateTargetFrame(), preferredEdges);
     
    22702272WI._downloadWebArchive = function(event)
    22712273{
    2272     this.archiveMainFrame();
     2274    WI.archiveMainFrame();
    22732275};
    22742276
     
    23172319
    23182320    // Reload page from origin if the button is clicked while the shift key is pressed down.
    2319     PageAgent.reload.invoke({ignoreCache: this.modifierKeys.shiftKey});
     2321    PageAgent.reload.invoke({ignoreCache: WI.modifierKeys.shiftKey});
    23202322};
    23212323
     
    23232325{
    23242326    if (!window.PageAgent) {
    2325         this._reloadToolbarButton.hidden = true;
    2326         return;
    2327     }
    2328 
    2329     this._reloadToolbarButton.hidden = false;
     2327        WI._reloadToolbarButton.hidden = true;
     2328        return;
     2329    }
     2330
     2331    WI._reloadToolbarButton.hidden = false;
    23302332};
    23312333
    23322334WI._updateDownloadToolbarButton = function()
    23332335{
    2334     if (!window.PageAgent || this.sharedApp.debuggableType !== WI.DebuggableType.Web) {
    2335         this._downloadToolbarButton.hidden = true;
    2336         return;
    2337     }
    2338 
    2339     if (this._downloadingPage) {
    2340         this._downloadToolbarButton.enabled = false;
    2341         return;
    2342     }
    2343 
    2344     this._downloadToolbarButton.enabled = this.canArchiveMainFrame();
     2336    if (!window.PageAgent || WI.sharedApp.debuggableType !== WI.DebuggableType.Web) {
     2337        WI._downloadToolbarButton.hidden = true;
     2338        return;
     2339    }
     2340
     2341    if (WI._downloadingPage) {
     2342        WI._downloadToolbarButton.enabled = false;
     2343        return;
     2344    }
     2345
     2346    WI._downloadToolbarButton.enabled = WI.canArchiveMainFrame();
    23452347};
    23462348
     
    23482350{
    23492351    if (!window.DOMAgent || !DOMAgent.setInspectModeEnabled) {
    2350         this._inspectModeToolbarButton.hidden = true;
    2351         return;
    2352     }
    2353 
    2354     this._inspectModeToolbarButton.hidden = false;
     2352        WI._inspectModeToolbarButton.hidden = true;
     2353        return;
     2354    }
     2355
     2356    WI._inspectModeToolbarButton.hidden = false;
    23552357};
    23562358
    23572359WI._toggleInspectMode = function(event)
    23582360{
    2359     this.domManager.inspectModeEnabled = !this.domManager.inspectModeEnabled;
     2361    WI.domManager.inspectModeEnabled = !WI.domManager.inspectModeEnabled;
    23602362};
    23612363
    23622364WI._showConsoleTab = function(event)
    23632365{
    2364     this.showConsoleTab();
     2366    WI.showConsoleTab();
    23652367};
    23662368
    23672369WI._focusConsolePrompt = function(event)
    23682370{
    2369     this.quickConsole.prompt.focus();
     2371    WI.quickConsole.prompt.focus();
    23702372};
    23712373
    23722374WI._focusedContentBrowser = function()
    23732375{
    2374     if (this.currentFocusElement) {
    2375         let contentBrowserElement = this.currentFocusElement.closest(".content-browser");
     2376    if (WI.currentFocusElement) {
     2377        let contentBrowserElement = WI.currentFocusElement.closest(".content-browser");
    23762378        if (contentBrowserElement && contentBrowserElement.__view && contentBrowserElement.__view instanceof WI.ContentBrowser)
    23772379            return contentBrowserElement.__view;
    23782380    }
    23792381
    2380     if (this.tabBrowser.element.contains(this.currentFocusElement) || document.activeElement === document.body) {
    2381         let tabContentView = this.tabBrowser.selectedTabContentView;
     2382    if (WI.tabBrowser.element.contains(WI.currentFocusElement) || document.activeElement === document.body) {
     2383        let tabContentView = WI.tabBrowser.selectedTabContentView;
    23822384        if (tabContentView.contentBrowser)
    23832385            return tabContentView.contentBrowser;
     
    23852387    }
    23862388
    2387     if (this.consoleDrawer.element.contains(this.currentFocusElement)
    2388         || (WI.isShowingSplitConsole() && this.quickConsole.element.contains(this.currentFocusElement)))
    2389         return this.consoleDrawer;
     2389    if (WI.consoleDrawer.element.contains(WI.currentFocusElement)
     2390        || (WI.isShowingSplitConsole() && WI.quickConsole.element.contains(WI.currentFocusElement)))
     2391        return WI.consoleDrawer;
    23902392
    23912393    return null;
     
    23942396WI._focusedContentView = function()
    23952397{
    2396     if (this.tabBrowser.element.contains(this.currentFocusElement) || document.activeElement === document.body) {
    2397         var tabContentView = this.tabBrowser.selectedTabContentView;
     2398    if (WI.tabBrowser.element.contains(WI.currentFocusElement) || document.activeElement === document.body) {
     2399        var tabContentView = WI.tabBrowser.selectedTabContentView;
    23982400        if (tabContentView.contentBrowser)
    23992401            return tabContentView.contentBrowser.currentContentView;
     
    24012403    }
    24022404
    2403     if (this.consoleDrawer.element.contains(this.currentFocusElement)
    2404         || (WI.isShowingSplitConsole() && this.quickConsole.element.contains(this.currentFocusElement)))
    2405         return this.consoleDrawer.currentContentView;
     2405    if (WI.consoleDrawer.element.contains(WI.currentFocusElement)
     2406        || (WI.isShowingSplitConsole() && WI.quickConsole.element.contains(WI.currentFocusElement)))
     2407        return WI.consoleDrawer.currentContentView;
    24062408
    24072409    return null;
     
    24102412WI._focusedOrVisibleContentBrowser = function()
    24112413{
    2412     let focusedContentBrowser = this._focusedContentBrowser();
     2414    let focusedContentBrowser = WI._focusedContentBrowser();
    24132415    if (focusedContentBrowser)
    24142416        return focusedContentBrowser;
    24152417
    2416     var tabContentView = this.tabBrowser.selectedTabContentView;
     2418    var tabContentView = WI.tabBrowser.selectedTabContentView;
    24172419    if (tabContentView.contentBrowser)
    24182420        return tabContentView.contentBrowser;
     
    24232425WI.focusedOrVisibleContentView = function()
    24242426{
    2425     let focusedContentView = this._focusedContentView();
     2427    let focusedContentView = WI._focusedContentView();
    24262428    if (focusedContentView)
    24272429        return focusedContentView;
    24282430
    2429     var tabContentView = this.tabBrowser.selectedTabContentView;
     2431    var tabContentView = WI.tabBrowser.selectedTabContentView;
    24302432    if (tabContentView.contentBrowser)
    24312433        return tabContentView.contentBrowser.currentContentView;
     
    24392441    // If there is no selection, see if the focused element or focused ContentView can handle the copy event.
    24402442    if (selection.isCollapsed && !WI.isEventTargetAnEditableField(event)) {
    2441         var focusedCopyHandler = this.currentFocusElement && this.currentFocusElement.copyHandler;
     2443        var focusedCopyHandler = WI.currentFocusElement && WI.currentFocusElement.copyHandler;
    24422444        if (focusedCopyHandler && typeof focusedCopyHandler.handleBeforeCopyEvent === "function") {
    24432445            focusedCopyHandler.handleBeforeCopyEvent(event);
     
    24462448        }
    24472449
    2448         var focusedContentView = this._focusedContentView();
     2450        var focusedContentView = WI._focusedContentView();
    24492451        if (focusedContentView && typeof focusedContentView.handleCopyEvent === "function") {
    24502452            event.preventDefault();
     
    24642466WI._find = function(event)
    24652467{
    2466     let contentBrowser = this._focusedOrVisibleContentBrowser();
     2468    let contentBrowser = WI._focusedOrVisibleContentBrowser();
    24672469    if (!contentBrowser)
    24682470        return;
     
    24732475WI._save = function(event)
    24742476{
    2475     var contentView = this.focusedOrVisibleContentView();
     2477    var contentView = WI.focusedOrVisibleContentView();
    24762478    if (!contentView || !contentView.supportsSave)
    24772479        return;
     
    24822484WI._saveAs = function(event)
    24832485{
    2484     var contentView = this.focusedOrVisibleContentView();
     2486    var contentView = WI.focusedOrVisibleContentView();
    24852487    if (!contentView || !contentView.supportsSave)
    24862488        return;
     
    24912493WI._clear = function(event)
    24922494{
    2493     let contentView = this.focusedOrVisibleContentView();
     2495    let contentView = WI.focusedOrVisibleContentView();
    24942496    if (!contentView || typeof contentView.handleClearShortcut !== "function") {
    2495         // If the current content view is unable to handle this event, clear the console to reset
     2497        // If the current content view is unable to handle WI event, clear the console to reset
    24962498        // the dashboard counters.
    2497         this.consoleManager.requestClearMessages();
     2499        WI.consoleManager.requestClearMessages();
    24982500        return;
    24992501    }
     
    25042506WI._populateFind = function(event)
    25052507{
    2506     let focusedContentView = this._focusedContentView();
     2508    let focusedContentView = WI._focusedContentView();
    25072509    if (!focusedContentView)
    25082510        return;
     
    25132515    }
    25142516
    2515     let contentBrowser = this._focusedOrVisibleContentBrowser();
     2517    let contentBrowser = WI._focusedOrVisibleContentBrowser();
    25162518    if (!contentBrowser)
    25172519        return;
     
    25222524WI._findNext = function(event)
    25232525{
    2524     let focusedContentView = this._focusedContentView();
     2526    let focusedContentView = WI._focusedContentView();
    25252527    if (!focusedContentView)
    25262528        return;
     
    25312533    }
    25322534
    2533     let contentBrowser = this._focusedOrVisibleContentBrowser();
     2535    let contentBrowser = WI._focusedOrVisibleContentBrowser();
    25342536    if (!contentBrowser)
    25352537        return;
     
    25402542WI._findPrevious = function(event)
    25412543{
    2542     let focusedContentView = this._focusedContentView();
     2544    let focusedContentView = WI._focusedContentView();
    25432545    if (!focusedContentView)
    25442546        return;
     
    25492551    }
    25502552
    2551     let contentBrowser = this._focusedOrVisibleContentBrowser();
     2553    let contentBrowser = WI._focusedOrVisibleContentBrowser();
    25522554    if (!contentBrowser)
    25532555        return;
     
    25622564    // If there is no selection, pass the copy event on to the focused element or focused ContentView.
    25632565    if (selection.isCollapsed && !WI.isEventTargetAnEditableField(event)) {
    2564         var focusedCopyHandler = this.currentFocusElement && this.currentFocusElement.copyHandler;
     2566        var focusedCopyHandler = WI.currentFocusElement && WI.currentFocusElement.copyHandler;
    25652567        if (focusedCopyHandler && typeof focusedCopyHandler.handleCopyEvent === "function") {
    25662568            focusedCopyHandler.handleCopyEvent(event);
     
    25692571        }
    25702572
    2571         var focusedContentView = this._focusedContentView();
     2573        var focusedContentView = WI._focusedContentView();
    25722574        if (focusedContentView && typeof focusedContentView.handleCopyEvent === "function") {
    25732575            focusedContentView.handleCopyEvent(event);
     
    25752577        }
    25762578
    2577         let tabContentView = this.tabBrowser.selectedTabContentView;
     2579        let tabContentView = WI.tabBrowser.selectedTabContentView;
    25782580        if (tabContentView && typeof tabContentView.handleCopyEvent === "function") {
    25792581            tabContentView.handleCopyEvent(event);
     
    25972599    const epsilon = 0.0001;
    25982600    const maximumZoom = 2.4;
    2599     let currentZoom = this.getZoomFactor();
     2601    let currentZoom = WI.getZoomFactor();
    26002602    if (currentZoom + epsilon >= maximumZoom) {
    26012603        InspectorFrontendHost.beep();
     
    26032605    }
    26042606
    2605     this.setZoomFactor(Math.min(maximumZoom, currentZoom + 0.2));
     2607    WI.setZoomFactor(Math.min(maximumZoom, currentZoom + 0.2));
    26062608};
    26072609
     
    26102612    const epsilon = 0.0001;
    26112613    const minimumZoom = 0.6;
    2612     let currentZoom = this.getZoomFactor();
     2614    let currentZoom = WI.getZoomFactor();
    26132615    if (currentZoom - epsilon <= minimumZoom) {
    26142616        InspectorFrontendHost.beep();
     
    26162618    }
    26172619
    2618     this.setZoomFactor(Math.max(minimumZoom, currentZoom - 0.2));
     2620    WI.setZoomFactor(Math.max(minimumZoom, currentZoom - 0.2));
    26192621};
    26202622
    26212623WI._resetZoom = function(event)
    26222624{
    2623     this.setZoomFactor(1);
     2625    WI.setZoomFactor(1);
    26242626};
    26252627
     
    26552657    WI.settings.layoutDirection.value = value;
    26562658
    2657     if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL && this._dockConfiguration === WI.DockConfiguration.Right)
    2658         this._dockLeft();
    2659 
    2660     if (WI.resolvedLayoutDirection() === WI.LayoutDirection.LTR && this._dockConfiguration === WI.DockConfiguration.Left)
    2661         this._dockRight();
     2659    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL && WI._dockConfiguration === WI.DockConfiguration.Right)
     2660        WI._dockLeft();
     2661
     2662    if (WI.resolvedLayoutDirection() === WI.LayoutDirection.LTR && WI._dockConfiguration === WI.DockConfiguration.Left)
     2663        WI._dockRight();
    26622664
    26632665    InspectorFrontendHost.reopen();
    26642666};
    26652667
    2666 WI._showTabAtIndex = function(i, event)
     2668WI._showTabAtIndex = function(i)
    26672669{
    26682670    if (i <= WI.tabBar.tabBarItems.length)
     
    28482850
    28492851        if (event.metaKey)
    2850             this.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation, options);
     2852            WI.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation, options);
    28512853        else
    2852             this.showSourceCodeLocation(sourceCodeLocation, options);
    2853     }
    2854 
    2855     linkElement.addEventListener("click", showSourceCodeLocation.bind(this));
     2854            WI.showSourceCodeLocation(sourceCodeLocation, options);
     2855    }
     2856
     2857    linkElement.addEventListener("click", showSourceCodeLocation);
    28562858    linkElement.addEventListener("contextmenu", (event) => {
    28572859        let contextMenu = WI.ContextMenu.createFromEvent(event);
     
    29522954    linkNode.title = resource.url;
    29532955    linkNode.textContent = (resource.urlComponents.lastPathComponent || resource.url).insertWordBreakCharacters();
    2954     linkNode.addEventListener("click", handleClick.bind(this));
     2956    linkNode.addEventListener("click", handleClick);
    29552957    return linkNode;
    29562958};
     
    29582960WI._undoKeyboardShortcut = function(event)
    29592961{
    2960     if (!this.isEditingAnyField() && !this.isEventTargetAnEditableField(event)) {
    2961         this.undo();
     2962    if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event)) {
     2963        WI.undo();
    29622964        event.preventDefault();
    29632965    }
     
    29662968WI._redoKeyboardShortcut = function(event)
    29672969{
    2968     if (!this.isEditingAnyField() && !this.isEventTargetAnEditableField(event)) {
    2969         this.redo();
     2970    if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event)) {
     2971        WI.redo();
    29702972        event.preventDefault();
    29712973    }
     
    30783080WI.archiveMainFrame = function()
    30793081{
    3080     this._downloadingPage = true;
    3081     this._updateDownloadToolbarButton();
     3082    WI._downloadingPage = true;
     3083    WI._updateDownloadToolbarButton();
    30823084
    30833085    PageAgent.archive((error, data) => {
    3084         this._downloadingPage = false;
    3085         this._updateDownloadToolbarButton();
     3086        WI._downloadingPage = false;
     3087        WI._updateDownloadToolbarButton();
    30863088
    30873089        if (error)
     
    30983100WI.canArchiveMainFrame = function()
    30993101{
    3100     if (this.sharedApp.debuggableType !== WI.DebuggableType.Web)
     3102    if (WI.sharedApp.debuggableType !== WI.DebuggableType.Web)
    31013103        return false;
    31023104
     
    31123114        return;
    31133115
    3114     this._windowKeydownListeners.push(listener);
    3115 
    3116     this._updateWindowKeydownListener();
     3116    WI._windowKeydownListeners.push(listener);
     3117
     3118    WI._updateWindowKeydownListener();
    31173119};
    31183120
    31193121WI.removeWindowKeydownListener = function(listener)
    31203122{
    3121     this._windowKeydownListeners.remove(listener);
    3122 
    3123     this._updateWindowKeydownListener();
     3123    WI._windowKeydownListeners.remove(listener);
     3124
     3125    WI._updateWindowKeydownListener();
    31243126};
    31253127
    31263128WI._updateWindowKeydownListener = function()
    31273129{
    3128     if (this._windowKeydownListeners.length === 1)
     3130    if (WI._windowKeydownListeners.length === 1)
    31293131        window.addEventListener("keydown", WI._sharedWindowKeydownListener, true);
    3130     else if (!this._windowKeydownListeners.length)
     3132    else if (!WI._windowKeydownListeners.length)
    31313133        window.removeEventListener("keydown", WI._sharedWindowKeydownListener, true);
    31323134};
  • trunk/Source/WebInspectorUI/UserInterface/Test/Test.js

    r243272 r244266  
    6868
    6969    // Register for events.
    70     document.addEventListener("DOMContentLoaded", this.contentLoaded);
     70    document.addEventListener("DOMContentLoaded", WI.contentLoaded);
    7171
    7272    // Non-default global setting values for tests.
Note: See TracChangeset for help on using the changeset viewer.