Changeset 244266 in webkit
- Timestamp:
- Apr 15, 2019 10:24:54 AM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r244265 r244266 1 2019-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 1 12 2019-04-15 Devin Rousso <drousso@apple.com> 2 13 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r244180 r244266 95 95 // Listen for the ProvisionalLoadStarted event before registering for events so our code gets called before any managers or sidebars. 96 96 // 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,); 98 98 99 99 // Populate any UIStrings that must be done early after localized strings have loaded. … … 126 126 127 127 // 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); 140 140 141 141 // 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", [ 144 144 WI.ElementsTabContentView.Type, 145 145 WI.NetworkTabContentView.Type, … … 152 152 WI.ConsoleTabContentView.Type, 153 153 ]); 154 this._selectedTabIndexSetting = new WI.Setting("selected-tab-index", 0);154 WI._selectedTabIndexSetting = new WI.Setting("selected-tab-index", 0); 155 155 156 156 // 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; 164 164 WI._overridenDeviceUserAgent = null; 165 165 WI._overridenDeviceSettings = new Map; … … 189 189 WI.resetMainExecutionContext(); 190 190 191 this._targetsAvailablePromise.resolve();191 WI._targetsAvailablePromise.resolve(); 192 192 }; 193 193 … … 217 217 218 218 // Actions to transition the page target. 219 this.notifications.dispatchEventToListeners(WI.Notification.TransitionPageTarget);219 WI.notifications.dispatchEventToListeners(WI.Notification.TransitionPageTarget); 220 220 WI.domManager.transitionPageTarget(); 221 221 WI.networkManager.transitionPageTarget(); … … 268 268 269 269 // 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); 286 286 287 287 // Add platform style classes so the UI can be tweaked per-platform. … … 300 300 301 301 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); 307 307 308 308 function setTabSize() { … … 324 324 setWhitespaceCharacterClassName(); 325 325 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); 329 329 330 330 // Create the user interface elements. 331 this.toolbar = new WI.Toolbar(document.getElementById("toolbar"));331 WI.toolbar = new WI.Toolbar(document.getElementById("toolbar")); 332 332 333 333 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")); 335 335 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); 345 345 346 346 // 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; 362 362 363 363 // 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); 425 425 426 426 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); 438 438 439 439 let reloadToolTip; 440 440 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); 442 442 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); 449 449 450 450 let elementSelectionToolTip = WI.UIString("Start element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName); 451 451 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); 454 454 455 455 // COMPATIBILITY (iOS 12.2): Page.overrideSetting did not exist. … … 457 457 const deviceSettingsTooltip = WI.UIString("Device Settings"); 458 458 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); 460 460 461 461 WI._deviceSettingsPopover = null; 462 462 } 463 463 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 = { 469 469 default: new WI.DefaultDashboard, 470 470 debugger: new WI.DebuggerDashboard, 471 471 }; 472 472 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); 488 488 489 489 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; 493 493 494 494 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}); 497 497 } else { 498 498 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); 502 502 } 503 503 504 504 let dockedResizerElement = document.getElementById("docked-resizer"); 505 505 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(); 512 512 513 513 // These tabs are always available for selecting, modulo isTabAllowed(). … … 530 530 ]; 531 531 532 this._knownTabClassesByType = new Map;532 WI._knownTabClassesByType = new Map; 533 533 // Set tab classes directly. The public API triggers other updates and 534 // notifications that won't work or have no listeners at thispoint.534 // notifications that won't work or have no listeners at WI point. 535 535 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 thissetting. 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; 542 542 let seenTabTypes = new Set; 543 543 … … 549 549 seenTabTypes.add(tabType); 550 550 551 if (! this.isTabTypeAllowed(tabType)) {552 this._pendingOpenTabs.push({tabType, index: i});551 if (!WI.isTabTypeAllowed(tabType)) { 552 WI._pendingOpenTabs.push({tabType, index: i}); 553 553 continue; 554 554 } 555 555 556 if (! this.isNewTabWithTypeAllowed(tabType))556 if (!WI.isNewTabWithTypeAllowed(tabType)) 557 557 continue; 558 558 559 let tabContentView = this._createTabContentViewForType(tabType);559 let tabContentView = WI._createTabContentViewForType(tabType); 560 560 if (!tabContentView) 561 561 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}); 574 574 575 575 // 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); 579 579 580 580 // Signal that the frontend is now ready to receive messages. … … 590 590 InspectorFrontendHost.loaded(); 591 591 592 if ( this._showingSplitConsoleSetting.value)593 this.showSplitConsole();594 595 // Store thison 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. 596 596 window.__frontendCompletedLoad = true; 597 597 … … 638 638 WI.targetsAvailable = function() 639 639 { 640 return this._targetsAvailablePromise.settled;640 return WI._targetsAvailablePromise.settled; 641 641 }; 642 642 643 643 WI.whenTargetsAvailable = function() 644 644 { 645 return this._targetsAvailablePromise.promise;645 return WI._targetsAvailablePromise.promise; 646 646 }; 647 647 648 648 WI.isTabTypeAllowed = function(tabType) 649 649 { 650 let tabClass = this._knownTabClassesByType.get(tabType);650 let tabClass = WI._knownTabClassesByType.get(tabType); 651 651 if (!tabClass) 652 652 return false; … … 657 657 WI.knownTabClasses = function() 658 658 { 659 return new Set( this._knownTabClassesByType.values());659 return new Set(WI._knownTabClassesByType.values()); 660 660 }; 661 661 662 662 WI._showOpenResourceDialog = function() 663 663 { 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); 671 671 }; 672 672 673 673 WI._createTabContentViewForType = function(tabType) 674 674 { 675 let tabClass = this._knownTabClassesByType.get(tabType);675 let tabClass = WI._knownTabClassesByType.get(tabType); 676 676 if (!tabClass) { 677 677 console.error("Unknown tab type", tabType); … … 688 688 let openTabs = []; 689 689 690 for (let tabBarItem of this.tabBar.tabBarItems) {690 for (let tabBarItem of WI.tabBar.tabBarItems) { 691 691 let tabContentView = tabBarItem.representedObject; 692 692 if (!(tabContentView instanceof WI.TabContentView)) … … 700 700 701 701 // 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) { 703 703 if (seenTabTypes.has(tabType)) 704 704 continue; … … 707 707 } 708 708 709 this._openTabsSetting.value = openTabs;709 WI._openTabsSetting.value = openTabs; 710 710 }; 711 711 712 712 WI._openDefaultTab = function(event) 713 713 { 714 this.showNewTabTab({suppressAnimations: true});714 WI.showNewTabTab({suppressAnimations: true}); 715 715 }; 716 716 … … 718 718 { 719 719 if (event.keyIdentifier === "U+002C") // "," 720 this.tabBrowser.showTabForContentView(this.settingsTabContentView);720 WI.tabBrowser.showTabForContentView(WI.settingsTabContentView); 721 721 }; 722 722 … … 724 724 { 725 725 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)) { 728 728 stillPendingOpenTabs.push({tabType, index}); 729 729 continue; 730 730 } 731 731 732 let tabContentView = this._createTabContentViewForType(tabType);732 let tabContentView = WI._createTabContentViewForType(tabType); 733 733 if (!tabContentView) 734 734 continue; 735 735 736 this.tabBrowser.addTabForContentView(tabContentView, {736 WI.tabBrowser.addTabForContentView(tabContentView, { 737 737 suppressAnimations: true, 738 738 insertionIndex: index, … … 742 742 } 743 743 744 this._pendingOpenTabs = stillPendingOpenTabs;744 WI._pendingOpenTabs = stillPendingOpenTabs; 745 745 746 746 if (!WI.settings.experimentalEnableNewTabBar.value) 747 this.tabBar.updateNewTabTabBarItemState();747 WI.tabBar.updateNewTabTabBarItemState(); 748 748 }; 749 749 750 750 WI.showNewTabTab = function(options) 751 751 { 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); 756 756 if (!tabContentView) 757 757 tabContentView = new WI.NewTabContentView; 758 this.tabBrowser.showTabForContentView(tabContentView, options);758 WI.tabBrowser.showTabForContentView(tabContentView, options); 759 759 }; 760 760 761 761 WI.isNewTabWithTypeAllowed = function(tabType) 762 762 { 763 let tabClass = this._knownTabClassesByType.get(tabType);763 let tabClass = WI._knownTabClassesByType.get(tabType); 764 764 if (!tabClass || !tabClass.isTabAllowed()) 765 765 return false; 766 766 767 767 // Only allow one tab per class for now. 768 for (let tabBarItem of this.tabBar.tabBarItems) {768 for (let tabBarItem of WI.tabBar.tabBarItems) { 769 769 let tabContentView = tabBarItem.representedObject; 770 770 if (!(tabContentView instanceof WI.TabContentView)) … … 775 775 776 776 if (tabClass === WI.NewTabContentView) { 777 let allTabs = Array.from( this.knownTabClasses());777 let allTabs = Array.from(WI.knownTabClasses()); 778 778 let addableTabs = allTabs.filter((tabClass) => !tabClass.tabInfo().isEphemeral); 779 779 let canMakeNewTab = addableTabs.some((tabClass) => WI.isNewTabWithTypeAllowed(tabClass.Type)); … … 786 786 WI.createNewTabWithType = function(tabType, options = {}) 787 787 { 788 console.assert( this.isNewTabWithTypeAllowed(tabType));788 console.assert(WI.isNewTabWithTypeAllowed(tabType)); 789 789 790 790 let {referencedView, shouldReplaceTab, shouldShowNewTab} = options; … … 792 792 console.assert(!shouldReplaceTab || referencedView, "Must provide a reference view to replace a tab."); 793 793 794 let tabContentView = this._createTabContentViewForType(tabType);794 let tabContentView = WI._createTabContentViewForType(tabType); 795 795 const suppressAnimations = true; 796 this.tabBrowser.addTabForContentView(tabContentView, {796 WI.tabBrowser.addTabForContentView(tabContentView, { 797 797 suppressAnimations, 798 insertionIndex: referencedView ? this.tabBar.tabBarItems.indexOf(referencedView.tabBarItem) : undefined,798 insertionIndex: referencedView ? WI.tabBar.tabBarItems.indexOf(referencedView.tabBarItem) : undefined, 799 799 }); 800 800 801 801 if (shouldReplaceTab) 802 this.tabBrowser.closeTabForContentView(referencedView, {suppressAnimations});802 WI.tabBrowser.closeTabForContentView(referencedView, {suppressAnimations}); 803 803 804 804 if (shouldShowNewTab) 805 this.tabBrowser.showTabForContentView(tabContentView);805 WI.tabBrowser.showTabForContentView(tabContentView); 806 806 }; 807 807 808 808 WI.activateExtraDomains = function(domains) 809 809 { 810 this.notifications.dispatchEventToListeners(WI.Notification.ExtraDomainsActivated, {domains});810 WI.notifications.dispatchEventToListeners(WI.Notification.ExtraDomainsActivated, {domains}); 811 811 812 812 if (WI.mainTarget) { … … 824 824 } 825 825 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(); 831 831 }; 832 832 833 833 WI.updateWindowTitle = function() 834 834 { 835 var mainFrame = this.networkManager.mainFrame;835 var mainFrame = WI.networkManager.mainFrame; 836 836 if (!mainFrame) 837 837 return; … … 848 848 // Build a title based on the URL components. 849 849 if (urlComponents.host && lastPathComponent) 850 var title = this.displayNameForHost(urlComponents.host) + " \u2014 " + lastPathComponent;850 var title = WI.displayNameForHost(urlComponents.host) + " \u2014 " + lastPathComponent; 851 851 else if (urlComponents.host) 852 var title = this.displayNameForHost(urlComponents.host);852 var title = WI.displayNameForHost(urlComponents.host); 853 853 else if (lastPathComponent) 854 854 var title = lastPathComponent; … … 856 856 var title = mainFrame.url; 857 857 858 // The name "inspectedURLChanged" sounds like the whole URL is required, however thisis only858 // The name "inspectedURLChanged" sounds like the whole URL is required, however WI is only 859 859 // used for updating the window title and it can be any string. 860 860 InspectorFrontendHost.inspectedURLChanged(title); … … 863 863 WI.updateDockingAvailability = function(available) 864 864 { 865 this._dockingAvailable = available;866 867 this._updateDockNavigationItems();865 WI._dockingAvailable = available; 866 867 WI._updateDockNavigationItems(); 868 868 }; 869 869 870 870 WI.updateDockedState = function(side) 871 871 { 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) { 878 878 if (side === WI.DockConfiguration.Right || side === WI.DockConfiguration.Left) 879 this._previousDockConfiguration = WI.DockConfiguration.Bottom;879 WI._previousDockConfiguration = WI.DockConfiguration.Bottom; 880 880 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; 889 889 890 890 if (side === WI.DockConfiguration.Bottom) { … … 900 900 document.body.classList.remove("docked", WI.DockConfiguration.Right, WI.DockConfiguration.Left, WI.DockConfiguration.Bottom); 901 901 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(); 908 908 }; 909 909 910 910 WI.updateVisibilityState = function(visible) 911 911 { 912 this.visible = visible;913 this.notifications.dispatchEventToListeners(WI.Notification.VisibilityStateDidChange);912 WI.visible = visible; 913 WI.notifications.dispatchEventToListeners(WI.Notification.VisibilityStateDidChange); 914 914 }; 915 915 … … 929 929 event.stopPropagation(); 930 930 931 this.openURL(anchorElement.href, frame, {931 WI.openURL(anchorElement.href, frame, { 932 932 ...options, 933 933 lineNumber: anchorElement.lineNumber, … … 957 957 let searchChildFrames = false; 958 958 if (!frame) { 959 frame = this.networkManager.mainFrame;959 frame = WI.networkManager.mainFrame; 960 960 searchChildFrames = true; 961 961 } … … 971 971 if (resource) { 972 972 let positionToReveal = new WI.SourceCodePosition(options.lineNumber, 0); 973 this.showSourceCode(resource, {...options, positionToReveal});973 WI.showSourceCode(resource, {...options, positionToReveal}); 974 974 return; 975 975 } … … 980 980 WI.close = function() 981 981 { 982 if ( this._isClosing)983 return; 984 985 this._isClosing = true;982 if (WI._isClosing) 983 return; 984 985 WI._isClosing = true; 986 986 987 987 InspectorFrontendHost.closeWindow(); … … 990 990 WI.isConsoleFocused = function() 991 991 { 992 return this.quickConsole.prompt.focused;992 return WI.quickConsole.prompt.focused; 993 993 }; 994 994 995 995 WI.isShowingSplitConsole = function() 996 996 { 997 return ! this.consoleDrawer.collapsed;997 return !WI.consoleDrawer.collapsed; 998 998 }; 999 999 1000 1000 WI.dockedConfigurationSupportsSplitContentBrowser = function() 1001 1001 { 1002 return this._dockConfiguration !== WI.DockConfiguration.Bottom;1002 return WI._dockConfiguration !== WI.DockConfiguration.Bottom; 1003 1003 }; 1004 1004 1005 1005 WI.doesCurrentTabSupportSplitContentBrowser = function() 1006 1006 { 1007 var currentContentView = this.tabBrowser.selectedTabContentView;1007 var currentContentView = WI.tabBrowser.selectedTabContentView; 1008 1008 return !currentContentView || currentContentView.supportsSplitContentBrowser; 1009 1009 }; … … 1011 1011 WI.toggleSplitConsole = function() 1012 1012 { 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(); 1020 1020 else 1021 this.showSplitConsole();1021 WI.showSplitConsole(); 1022 1022 }; 1023 1023 1024 1024 WI.showSplitConsole = function() 1025 1025 { 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); 1037 1037 }; 1038 1038 1039 1039 WI.hideSplitConsole = function() 1040 1040 { 1041 if (! this.isShowingSplitConsole())1042 return; 1043 1044 this.consoleDrawer.collapsed = true;1041 if (!WI.isShowingSplitConsole()) 1042 return; 1043 1044 WI.consoleDrawer.collapsed = true; 1045 1045 }; 1046 1046 … … 1049 1049 requestedScope = requestedScope || WI.LogContentView.Scopes.All; 1050 1050 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()); 1058 1058 }; 1059 1059 1060 1060 WI.isShowingConsoleTab = function() 1061 1061 { 1062 return this.tabBrowser.selectedTabContentView instanceof WI.ConsoleTabContentView;1062 return WI.tabBrowser.selectedTabContentView instanceof WI.ConsoleTabContentView; 1063 1063 }; 1064 1064 1065 1065 WI.showElementsTab = function() 1066 1066 { 1067 var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.ElementsTabContentView);1067 var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.ElementsTabContentView); 1068 1068 if (!tabContentView) 1069 1069 tabContentView = new WI.ElementsTabContentView; 1070 this.tabBrowser.showTabForContentView(tabContentView);1070 WI.tabBrowser.showTabForContentView(tabContentView); 1071 1071 }; 1072 1072 1073 1073 WI.isShowingElementsTab = function() 1074 1074 { 1075 return this.tabBrowser.selectedTabContentView instanceof WI.ElementsTabContentView;1075 return WI.tabBrowser.selectedTabContentView instanceof WI.ElementsTabContentView; 1076 1076 }; 1077 1077 1078 1078 WI.showSourcesTab = function(options = {}) 1079 1079 { 1080 let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.SourcesTabContentView);1080 let tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.SourcesTabContentView); 1081 1081 if (!tabContentView) 1082 1082 tabContentView = new WI.SourcesTabContentView; … … 1088 1088 tabContentView.showScopeChainDetailsSidebarPanel(); 1089 1089 1090 this.tabBrowser.showTabForContentView(tabContentView);1090 WI.tabBrowser.showTabForContentView(tabContentView); 1091 1091 }; 1092 1092 1093 1093 WI.isShowingSourcesTab = function() 1094 1094 { 1095 return this.tabBrowser.selectedTabContentView instanceof WI.SourcesTabContentView;1095 return WI.tabBrowser.selectedTabContentView instanceof WI.SourcesTabContentView; 1096 1096 }; 1097 1097 1098 1098 WI.showDebuggerTab = function(options) 1099 1099 { 1100 var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.DebuggerTabContentView);1100 var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.DebuggerTabContentView); 1101 1101 if (!tabContentView) 1102 1102 tabContentView = new WI.DebuggerTabContentView; … … 1108 1108 tabContentView.showScopeChainDetailsSidebarPanel(); 1109 1109 1110 this.tabBrowser.showTabForContentView(tabContentView);1110 WI.tabBrowser.showTabForContentView(tabContentView); 1111 1111 }; 1112 1112 1113 1113 WI.isShowingDebuggerTab = function() 1114 1114 { 1115 return this.tabBrowser.selectedTabContentView instanceof WI.DebuggerTabContentView;1115 return WI.tabBrowser.selectedTabContentView instanceof WI.DebuggerTabContentView; 1116 1116 }; 1117 1117 1118 1118 WI.showResourcesTab = function() 1119 1119 { 1120 var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.ResourcesTabContentView);1120 var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.ResourcesTabContentView); 1121 1121 if (!tabContentView) 1122 1122 tabContentView = new WI.ResourcesTabContentView; 1123 this.tabBrowser.showTabForContentView(tabContentView);1123 WI.tabBrowser.showTabForContentView(tabContentView); 1124 1124 }; 1125 1125 1126 1126 WI.isShowingResourcesTab = function() 1127 1127 { 1128 return this.tabBrowser.selectedTabContentView instanceof WI.ResourcesTabContentView;1128 return WI.tabBrowser.selectedTabContentView instanceof WI.ResourcesTabContentView; 1129 1129 }; 1130 1130 1131 1131 WI.showStorageTab = function() 1132 1132 { 1133 var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.StorageTabContentView);1133 var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.StorageTabContentView); 1134 1134 if (!tabContentView) 1135 1135 tabContentView = new WI.StorageTabContentView; 1136 this.tabBrowser.showTabForContentView(tabContentView);1136 WI.tabBrowser.showTabForContentView(tabContentView); 1137 1137 }; 1138 1138 1139 1139 WI.showNetworkTab = function() 1140 1140 { 1141 let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.NetworkTabContentView);1141 let tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.NetworkTabContentView); 1142 1142 if (!tabContentView) 1143 1143 tabContentView = new WI.NetworkTabContentView; 1144 1144 1145 this.tabBrowser.showTabForContentView(tabContentView);1145 WI.tabBrowser.showTabForContentView(tabContentView); 1146 1146 }; 1147 1147 1148 1148 WI.isShowingNetworkTab = function() 1149 1149 { 1150 return this.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView;1150 return WI.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView; 1151 1151 }; 1152 1152 1153 1153 WI.isShowingSearchTab = function() 1154 1154 { 1155 return this.tabBrowser.selectedTabContentView instanceof WI.SearchTabContentView;1155 return WI.tabBrowser.selectedTabContentView instanceof WI.SearchTabContentView; 1156 1156 }; 1157 1157 1158 1158 WI.showTimelineTab = function() 1159 1159 { 1160 var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.TimelineTabContentView);1160 var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.TimelineTabContentView); 1161 1161 if (!tabContentView) 1162 1162 tabContentView = new WI.TimelineTabContentView; 1163 this.tabBrowser.showTabForContentView(tabContentView);1163 WI.tabBrowser.showTabForContentView(tabContentView); 1164 1164 }; 1165 1165 1166 1166 WI.showLayersTab = function(options = {}) 1167 1167 { 1168 let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.LayersTabContentView);1168 let tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.LayersTabContentView); 1169 1169 if (!tabContentView) 1170 1170 tabContentView = new WI.LayersTabContentView; 1171 1171 if (options.nodeToSelect) 1172 1172 tabContentView.selectLayerForNode(options.nodeToSelect); 1173 this.tabBrowser.showTabForContentView(tabContentView);1173 WI.tabBrowser.showTabForContentView(tabContentView); 1174 1174 }; 1175 1175 1176 1176 WI.isShowingLayersTab = function() 1177 1177 { 1178 return this.tabBrowser.selectedTabContentView instanceof WI.LayersTabContentView;1178 return WI.tabBrowser.selectedTabContentView instanceof WI.LayersTabContentView; 1179 1179 }; 1180 1180 … … 1188 1188 WI.restoreFocusFromElement = function(element) 1189 1189 { 1190 if (element && element.contains( this.currentFocusElement))1191 this.previousFocusElement.focus();1190 if (element && element.contains(WI.currentFocusElement)) 1191 WI.previousFocusElement.focus(); 1192 1192 }; 1193 1193 1194 1194 WI.toggleNavigationSidebar = function(event) 1195 1195 { 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; 1204 1204 }; 1205 1205 1206 1206 WI.toggleDetailsSidebar = function(event) 1207 1207 { 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; 1216 1216 }; 1217 1217 … … 1223 1223 1224 1224 let minimumWidth = window.innerWidth - minimumContentBrowserWidth; 1225 let tabContentView = this.tabBrowser.selectedTabContentView;1225 let tabContentView = WI.tabBrowser.selectedTabContentView; 1226 1226 console.assert(tabContentView); 1227 1227 if (!tabContentView) … … 1229 1229 1230 1230 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; 1233 1233 else 1234 otherSidebar = tabContentView.navigationSidebarPanel ? this.navigationSidebar : null;1234 otherSidebar = tabContentView.navigationSidebarPanel ? WI.navigationSidebar : null; 1235 1235 1236 1236 if (otherSidebar) … … 1248 1248 return WI.TimelineTabContentView; 1249 1249 1250 // We only support one console tab right now. So thisisn'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) 1252 1252 return WI.ConsoleTabContentView; 1253 1253 … … 1303 1303 WI.tabContentViewForRepresentedObject = function(representedObject, options = {}) 1304 1304 { 1305 let tabContentView = this.tabBrowser.bestTabContentViewForRepresentedObject(representedObject, options);1305 let tabContentView = WI.tabBrowser.bestTabContentViewForRepresentedObject(representedObject, options); 1306 1306 if (tabContentView) 1307 1307 return tabContentView; 1308 1308 1309 var tabContentViewClass = this.tabContentViewClassForRepresentedObject(representedObject);1309 var tabContentViewClass = WI.tabContentViewClassForRepresentedObject(representedObject); 1310 1310 if (!tabContentViewClass) { 1311 1311 console.error("Unknown representedObject, couldn't create TabContentView.", representedObject); … … 1315 1315 tabContentView = new tabContentViewClass; 1316 1316 1317 this.tabBrowser.addTabForContentView(tabContentView);1317 WI.tabBrowser.addTabForContentView(tabContentView); 1318 1318 1319 1319 return tabContentView; … … 1322 1322 WI.showRepresentedObject = function(representedObject, cookie, options = {}) 1323 1323 { 1324 let tabContentView = this.tabContentViewForRepresentedObject(representedObject, options);1324 let tabContentView = WI.tabContentViewForRepresentedObject(representedObject, options); 1325 1325 console.assert(tabContentView); 1326 1326 if (!tabContentView) 1327 1327 return; 1328 1328 1329 this.tabBrowser.showTabForContentView(tabContentView, options);1329 WI.tabBrowser.showTabForContentView(tabContentView, options); 1330 1330 tabContentView.showRepresentedObject(representedObject, cookie); 1331 1331 }; … … 1336 1336 if (!WI.networkManager.mainFrame) 1337 1337 return; 1338 this.showRepresentedObject(WI.networkManager.mainFrame.domTree, {nodeToSelect}, options);1338 WI.showRepresentedObject(WI.networkManager.mainFrame.domTree, {nodeToSelect}, options); 1339 1339 }; 1340 1340 … … 1343 1343 var frame = WI.networkManager.frameForIdentifier(frameIdentifier); 1344 1344 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); 1352 1352 }; 1353 1353 … … 1365 1365 1366 1366 var cookie = positionToReveal ? {lineNumber: positionToReveal.lineNumber, columnNumber: positionToReveal.columnNumber} : {}; 1367 this.showRepresentedObject(representedObject, cookie, options);1367 WI.showRepresentedObject(representedObject, cookie, options); 1368 1368 }; 1369 1369 1370 1370 WI.showSourceCodeLocation = function(sourceCodeLocation, options = {}) 1371 1371 { 1372 this.showSourceCode(sourceCodeLocation.displaySourceCode, {1372 WI.showSourceCode(sourceCodeLocation.displaySourceCode, { 1373 1373 ...options, 1374 1374 positionToReveal: sourceCodeLocation.displayPosition(), … … 1378 1378 WI.showOriginalUnformattedSourceCodeLocation = function(sourceCodeLocation, options = {}) 1379 1379 { 1380 this.showSourceCode(sourceCodeLocation.sourceCode, {1380 WI.showSourceCode(sourceCodeLocation.sourceCode, { 1381 1381 ...options, 1382 1382 positionToReveal: sourceCodeLocation.position(), … … 1387 1387 WI.showOriginalOrFormattedSourceCodeLocation = function(sourceCodeLocation, options = {}) 1388 1388 { 1389 this.showSourceCode(sourceCodeLocation.sourceCode, {1389 WI.showSourceCode(sourceCodeLocation.sourceCode, { 1390 1390 ...options, 1391 1391 positionToReveal: sourceCodeLocation.formattedPosition(), … … 1396 1396 { 1397 1397 var textRangeToSelect = sourceCodeTextRange.formattedTextRange; 1398 this.showSourceCode(sourceCodeTextRange.sourceCode, {1398 WI.showSourceCode(sourceCodeTextRange.sourceCode, { 1399 1399 ...options, 1400 1400 positionToReveal: textRangeToSelect.startPosition(), … … 1405 1405 WI.showResourceRequest = function(resource, options = {}) 1406 1406 { 1407 this.showRepresentedObject(resource, {[WI.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WI.ResourceClusterContentView.RequestIdentifier}, options);1407 WI.showRepresentedObject(resource, {[WI.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WI.ResourceClusterContentView.RequestIdentifier}, options); 1408 1408 }; 1409 1409 … … 1438 1438 WI._searchTextDidChange = function(event) 1439 1439 { 1440 var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.SearchTabContentView);1440 var tabContentView = WI.tabBrowser.bestTabContentViewForClass(WI.SearchTabContentView); 1441 1441 if (!tabContentView) 1442 1442 tabContentView = new WI.SearchTabContentView; 1443 1443 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); 1448 1448 1449 1449 tabContentView.performSearch(searchQuery); … … 1453 1453 { 1454 1454 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(); 1464 1464 }; 1465 1465 … … 1479 1479 if (codeMirror) { 1480 1480 let codeMirrorElement = codeMirror.getWrapperElement(); 1481 if (codeMirrorElement && codeMirrorElement !== this.currentFocusElement)1481 if (codeMirrorElement && codeMirrorElement !== WI.currentFocusElement) 1482 1482 newFocusElement = codeMirrorElement; 1483 1483 } … … 1485 1485 1486 1486 if (newFocusElement) { 1487 this.previousFocusElement = this.currentFocusElement;1488 this.currentFocusElement = newFocusElement;1487 WI.previousFocusElement = WI.currentFocusElement; 1488 WI.currentFocusElement = newFocusElement; 1489 1489 } 1490 1490 1491 // Due to the change in WI.isEventTargetAnEditableField (r196271), thisreturn1491 // Due to the change in WI.isEventTargetAnEditableField (r196271), WI return 1492 1492 // will also get run when WI.startEditing is called on an element. We do not want 1493 // to return early in thiscase, as WI.EditingConfig handles its own editing1493 // to return early in WI case, as WI.EditingConfig handles its own editing 1494 1494 // completion, so only return early if the focus change target is not from WI.startEditing. 1495 1495 if (!WI.isBeingEdited(event.target)) … … 1503 1503 var element = event.target; 1504 1504 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; 1508 1508 } 1509 1509 … … 1521 1521 WI._mouseWasClicked = function(event) 1522 1522 { 1523 this.handlePossibleLinkClick(event);1523 WI.handlePossibleLinkClick(event); 1524 1524 }; 1525 1525 … … 1546 1546 WI.showDebuggerTab({showScopeChainSidebar: WI.settings.showScopeChainOnPause.value}); 1547 1547 1548 this._dashboardContainer.showDashboardViewForRepresentedObject(this._dashboards.debugger);1548 WI._dashboardContainer.showDashboardViewForRepresentedObject(WI._dashboards.debugger); 1549 1549 1550 1550 InspectorFrontendHost.bringToFront(); … … 1553 1553 WI._debuggerDidResume = function(event) 1554 1554 { 1555 this._dashboardContainer.closeDashboardViewForRepresentedObject(this._dashboards.debugger);1555 WI._dashboardContainer.closeDashboardViewForRepresentedObject(WI._dashboards.debugger); 1556 1556 }; 1557 1557 1558 1558 WI._frameWasAdded = function(event) 1559 1559 { 1560 if (! this._frameIdentifierToShowSourceCodeWhenAvailable)1560 if (!WI._frameIdentifierToShowSourceCodeWhenAvailable) 1561 1561 return; 1562 1562 1563 1563 var frame = event.data.frame; 1564 if (frame.id !== this._frameIdentifierToShowSourceCodeWhenAvailable)1564 if (frame.id !== WI._frameIdentifierToShowSourceCodeWhenAvailable) 1565 1565 return; 1566 1566 … … 1571 1571 ignoreSearchTab: true, 1572 1572 }; 1573 this.showSourceCodeForFrame(frame.id, options);1573 WI.showSourceCodeForFrame(frame.id, options); 1574 1574 } 1575 1575 1576 1576 // Delay showing the frame since FrameWasAdded is called before MainFrameChanged. 1577 1577 // Calling showSourceCodeForFrame before MainFrameChanged will show the frame then close it. 1578 setTimeout(delayedWork .bind(this));1578 setTimeout(delayedWork); 1579 1579 }; 1580 1580 1581 1581 WI._mainFrameDidChange = function(event) 1582 1582 { 1583 this._updateDownloadToolbarButton();1584 1585 this.updateWindowTitle();1583 WI._updateDownloadToolbarButton(); 1584 1585 WI.updateWindowTitle(); 1586 1586 }; 1587 1587 … … 1593 1593 // Run cookie restoration after we are sure all of the Tabs and NavigationSidebarPanels 1594 1594 // 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(); 1600 1602 }; 1601 1603 … … 1605 1607 return; 1606 1608 1607 this._saveCookieForOpenTabs();1609 WI._saveCookieForOpenTabs(); 1608 1610 }; 1609 1611 1610 1612 WI._restoreCookieForOpenTabs = function(restorationType) 1611 1613 { 1612 for (var tabBarItem of this.tabBar.tabBarItems) {1614 for (var tabBarItem of WI.tabBar.tabBarItems) { 1613 1615 var tabContentView = tabBarItem.representedObject; 1614 1616 if (!(tabContentView instanceof WI.TabContentView)) … … 1620 1622 WI._saveCookieForOpenTabs = function() 1621 1623 { 1622 for (var tabBarItem of this.tabBar.tabBarItems) {1624 for (var tabBarItem of WI.tabBar.tabBarItems) { 1623 1625 var tabContentView = tabBarItem.representedObject; 1624 1626 if (!(tabContentView instanceof WI.TabContentView)) … … 1634 1636 1635 1637 // 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"); 1637 1639 }; 1638 1640 … … 1643 1645 1644 1646 // 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"); 1646 1648 }; 1647 1649 1648 1650 WI._windowResized = function(event) 1649 1651 { 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(); 1653 1655 }; 1654 1656 … … 1662 1664 }; 1663 1665 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); 1672 1674 1673 1675 if (changed) 1674 this.notifications.dispatchEventToListeners(WI.Notification.GlobalModifierKeysDidChange, event);1676 WI.notifications.dispatchEventToListeners(WI.Notification.GlobalModifierKeysDidChange, event); 1675 1677 }; 1676 1678 1677 1679 WI._windowKeyDown = function(event) 1678 1680 { 1679 this._updateModifierKeys(event);1681 WI._updateModifierKeys(event); 1680 1682 }; 1681 1683 1682 1684 WI._windowKeyUp = function(event) 1683 1685 { 1684 this._updateModifierKeys(event);1686 WI._updateModifierKeys(event); 1685 1687 }; 1686 1688 1687 1689 WI._mouseDown = function(event) 1688 1690 { 1689 if ( this.toolbar.element.contains(event.target))1690 this._toolbarMouseDown(event);1691 if (WI.toolbar.element.contains(event.target)) 1692 WI._toolbarMouseDown(event); 1691 1693 }; 1692 1694 1693 1695 WI._mouseMoved = function(event) 1694 1696 { 1695 this._updateModifierKeys(event);1696 this.mouseCoords = {1697 WI._updateModifierKeys(event); 1698 WI.mouseCoords = { 1697 1699 x: event.pageX, 1698 1700 y: event.pageY … … 1702 1704 WI._pageHidden = function(event) 1703 1705 { 1704 this._saveCookieForOpenTabs();1706 WI._saveCookieForOpenTabs(); 1705 1707 }; 1706 1708 … … 1769 1771 WI._togglePreviousDockConfiguration = function(event) 1770 1772 { 1771 InspectorFrontendHost.requestSetDockSide( this._previousDockConfiguration);1773 InspectorFrontendHost.requestSetDockSide(WI._previousDockConfiguration); 1772 1774 }; 1773 1775 1774 1776 WI._updateDockNavigationItems = function() 1775 1777 { 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; 1781 1783 } 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; 1786 1788 } 1787 1789 }; … … 1789 1791 WI._tabBrowserSizeDidChange = function() 1790 1792 { 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); 1794 1796 }; 1795 1797 1796 1798 WI._consoleDrawerCollapsedStateDidChange = function(event) 1797 1799 { 1798 this._showingSplitConsoleSetting.value = WI.isShowingSplitConsole();1800 WI._showingSplitConsoleSetting.value = WI.isShowingSplitConsole(); 1799 1801 1800 1802 WI._consoleDrawerDidResize(); … … 1803 1805 WI._consoleDrawerDidResize = function(event) 1804 1806 { 1805 this.tabBrowser.updateLayout(WI.View.LayoutReason.Resize);1807 WI.tabBrowser.updateLayout(WI.View.LayoutReason.Resize); 1806 1808 }; 1807 1809 1808 1810 WI._sidebarWidthDidChange = function(event) 1809 1811 { 1810 this._tabBrowserSizeDidChange();1812 WI._tabBrowserSizeDidChange(); 1811 1813 }; 1812 1814 … … 1814 1816 { 1815 1817 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); 1823 1825 }; 1824 1826 1825 1827 WI._tabBrowserSelectedTabContentViewDidChange = function(event) 1826 1828 { 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(); 1834 1836 } 1835 1837 return; 1836 1838 } 1837 1839 1838 this._shouldRevealSpitConsoleIfSupported = this.isShowingSplitConsole();1839 this.hideSplitConsole();1840 WI._shouldRevealSpitConsoleIfSupported = WI.isShowingSplitConsole(); 1841 WI.hideSplitConsole(); 1840 1842 }; 1841 1843 … … 1845 1847 return; 1846 1848 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); 1852 1854 else 1853 this._moveWindowMouseDown(event);1855 WI._moveWindowMouseDown(event); 1854 1856 }; 1855 1857 … … 1859 1861 return; 1860 1862 1861 if (! this.docked)1863 if (!WI.docked) 1862 1864 return; 1863 1865 … … 1869 1871 event[WI.Popover.EventPreventDismissSymbol] = true; 1870 1872 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"; 1874 1876 1875 1877 var resizerElement = event.target; … … 1888 1890 lastScreenPosition = position; 1889 1891 1890 if ( this._dockConfiguration === WI.DockConfiguration.Left) {1892 if (WI._dockConfiguration === WI.DockConfiguration.Left) { 1891 1893 // If the mouse is travelling rightward but is positioned left of the resizer, ignore the event. 1892 1894 if (delta > 0 && clientPosition < firstClientPosition) … … 1913 1915 // If zoomed in/out, there be greater/fewer document pixels shown, but the inspector's 1914 1916 // 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) 1918 1920 InspectorFrontendHost.setAttachedWindowHeight(dimension); 1919 1921 else … … 1929 1931 } 1930 1932 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"); 1932 1934 }; 1933 1935 1934 1936 WI._moveWindowMouseDown = function(event) 1935 1937 { 1936 console.assert(! this.docked);1938 console.assert(!WI.docked); 1937 1939 1938 1940 if (event.button !== 0 || event.ctrlKey) … … 1982 1984 WI._domStorageWasInspected = function(event) 1983 1985 { 1984 this.showStorageTab();1985 this.showRepresentedObject(event.data.domStorage, null, {ignoreSearchTab: true});1986 WI.showStorageTab(); 1987 WI.showRepresentedObject(event.data.domStorage, null, {ignoreSearchTab: true}); 1986 1988 }; 1987 1989 1988 1990 WI._databaseWasInspected = function(event) 1989 1991 { 1990 this.showStorageTab();1991 this.showRepresentedObject(event.data.database, null, {ignoreSearchTab: true});1992 WI.showStorageTab(); 1993 WI.showRepresentedObject(event.data.database, null, {ignoreSearchTab: true}); 1992 1994 }; 1993 1995 1994 1996 WI._domNodeWasInspected = function(event) 1995 1997 { 1996 this.domManager.highlightDOMNodeForTwoSeconds(event.data.node.id);1998 WI.domManager.highlightDOMNodeForTwoSeconds(event.data.node.id); 1997 1999 1998 2000 InspectorFrontendHost.bringToFront(); 1999 2001 2000 this.showElementsTab();2001 this.showMainFrameDOMTree(event.data.node, {ignoreSearchTab: true});2002 WI.showElementsTab(); 2003 WI.showMainFrameDOMTree(event.data.node, {ignoreSearchTab: true}); 2002 2004 }; 2003 2005 2004 2006 WI._inspectModeStateChanged = function(event) 2005 2007 { 2006 this._inspectModeToolbarButton.activated = this.domManager.inspectModeEnabled;2008 WI._inspectModeToolbarButton.activated = WI.domManager.inspectModeEnabled; 2007 2009 }; 2008 2010 2009 2011 WI._toggleInspectMode = function(event) 2010 2012 { 2011 this.domManager.inspectModeEnabled = !this.domManager.inspectModeEnabled;2013 WI.domManager.inspectModeEnabled = !WI.domManager.inspectModeEnabled; 2012 2014 }; 2013 2015 … … 2104 2106 const preferredEdges = [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_X, WI.RectEdge.MAX_X]; 2105 2107 2106 WI._deviceSettingsPopover = new WI.Popover( this);2108 WI._deviceSettingsPopover = new WI.Popover(WI); 2107 2109 WI._deviceSettingsPopover.windowResizeHandler = function(event) { 2108 2110 WI._deviceSettingsPopover.present(calculateTargetFrame(), preferredEdges); … … 2270 2272 WI._downloadWebArchive = function(event) 2271 2273 { 2272 this.archiveMainFrame();2274 WI.archiveMainFrame(); 2273 2275 }; 2274 2276 … … 2317 2319 2318 2320 // 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}); 2320 2322 }; 2321 2323 … … 2323 2325 { 2324 2326 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; 2330 2332 }; 2331 2333 2332 2334 WI._updateDownloadToolbarButton = function() 2333 2335 { 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(); 2345 2347 }; 2346 2348 … … 2348 2350 { 2349 2351 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; 2355 2357 }; 2356 2358 2357 2359 WI._toggleInspectMode = function(event) 2358 2360 { 2359 this.domManager.inspectModeEnabled = !this.domManager.inspectModeEnabled;2361 WI.domManager.inspectModeEnabled = !WI.domManager.inspectModeEnabled; 2360 2362 }; 2361 2363 2362 2364 WI._showConsoleTab = function(event) 2363 2365 { 2364 this.showConsoleTab();2366 WI.showConsoleTab(); 2365 2367 }; 2366 2368 2367 2369 WI._focusConsolePrompt = function(event) 2368 2370 { 2369 this.quickConsole.prompt.focus();2371 WI.quickConsole.prompt.focus(); 2370 2372 }; 2371 2373 2372 2374 WI._focusedContentBrowser = function() 2373 2375 { 2374 if ( this.currentFocusElement) {2375 let contentBrowserElement = this.currentFocusElement.closest(".content-browser");2376 if (WI.currentFocusElement) { 2377 let contentBrowserElement = WI.currentFocusElement.closest(".content-browser"); 2376 2378 if (contentBrowserElement && contentBrowserElement.__view && contentBrowserElement.__view instanceof WI.ContentBrowser) 2377 2379 return contentBrowserElement.__view; 2378 2380 } 2379 2381 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; 2382 2384 if (tabContentView.contentBrowser) 2383 2385 return tabContentView.contentBrowser; … … 2385 2387 } 2386 2388 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; 2390 2392 2391 2393 return null; … … 2394 2396 WI._focusedContentView = function() 2395 2397 { 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; 2398 2400 if (tabContentView.contentBrowser) 2399 2401 return tabContentView.contentBrowser.currentContentView; … … 2401 2403 } 2402 2404 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; 2406 2408 2407 2409 return null; … … 2410 2412 WI._focusedOrVisibleContentBrowser = function() 2411 2413 { 2412 let focusedContentBrowser = this._focusedContentBrowser();2414 let focusedContentBrowser = WI._focusedContentBrowser(); 2413 2415 if (focusedContentBrowser) 2414 2416 return focusedContentBrowser; 2415 2417 2416 var tabContentView = this.tabBrowser.selectedTabContentView;2418 var tabContentView = WI.tabBrowser.selectedTabContentView; 2417 2419 if (tabContentView.contentBrowser) 2418 2420 return tabContentView.contentBrowser; … … 2423 2425 WI.focusedOrVisibleContentView = function() 2424 2426 { 2425 let focusedContentView = this._focusedContentView();2427 let focusedContentView = WI._focusedContentView(); 2426 2428 if (focusedContentView) 2427 2429 return focusedContentView; 2428 2430 2429 var tabContentView = this.tabBrowser.selectedTabContentView;2431 var tabContentView = WI.tabBrowser.selectedTabContentView; 2430 2432 if (tabContentView.contentBrowser) 2431 2433 return tabContentView.contentBrowser.currentContentView; … … 2439 2441 // If there is no selection, see if the focused element or focused ContentView can handle the copy event. 2440 2442 if (selection.isCollapsed && !WI.isEventTargetAnEditableField(event)) { 2441 var focusedCopyHandler = this.currentFocusElement && this.currentFocusElement.copyHandler;2443 var focusedCopyHandler = WI.currentFocusElement && WI.currentFocusElement.copyHandler; 2442 2444 if (focusedCopyHandler && typeof focusedCopyHandler.handleBeforeCopyEvent === "function") { 2443 2445 focusedCopyHandler.handleBeforeCopyEvent(event); … … 2446 2448 } 2447 2449 2448 var focusedContentView = this._focusedContentView();2450 var focusedContentView = WI._focusedContentView(); 2449 2451 if (focusedContentView && typeof focusedContentView.handleCopyEvent === "function") { 2450 2452 event.preventDefault(); … … 2464 2466 WI._find = function(event) 2465 2467 { 2466 let contentBrowser = this._focusedOrVisibleContentBrowser();2468 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 2467 2469 if (!contentBrowser) 2468 2470 return; … … 2473 2475 WI._save = function(event) 2474 2476 { 2475 var contentView = this.focusedOrVisibleContentView();2477 var contentView = WI.focusedOrVisibleContentView(); 2476 2478 if (!contentView || !contentView.supportsSave) 2477 2479 return; … … 2482 2484 WI._saveAs = function(event) 2483 2485 { 2484 var contentView = this.focusedOrVisibleContentView();2486 var contentView = WI.focusedOrVisibleContentView(); 2485 2487 if (!contentView || !contentView.supportsSave) 2486 2488 return; … … 2491 2493 WI._clear = function(event) 2492 2494 { 2493 let contentView = this.focusedOrVisibleContentView();2495 let contentView = WI.focusedOrVisibleContentView(); 2494 2496 if (!contentView || typeof contentView.handleClearShortcut !== "function") { 2495 // If the current content view is unable to handle thisevent, clear the console to reset2497 // If the current content view is unable to handle WI event, clear the console to reset 2496 2498 // the dashboard counters. 2497 this.consoleManager.requestClearMessages();2499 WI.consoleManager.requestClearMessages(); 2498 2500 return; 2499 2501 } … … 2504 2506 WI._populateFind = function(event) 2505 2507 { 2506 let focusedContentView = this._focusedContentView();2508 let focusedContentView = WI._focusedContentView(); 2507 2509 if (!focusedContentView) 2508 2510 return; … … 2513 2515 } 2514 2516 2515 let contentBrowser = this._focusedOrVisibleContentBrowser();2517 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 2516 2518 if (!contentBrowser) 2517 2519 return; … … 2522 2524 WI._findNext = function(event) 2523 2525 { 2524 let focusedContentView = this._focusedContentView();2526 let focusedContentView = WI._focusedContentView(); 2525 2527 if (!focusedContentView) 2526 2528 return; … … 2531 2533 } 2532 2534 2533 let contentBrowser = this._focusedOrVisibleContentBrowser();2535 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 2534 2536 if (!contentBrowser) 2535 2537 return; … … 2540 2542 WI._findPrevious = function(event) 2541 2543 { 2542 let focusedContentView = this._focusedContentView();2544 let focusedContentView = WI._focusedContentView(); 2543 2545 if (!focusedContentView) 2544 2546 return; … … 2549 2551 } 2550 2552 2551 let contentBrowser = this._focusedOrVisibleContentBrowser();2553 let contentBrowser = WI._focusedOrVisibleContentBrowser(); 2552 2554 if (!contentBrowser) 2553 2555 return; … … 2562 2564 // If there is no selection, pass the copy event on to the focused element or focused ContentView. 2563 2565 if (selection.isCollapsed && !WI.isEventTargetAnEditableField(event)) { 2564 var focusedCopyHandler = this.currentFocusElement && this.currentFocusElement.copyHandler;2566 var focusedCopyHandler = WI.currentFocusElement && WI.currentFocusElement.copyHandler; 2565 2567 if (focusedCopyHandler && typeof focusedCopyHandler.handleCopyEvent === "function") { 2566 2568 focusedCopyHandler.handleCopyEvent(event); … … 2569 2571 } 2570 2572 2571 var focusedContentView = this._focusedContentView();2573 var focusedContentView = WI._focusedContentView(); 2572 2574 if (focusedContentView && typeof focusedContentView.handleCopyEvent === "function") { 2573 2575 focusedContentView.handleCopyEvent(event); … … 2575 2577 } 2576 2578 2577 let tabContentView = this.tabBrowser.selectedTabContentView;2579 let tabContentView = WI.tabBrowser.selectedTabContentView; 2578 2580 if (tabContentView && typeof tabContentView.handleCopyEvent === "function") { 2579 2581 tabContentView.handleCopyEvent(event); … … 2597 2599 const epsilon = 0.0001; 2598 2600 const maximumZoom = 2.4; 2599 let currentZoom = this.getZoomFactor();2601 let currentZoom = WI.getZoomFactor(); 2600 2602 if (currentZoom + epsilon >= maximumZoom) { 2601 2603 InspectorFrontendHost.beep(); … … 2603 2605 } 2604 2606 2605 this.setZoomFactor(Math.min(maximumZoom, currentZoom + 0.2));2607 WI.setZoomFactor(Math.min(maximumZoom, currentZoom + 0.2)); 2606 2608 }; 2607 2609 … … 2610 2612 const epsilon = 0.0001; 2611 2613 const minimumZoom = 0.6; 2612 let currentZoom = this.getZoomFactor();2614 let currentZoom = WI.getZoomFactor(); 2613 2615 if (currentZoom - epsilon <= minimumZoom) { 2614 2616 InspectorFrontendHost.beep(); … … 2616 2618 } 2617 2619 2618 this.setZoomFactor(Math.max(minimumZoom, currentZoom - 0.2));2620 WI.setZoomFactor(Math.max(minimumZoom, currentZoom - 0.2)); 2619 2621 }; 2620 2622 2621 2623 WI._resetZoom = function(event) 2622 2624 { 2623 this.setZoomFactor(1);2625 WI.setZoomFactor(1); 2624 2626 }; 2625 2627 … … 2655 2657 WI.settings.layoutDirection.value = value; 2656 2658 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(); 2662 2664 2663 2665 InspectorFrontendHost.reopen(); 2664 2666 }; 2665 2667 2666 WI._showTabAtIndex = function(i , event)2668 WI._showTabAtIndex = function(i) 2667 2669 { 2668 2670 if (i <= WI.tabBar.tabBarItems.length) … … 2848 2850 2849 2851 if (event.metaKey) 2850 this.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation, options);2852 WI.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation, options); 2851 2853 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); 2856 2858 linkElement.addEventListener("contextmenu", (event) => { 2857 2859 let contextMenu = WI.ContextMenu.createFromEvent(event); … … 2952 2954 linkNode.title = resource.url; 2953 2955 linkNode.textContent = (resource.urlComponents.lastPathComponent || resource.url).insertWordBreakCharacters(); 2954 linkNode.addEventListener("click", handleClick .bind(this));2956 linkNode.addEventListener("click", handleClick); 2955 2957 return linkNode; 2956 2958 }; … … 2958 2960 WI._undoKeyboardShortcut = function(event) 2959 2961 { 2960 if (! this.isEditingAnyField() && !this.isEventTargetAnEditableField(event)) {2961 this.undo();2962 if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event)) { 2963 WI.undo(); 2962 2964 event.preventDefault(); 2963 2965 } … … 2966 2968 WI._redoKeyboardShortcut = function(event) 2967 2969 { 2968 if (! this.isEditingAnyField() && !this.isEventTargetAnEditableField(event)) {2969 this.redo();2970 if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event)) { 2971 WI.redo(); 2970 2972 event.preventDefault(); 2971 2973 } … … 3078 3080 WI.archiveMainFrame = function() 3079 3081 { 3080 this._downloadingPage = true;3081 this._updateDownloadToolbarButton();3082 WI._downloadingPage = true; 3083 WI._updateDownloadToolbarButton(); 3082 3084 3083 3085 PageAgent.archive((error, data) => { 3084 this._downloadingPage = false;3085 this._updateDownloadToolbarButton();3086 WI._downloadingPage = false; 3087 WI._updateDownloadToolbarButton(); 3086 3088 3087 3089 if (error) … … 3098 3100 WI.canArchiveMainFrame = function() 3099 3101 { 3100 if ( this.sharedApp.debuggableType !== WI.DebuggableType.Web)3102 if (WI.sharedApp.debuggableType !== WI.DebuggableType.Web) 3101 3103 return false; 3102 3104 … … 3112 3114 return; 3113 3115 3114 this._windowKeydownListeners.push(listener);3115 3116 this._updateWindowKeydownListener();3116 WI._windowKeydownListeners.push(listener); 3117 3118 WI._updateWindowKeydownListener(); 3117 3119 }; 3118 3120 3119 3121 WI.removeWindowKeydownListener = function(listener) 3120 3122 { 3121 this._windowKeydownListeners.remove(listener);3122 3123 this._updateWindowKeydownListener();3123 WI._windowKeydownListeners.remove(listener); 3124 3125 WI._updateWindowKeydownListener(); 3124 3126 }; 3125 3127 3126 3128 WI._updateWindowKeydownListener = function() 3127 3129 { 3128 if ( this._windowKeydownListeners.length === 1)3130 if (WI._windowKeydownListeners.length === 1) 3129 3131 window.addEventListener("keydown", WI._sharedWindowKeydownListener, true); 3130 else if (! this._windowKeydownListeners.length)3132 else if (!WI._windowKeydownListeners.length) 3131 3133 window.removeEventListener("keydown", WI._sharedWindowKeydownListener, true); 3132 3134 }; -
trunk/Source/WebInspectorUI/UserInterface/Test/Test.js
r243272 r244266 68 68 69 69 // Register for events. 70 document.addEventListener("DOMContentLoaded", this.contentLoaded);70 document.addEventListener("DOMContentLoaded", WI.contentLoaded); 71 71 72 72 // Non-default global setting values for tests.
Note: See TracChangeset
for help on using the changeset viewer.