Bug 1392352 - Part 4.2 - To fold: remove build instructions and reorganize things a bit;r=dao
MozReview-Commit-ID: AMZbgh9Ri2f
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -1,24 +1,15 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/browser-window */
-// STEPS TO BUILD:
-// Replace `class FirefoxTabbrowser extends XULElement` with `class TabBrowser`
-// Generate the class with `npm run elements` from https://github.com/bgrins/xbl-analysis
-// Replace document.getAnonymousElementByAttribute(this, ..) with document.getAnonymousElementByAttribute(this.container)
-// Add: `// eslint-disable-next-line complexity` before ` addTab(`
-// Replace `window.getComputedStyle(this` with `window.getComputedStyle(this.container`
-// Get rid of all calls to getService except for nsIEventListenerService.
-// Run `./mach eslint browser/base/content/tabbrowser.js --fix`
-
class TabBrowser {
constructor(container) {
this.container = container;
// Pass along any used DOM methods to the container node. When this object turns
// into a custom element this won't be needed anymore.
this.addEventListener = this.container.addEventListener.bind(this.container);
this.removeEventListener = this.container.removeEventListener.bind(this.container);
@@ -28,39 +19,37 @@ class TabBrowser {
this.setAttribute = this.container.setAttribute.bind(this.container);
this.removeAttribute = this.container.removeAttribute.bind(this.container);
this.appendChild = this.container.appendChild.bind(this.container);
this.ownerGlobal = this.container.ownerGlobal;
this.ownerDocument = this.container.ownerDocument;
this.namespaceURI = this.container.namespaceURI;
this.style = this.container.style;
- this.initialBrowser = document.getAnonymousElementByAttribute(this.container, "anonid", "initialBrowser");
-
XPCOMUtils.defineLazyServiceGetters(this, {
_unifiedComplete: ["@mozilla.org/autocomplete/search;1?name=unifiedcomplete", "mozIPlacesAutoComplete"],
serializationHelper: ["@mozilla.org/network/serialization-helper;1", "nsISerializationHelper"],
});
this.mURIFixup = Services.uriFixup;
- // For upgrading replace below here:
-
this.tabContainer = document.getElementById(this.getAttribute("tabcontainer"));
this.tabs = this.tabContainer.childNodes;
this.closingTabsEnum = ({
ALL: 0,
OTHER: 1,
TO_END: 2
});
this._visibleTabs = null;
+ this.initialBrowser = document.getAnonymousElementByAttribute(this.container, "anonid", "initialBrowser");
+
this.tabbox = document.getAnonymousElementByAttribute(this.container, "anonid", "tabbox");
this.mPanelContainer = document.getAnonymousElementByAttribute(this.container, "anonid", "panelcontainer");
this.mCurrentTab = null;
this._lastRelatedTabMap = new WeakMap();