Bug 1207490 - Part 6: Remove use of expression closure from browser/devtools/. r=vporof
authorTooru Fujisawa <arai_a@mac.com>
Mon, 21 Sep 2015 02:25:07 +0900
changeset 265248 98d3300738e3c9eec467dabdfc7883cfa4c3de9e
parent 265247 b8815627054a7229b45ea5733231eb57906c28f6
child 265249 e9dda4b6e6e07604905f471aaf5598fa2804b017
push id65891
push userarai_a@mac.com
push dateWed, 30 Sep 2015 16:36:04 +0000
treeherdermozilla-inbound@10194aec7255 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs1207490
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1207490 - Part 6: Remove use of expression closure from browser/devtools/. r=vporof
devtools/client/app-manager/app-projects.js
devtools/client/responsivedesign/responsivedesign.jsm
devtools/client/shared/AppCacheUtils.jsm
devtools/client/shared/SplitView.jsm
devtools/client/shared/widgets/SideMenuWidget.jsm
devtools/client/shared/widgets/VariablesView.jsm
devtools/client/shared/widgets/ViewHelpers.jsm
--- a/devtools/client/app-manager/app-projects.js
+++ b/devtools/client/app-manager/app-projects.js
@@ -203,17 +203,17 @@ const AppProjects = {
       return store.object.projects[store.object.projects.length - 1];
     });
   },
 
   update: function (project) {
     return IDB.update(project);
   },
 
-  updateLocation: function(project, newLocation) {
+  updateLocation: function(project, newLocation) {
     return IDB.remove(project.location)
               .then(() => {
                 project.location = newLocation;
                 return IDB.add(project);
               });
   },
 
   remove: function(location) {
--- a/devtools/client/responsivedesign/responsivedesign.jsm
+++ b/devtools/client/responsivedesign/responsivedesign.jsm
@@ -228,17 +228,19 @@ function ResponsiveUI(aWindow, aTab)
     window: this.mainWindow,
     type: "deveditionpromo",
     anchor: this.chromeDoc.querySelector("#content")
   });
 }
 
 ResponsiveUI.prototype = {
   _transitionsEnabled: true,
-  get transitionsEnabled() this._transitionsEnabled,
+  get transitionsEnabled() {
+    return this._transitionsEnabled;
+  },
   set transitionsEnabled(aValue) {
     this._transitionsEnabled = aValue;
     if (aValue && !this._resizing && this.stack.hasAttribute("responsivemode")) {
       this.stack.removeAttribute("notransition");
     } else if (!aValue) {
       this.stack.setAttribute("notransition", "true");
     }
   },
--- a/devtools/client/shared/AppCacheUtils.jsm
+++ b/devtools/client/shared/AppCacheUtils.jsm
@@ -611,17 +611,17 @@ ManifestParser.prototype = {
           this._addError(this.currentLine,
                          "invalidSectionName", text, this.currentLine);
           return false;
       }
     }
   },
 };
 
-XPCOMUtils.defineLazyGetter(this, "l10n", function() Services.strings
+XPCOMUtils.defineLazyGetter(this, "l10n", () => Services.strings
   .createBundle("chrome://browser/locale/devtools/appcacheutils.properties"));
 
 XPCOMUtils.defineLazyGetter(this, "appcacheservice", function() {
   return Cc["@mozilla.org/network/application-cache-service;1"]
            .getService(Ci.nsIApplicationCacheService);
 
 });
 
--- a/devtools/client/shared/SplitView.jsm
+++ b/devtools/client/shared/SplitView.jsm
@@ -81,31 +81,40 @@ this.SplitView = function SplitView(aRoo
 }
 
 SplitView.prototype = {
   /**
     * Retrieve whether the UI currently has a landscape orientation.
     *
     * @return boolean
     */
-  get isLandscape() this._mql.matches,
+  get isLandscape()
+  {
+    return this._mql.matches;
+  },
 
   /**
     * Retrieve the root element.
     *
     * @return DOMElement
     */
-  get rootElement() this._root,
+  get rootElement()
+  {
+    return this._root;
+  },
 
   /**
     * Retrieve the active item's summary element or null if there is none.
     *
     * @return DOMElement
     */
-  get activeSummary() this._activeSummary,
+  get activeSummary()
+  {
+    return this._activeSummary;
+  },
 
   /**
     * Set the active item's summary element.
     *
     * @param DOMElement aSummary
     */
   set activeSummary(aSummary)
   {
--- a/devtools/client/shared/widgets/SideMenuWidget.jsm
+++ b/devtools/client/shared/widgets/SideMenuWidget.jsm
@@ -71,17 +71,17 @@ SideMenuWidget.prototype = {
   /**
    * Specifies if groups in this container should be sorted.
    */
   sortedGroups: true,
 
   /**
    * The comparator used to sort groups.
    */
-  groupSortPredicate: function(a, b) a.localeCompare(b),
+  groupSortPredicate: (a, b) => a.localeCompare(b),
 
   /**
    * Inserts an item in this container at the specified index, optionally
    * grouping by name.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
    * @param nsIDOMNode aContents
@@ -483,18 +483,22 @@ function SideMenuGroup(aWidget, aName, a
   else {
     let target = this._target = this._list = this.document.createElement("vbox");
     target.className = "side-menu-widget-group side-menu-widget-group-list";
     target.setAttribute("merged-group-contents", "");
   }
 }
 
 SideMenuGroup.prototype = {
-  get _orderedGroupElementsArray() this.ownerView._orderedGroupElementsArray,
-  get _orderedMenuElementsArray() this.ownerView._orderedMenuElementsArray,
+  get _orderedGroupElementsArray() {
+    return this.ownerView._orderedGroupElementsArray;
+  },
+  get _orderedMenuElementsArray() {
+    return this.ownerView._orderedMenuElementsArray;
+  },
   get _itemsByElement() { return this.ownerView._itemsByElement; },
 
   /**
    * Inserts this group in the parent container at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this group.
    */
@@ -590,18 +594,22 @@ function SideMenuItem(aGroup, aContents,
     target.setAttribute("merged-item-contents", "");
   }
 
   this._target.setAttribute("flex", "1");
   this.contents = aContents;
 }
 
 SideMenuItem.prototype = {
-  get _orderedGroupElementsArray() this.ownerView._orderedGroupElementsArray,
-  get _orderedMenuElementsArray() this.ownerView._orderedMenuElementsArray,
+  get _orderedGroupElementsArray() {
+    return this.ownerView._orderedGroupElementsArray;
+  },
+  get _orderedMenuElementsArray() {
+    return this.ownerView._orderedMenuElementsArray;
+  },
   get _itemsByElement() { return this.ownerView._itemsByElement; },
 
   /**
    * Inserts this item in the parent group at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
    * @return nsIDOMNode
--- a/devtools/client/shared/widgets/VariablesView.jsm
+++ b/devtools/client/shared/widgets/VariablesView.jsm
@@ -397,40 +397,46 @@ VariablesView.prototype = {
       this.nonEnumVisible = true;
     }
   },
 
   /**
    * Sets if the variable and property searching is enabled.
    * @param boolean aFlag
    */
-  set searchEnabled(aFlag) aFlag ? this._enableSearch() : this._disableSearch(),
+  set searchEnabled(aFlag) {
+    aFlag ? this._enableSearch() : this._disableSearch();
+  },
 
   /**
    * Gets if the variable and property searching is enabled.
    * @return boolean
    */
-  get searchEnabled() !!this._searchboxContainer,
+  get searchEnabled() {
+    return !!this._searchboxContainer;
+  },
 
   /**
    * Sets the text displayed for the searchbox in this container.
    * @param string aValue
    */
   set searchPlaceholder(aValue) {
     if (this._searchboxNode) {
       this._searchboxNode.setAttribute("placeholder", aValue);
     }
     this._searchboxPlaceholder = aValue;
   },
 
   /**
    * Gets the text displayed for the searchbox in this container.
    * @return string
    */
-  get searchPlaceholder() this._searchboxPlaceholder,
+  get searchPlaceholder() {
+    return this._searchboxPlaceholder;
+  },
 
   /**
    * Enables variable and property searching in this view.
    * Use the "searchEnabled" setter to enable searching.
    */
   _enableSearch: function() {
     // If searching was already enabled, no need to re-enable it again.
     if (this._searchboxContainer) {
@@ -992,35 +998,43 @@ VariablesView.prototype = {
       this._parent.removeAttribute("actions-first");
     }
   },
 
   /**
    * Gets the parent node holding this view.
    * @return nsIDOMNode
    */
-  get boxObject() this._list.boxObject,
+  get boxObject() {
+    return this._list.boxObject;
+  },
 
   /**
    * Gets the parent node holding this view.
    * @return nsIDOMNode
    */
-  get parentNode() this._parent,
+  get parentNode() {
+    return this._parent;
+  },
 
   /**
    * Gets the owner document holding this view.
    * @return nsIHTMLDocument
    */
-  get document() this._document || (this._document = this._parent.ownerDocument),
+  get document() {
+    return this._document || (this._document = this._parent.ownerDocument);
+  },
 
   /**
    * Gets the default window holding this view.
    * @return nsIDOMWindow
    */
-  get window() this._window || (this._window = this.document.defaultView),
+  get window() {
+    return this._window || (this._window = this.document.defaultView);
+  },
 
   _document: null,
   _window: null,
 
   _store: null,
   _itemsByElement: null,
   _prevHierarchy: null,
   _currHierarchy: null,
@@ -1582,71 +1596,91 @@ Scope.prototype = {
     this._arrow.setAttribute("invisible", "");
     this._isArrowVisible = false;
   },
 
   /**
    * Gets the visibility state.
    * @return boolean
    */
-  get visible() this._isContentVisible,
+  get visible() {
+    return this._isContentVisible;
+  },
 
   /**
    * Gets the expanded state.
    * @return boolean
    */
-  get expanded() this._isExpanded,
+  get expanded() {
+    return this._isExpanded;
+  },
 
   /**
    * Gets the header visibility state.
    * @return boolean
    */
-  get header() this._isHeaderVisible,
+  get header() {
+    return this._isHeaderVisible;
+  },
 
   /**
    * Gets the twisty visibility state.
    * @return boolean
    */
-  get twisty() this._isArrowVisible,
+  get twisty() {
+    return this._isArrowVisible;
+  },
 
   /**
    * Gets the expand lock state.
    * @return boolean
    */
-  get locked() this._isLocked,
+  get locked() {
+    return this._isLocked;
+  },
 
   /**
    * Sets the visibility state.
    * @param boolean aFlag
    */
-  set visible(aFlag) aFlag ? this.show() : this.hide(),
+  set visible(aFlag) {
+    aFlag ? this.show() : this.hide();
+  },
 
   /**
    * Sets the expanded state.
    * @param boolean aFlag
    */
-  set expanded(aFlag) aFlag ? this.expand() : this.collapse(),
+  set expanded(aFlag) {
+    aFlag ? this.expand() : this.collapse();
+  },
 
   /**
    * Sets the header visibility state.
    * @param boolean aFlag
    */
-  set header(aFlag) aFlag ? this.showHeader() : this.hideHeader(),
+  set header(aFlag) {
+    aFlag ? this.showHeader() : this.hideHeader();
+  },
 
   /**
    * Sets the twisty visibility state.
    * @param boolean aFlag
    */
-  set twisty(aFlag) aFlag ? this.showArrow() : this.hideArrow(),
+  set twisty(aFlag) {
+    aFlag ? this.showArrow() : this.hideArrow();
+  },
 
   /**
    * Sets the expand lock state.
    * @param boolean aFlag
    */
-  set locked(aFlag) this._isLocked = aFlag,
+  set locked(aFlag) {
+    this._isLocked = aFlag;
+  },
 
   /**
    * Specifies if this target node may be focused.
    * @return boolean
    */
   get focusable() {
     // Check if this target node is actually visibile.
     if (!this._nameString ||
@@ -1693,41 +1727,51 @@ Scope.prototype = {
   removeEventListener: function(aName, aCallback, aCapture) {
     this._title.removeEventListener(aName, aCallback, aCapture);
   },
 
   /**
    * Gets the id associated with this item.
    * @return string
    */
-  get id() this._idString,
+  get id() {
+    return this._idString;
+  },
 
   /**
    * Gets the name associated with this item.
    * @return string
    */
-  get name() this._nameString,
+  get name() {
+    return this._nameString;
+  },
 
   /**
    * Gets the displayed value for this item.
    * @return string
    */
-  get displayValue() this._valueString,
+  get displayValue() {
+    return this._valueString;
+  },
 
   /**
    * Gets the class names used for the displayed value.
    * @return string
    */
-  get displayValueClassName() this._valueClassName,
+  get displayValueClassName() {
+    return this._valueClassName;
+  },
 
   /**
    * Gets the element associated with this item.
    * @return nsIDOMNode
    */
-  get target() this._target,
+  get target() {
+    return this._target;
+  },
 
   /**
    * Initializes this scope's id, view and binds event listeners.
    *
    * @param string aName
    *        The scope's name.
    * @param object aFlags [optional]
    *        Additional options or flags for this scope.
@@ -1999,43 +2043,51 @@ Scope.prototype = {
 
     return null;
   },
 
   /**
    * Gets top level variables view instance.
    * @return VariablesView
    */
-  get _variablesView() this._topView || (this._topView = (function(self) {
-    let parentView = self.ownerView;
-    let topView;
-
-    while ((topView = parentView.ownerView)) {
-      parentView = topView;
-    }
-    return parentView;
-  })(this)),
+  get _variablesView() {
+    return this._topView || (this._topView = (() => {
+      let parentView = this.ownerView;
+      let topView;
+
+      while ((topView = parentView.ownerView)) {
+        parentView = topView;
+      }
+      return parentView;
+    })());
+  },
 
   /**
    * Gets the parent node holding this scope.
    * @return nsIDOMNode
    */
-  get parentNode() this.ownerView._list,
+  get parentNode() {
+    return this.ownerView._list;
+  },
 
   /**
    * Gets the owner document holding this scope.
    * @return nsIHTMLDocument
    */
-  get document() this._document || (this._document = this.ownerView.document),
+  get document() {
+    return this._document || (this._document = this.ownerView.document);
+  },
 
   /**
    * Gets the default window holding this scope.
    * @return nsIDOMWindow
    */
-  get window() this._window || (this._window = this.ownerView.window),
+  get window() {
+    return this._window || (this._window = this.ownerView.window);
+  },
 
   _topView: null,
   _document: null,
   _window: null,
 
   ownerView: null,
   eval: null,
   switch: null,
@@ -2328,29 +2380,35 @@ Variable.prototype = Heritage.extend(Sco
     }
     return path;
   },
 
   /**
    * Returns this variable's value from the descriptor if available.
    * @return any
    */
-  get value() this._initialDescriptor.value,
+  get value() {
+    return this._initialDescriptor.value;
+  },
 
   /**
    * Returns this variable's getter from the descriptor if available.
    * @return object
    */
-  get getter() this._initialDescriptor.get,
+  get getter() {
+    return this._initialDescriptor.get;
+  },
 
   /**
    * Returns this variable's getter from the descriptor if available.
    * @return object
    */
-  get setter() this._initialDescriptor.set,
+  get setter() {
+    return this._initialDescriptor.set;
+  },
 
   /**
    * Sets the specific grip for this variable (applies the text content and
    * class name to the value label).
    *
    * The grip should contain the value or the type & class, as defined in the
    * remote debugger protocol. For convenience, undefined and null are
    * both considered types.
--- a/devtools/client/shared/widgets/ViewHelpers.jsm
+++ b/devtools/client/shared/widgets/ViewHelpers.jsm
@@ -766,17 +766,19 @@ this.WidgetMethods = {
       aWidget.on("mousePress", this._onWidgetMousePress.bind(this));
     }
   },
 
   /**
    * Gets the element node or widget associated with this container.
    * @return nsIDOMNode | object
    */
-  get widget() this._widget,
+  get widget() {
+    return this._widget;
+  },
 
   /**
    * Prepares an item to be added to this container. This allows, for example,
    * for a large number of items to be batched up before being sorted & added.
    *
    * If the "staged" flag is *not* set to true, the item will be immediately
    * inserted at the correct position in this container, so that all the items
    * still remain sorted. This can (possibly) be much slower than batching up