Bug 1207491 - Part 6: Remove use of expression closure from browser/components/downloads/. r=Gijs
authorTooru Fujisawa <arai_a@mac.com>
Wed, 23 Sep 2015 18:36:20 +0900
changeset 264491 0d3daa1248da22bb391ee65debbde663ca0809dc
parent 264490 42a3d0a47ad042d0c451b6f51d152a3e87709907
child 264492 4ccaf6f18952fca135b42a6e494f21b38b60b24f
push id29444
push usercbook@mozilla.com
push dateMon, 28 Sep 2015 12:17:21 +0000
treeherdermozilla-central@031db40e2b55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1207491
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 1207491 - Part 6: Remove use of expression closure from browser/components/downloads/. r=Gijs
browser/components/downloads/DownloadsCommon.jsm
browser/components/downloads/DownloadsViewUI.jsm
browser/components/downloads/content/allDownloadsViewOverlay.js
browser/components/downloads/content/downloads.js
browser/components/downloads/content/indicator.js
--- a/browser/components/downloads/DownloadsCommon.jsm
+++ b/browser/components/downloads/DownloadsCommon.jsm
@@ -655,17 +655,19 @@ DownloadsDataCtor.prototype = {
     }
   },
   _dataLinkInitialized: false,
 
   /**
    * Iterator for all the available Download objects. This is empty until the
    * data has been loaded using the JavaScript API for downloads.
    */
-  get downloads() this.oldDownloadStates.keys(),
+  get downloads() {
+    return this.oldDownloadStates.keys();
+  },
 
   /**
    * True if there are finished downloads that can be removed from the list.
    */
   get canRemoveFinished() {
     for (let download of this.downloads) {
       // Stopped, paused, and failed downloads with partial data are removed.
       if (download.stopped && !(download.canceled && download.hasPartialData)) {
--- a/browser/components/downloads/DownloadsViewUI.jsm
+++ b/browser/components/downloads/DownloadsViewUI.jsm
@@ -146,17 +146,19 @@ this.DownloadsViewUI.DownloadElementShel
 
   lastEstimatedSecondsLeft: Infinity,
 
   /**
    * Returns the text for the status line and the associated tooltip. These are
    * returned by a single property because they are computed together. The
    * result may be overridden by derived objects.
    */
-  get statusTextAndTip() this.rawStatusTextAndTip,
+  get statusTextAndTip() {
+    return this.rawStatusTextAndTip;
+  },
 
   /**
    * Derived objects may call this to get the status text.
    */
   get rawStatusTextAndTip() {
     const nsIDM = Ci.nsIDownloadManager;
     let s = DownloadsCommon.strings;
 
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -215,42 +215,50 @@ HistoryDownloadElementShell.prototype = 
    */
   ensureActive() {
     if (!this._active) {
       this._active = true;
       this.element.setAttribute("active", true);
       this._updateUI();
     }
   },
-  get active() !!this._active,
+  get active() {
+    return !!this._active;
+  },
 
   /**
    * Overrides the base getter to return the Download or HistoryDownload object
    * for displaying information and executing commands in the user interface.
    */
-  get download() this._sessionDownload || this._historyDownload,
+  get download() {
+    return this._sessionDownload || this._historyDownload;
+  },
 
   _sessionDownload: null,
-  get sessionDownload() this._sessionDownload,
+  get sessionDownload() {
+    return this._sessionDownload;
+  },
   set sessionDownload(aValue) {
     if (this._sessionDownload != aValue) {
       if (!aValue && !this._historyDownload) {
         throw new Error("Should always have either a Download or a HistoryDownload");
       }
 
       this._sessionDownload = aValue;
 
       this.ensureActive();
       this._updateUI();
     }
     return aValue;
   },
 
   _historyDownload: null,
-  get historyDownload() this._historyDownload,
+  get historyDownload() {
+    return this._historyDownload;
+  },
   set historyDownload(aValue) {
     if (this._historyDownload != aValue) {
       if (!aValue && !this._sessionDownload) {
         throw new Error("Should always have either a Download or a HistoryDownload");
       }
 
       this._historyDownload = aValue;
 
@@ -545,19 +553,23 @@ function DownloadsPlacesView(aRichListBo
   }, true);
   // Resizing the window may change items visibility.
   window.addEventListener("resize", () => {
     this._ensureVisibleElementsAreActive();
   }, true);
 }
 
 DownloadsPlacesView.prototype = {
-  get associatedElement() this._richlistbox,
+  get associatedElement() {
+    return this._richlistbox;
+  },
 
-  get active() this._active,
+  get active() {
+    return this._active;
+  },
   set active(val) {
     this._active = val;
     if (this._active)
       this._ensureVisibleElementsAreActive();
     return this._active;
   },
 
   /**
@@ -925,17 +937,19 @@ DownloadsPlacesView.prototype = {
                                  firstVisibleNode.previousSibling;
       if (nodeAboveVisibleArea && nodeAboveVisibleArea._shell) {
         nodeAboveVisibleArea._shell.ensureActive();
       }
     }, 10);
   },
 
   _place: "",
-  get place() this._place,
+  get place() {
+    return this._place;
+  },
   set place(val) {
     // Don't reload everything if we don't have to.
     if (this._place == val) {
       // XXXmano: places.js relies on this behavior (see Bug 822203).
       this.searchTerm = "";
       return val;
     }
 
@@ -950,17 +964,19 @@ DownloadsPlacesView.prototype = {
 
     let result = history.executeQueries(queries.value, queries.value.length,
                                         options.value);
     result.addObserver(this, false);
     return val;
   },
 
   _result: null,
-  get result() this._result,
+  get result() {
+    return this._result;
+  },
   set result(val) {
     if (this._result == val) {
       return val;
     }
 
     if (this._result) {
       this._result.removeObserver(this);
       this._resultNode.containerOpen = false;
@@ -985,17 +1001,19 @@ DownloadsPlacesView.prototype = {
             element._placesNode];
   },
 
   get selectedNode() {
     let selectedNodes = this.selectedNodes;
     return selectedNodes.length == 1 ? selectedNodes[0] : null;
   },
 
-  get hasSelection() this.selectedNodes.length > 0,
+  get hasSelection() {
+    return this.selectedNodes.length > 0;
+  },
 
   containerStateChanged(aNode, aOldState, aNewState) {
     this.invalidateContainer(aNode)
   },
 
   invalidateContainer(aContainer) {
     if (aContainer != this._resultNode) {
       throw new Error("Unexpected container node");
@@ -1080,19 +1098,23 @@ DownloadsPlacesView.prototype = {
   nodeLastModifiedChanged() {},
   nodeHistoryDetailsChanged() {},
   nodeTagsChanged() {},
   sortingChanged() {},
   nodeMoved() {},
   nodeURIChanged() {},
   batching() {},
 
-  get controller() this._richlistbox.controller,
+  get controller() {
+    return this._richlistbox.controller;
+  },
 
-  get searchTerm() this._searchTerm,
+  get searchTerm() {
+    return this._searchTerm;
+  },
   set searchTerm(aValue) {
     if (this._searchTerm != aValue) {
       for (let element of this._richlistbox.childNodes) {
         element.hidden = !element._shell.matchesSearchTerm(aValue);
       }
       this._ensureVisibleElementsAreActive();
     }
     return this._searchTerm = aValue;
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -93,32 +93,43 @@ const DownloadsPanel = {
 
   /**
    * Internal state of the downloads panel, based on one of the kState
    * constants.  This is not the same state as the XUL panel element.
    */
   _state: 0,
 
   /** The panel is not linked to downloads data yet. */
-  get kStateUninitialized() 0,
+  get kStateUninitialized() {
+    return 0;
+  },
   /** This object is linked to data, but the panel is invisible. */
-  get kStateHidden() 1,
+  get kStateHidden() {
+    return 1;
+  },
   /** The panel will be shown as soon as possible. */
-  get kStateWaitingData() 2,
+  get kStateWaitingData() {
+    return 2;
+  },
   /** The panel is almost shown - we're just waiting to get a handle on the
       anchor. */
-  get kStateWaitingAnchor() 3,
+  get kStateWaitingAnchor() {
+    return 3;
+  },
   /** The panel is open. */
-  get kStateShown() 4,
+  get kStateShown() {
+    return 4;
+  },
 
   /**
    * Location of the panel overlay.
    */
-  get kDownloadsOverlay()
-      "chrome://browser/content/downloads/downloadsOverlay.xul",
+  get kDownloadsOverlay() {
+    return "chrome://browser/content/downloads/downloadsOverlay.xul";
+  },
 
   /**
    * Starts loading the download data in background, without opening the panel.
    * Use showPanel instead to load the data and open the panel at the same time.
    *
    * @param aCallback
    *        Called when initialization is complete.
    */
@@ -1324,17 +1335,19 @@ const DownloadsSummary = {
     }
 
     return this._active = aActive;
   },
 
   /**
    * Returns the active state of the downloads summary.
    */
-  get active() this._active,
+  get active() {
+    return this._active;
+  },
 
   _active: false,
 
   /**
    * Sets whether or not we show the progress bar.
    *
    * @param aShowingProgress
    *        True if we should show the progress bar.
--- a/browser/components/downloads/content/indicator.js
+++ b/browser/components/downloads/content/indicator.js
@@ -35,18 +35,19 @@
  * functional indicator, a placeholder used during customization and in the
  * customization palette, or a neutral view as a temporary anchor for the
  * downloads panel.
  */
 const DownloadsButton = {
   /**
    * Location of the indicator overlay.
    */
-  get kIndicatorOverlay()
-      "chrome://browser/content/downloads/indicatorOverlay.xul",
+  get kIndicatorOverlay() {
+    return "chrome://browser/content/downloads/indicatorOverlay.xul";
+  },
 
   /**
    * Returns a reference to the downloads button position placeholder, or null
    * if not available because it has been removed from the toolbars.
    */
   get _placeholder() {
     return document.getElementById("downloads-button");
   },