Bug 1150855 - Remove uses of the curly syntax. r=jaws
authorTom Schuster <evilpies@gmail.com>
Fri, 22 May 2015 21:23:57 +0200
changeset 277583 0135ea20609a4ab62db17a537b1885ad2170cb7a
parent 277582 6cf58656d6fb28c8ea79ae0b139a905aa8900bdf
child 277584 35797ae0b66fddb761565b4ab42ac5fbb794f6f4
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1150855
milestone41.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 1150855 - Remove uses of the curly syntax. r=jaws
addon-sdk/source/lib/sdk/url.js
browser/components/places/content/editBookmarkOverlay.js
browser/components/preferences/in-content/main.js
browser/components/preferences/main.js
toolkit/components/places/PlacesTransactions.jsm
toolkit/components/places/PlacesUtils.jsm
--- a/addon-sdk/source/lib/sdk/url.js
+++ b/addon-sdk/source/lib/sdk/url.js
@@ -147,30 +147,38 @@ function URL(url, base) {
   this.__defineGetter__("hash", function() hash);
   this.__defineGetter__("href", function() uri.spec);
   this.__defineGetter__("origin", function() uri.prePath);
   this.__defineGetter__("protocol", function() uri.scheme + ":");
   this.__defineGetter__("search", function() search);
 
   Object.defineProperties(this, {
     toString: {
-      value() new String(uri.spec).toString(),
+      value() {
+        return new String(uri.spec).toString();
+      },
       enumerable: false
     },
     valueOf: {
-      value() new String(uri.spec).valueOf(),
+      value() {
+        return new String(uri.spec).valueOf();
+      },
       enumerable: false
     },
     toSource: {
-      value() new String(uri.spec).toSource(),
+      value() {
+        return new String(uri.spec).toSource();
+      },
       enumerable: false
     },
     // makes more sense to flatten to string, easier to travel across JSON
     toJSON: {
-      value() new String(uri.spec).toString(),
+      value() {
+        return new String(uri.spec).toString();
+      },
       enumerable: false
     }
   });
 
   return this;
 };
 
 URL.prototype = Object.create(String.prototype);
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -369,17 +369,19 @@ let gEditItemOverlay = {
     this._element("foldersSeparator").hidden = (menupopup.childNodes.length <= 6);
     this._folderMenuList.disabled = this.readOnly;
   },
 
   QueryInterface:
   XPCOMUtils.generateQI([Components.interfaces.nsIDOMEventListener,
                          Components.interfaces.nsINavBookmarkObserver]),
 
-  _element(aID) document.getElementById("editBMPanel_" + aID),
+  _element(aID) {
+    return document.getElementById("editBMPanel_" + aID);
+  },
 
   uninitPanel(aHideCollapsibleElements) {
     if (aHideCollapsibleElements) {
       // Hide the folder tree if it was previously visible.
       var folderTreeRow = this._element("folderTreeRow");
       if (!folderTreeRow.collapsed)
         this.toggleFolderTreeVisibility();
 
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -439,17 +439,20 @@ var gMainPane = {
     return undefined;
   },
 
   /**
    * Displays a file picker in which the user can choose the location where
    * downloads are automatically saved, updating preferences and UI in
    * response to the choice, if one is made.
    */
-  chooseFolder() this.chooseFolderTask().catch(Components.utils.reportError),
+  chooseFolder()
+  {
+    return this.chooseFolderTask().catch(Components.utils.reportError);
+  },
   chooseFolderTask: Task.async(function* ()
   {
     let bundlePreferences = document.getElementById("bundlePreferences");
     let title = bundlePreferences.getString("chooseDownloadFolderTitle");
     let folderListPref = document.getElementById("browser.download.folderList");
     let currentDirPref = yield this._indexToFolder(folderListPref.value);
     let defDownloads = yield this._indexToFolder(1);
     let fp = Components.classes["@mozilla.org/filepicker;1"].
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -303,17 +303,20 @@ var gMainPane = {
     return undefined;
   },
   
   /**
    * Displays a file picker in which the user can choose the location where
    * downloads are automatically saved, updating preferences and UI in
    * response to the choice, if one is made.
    */
-  chooseFolder() this.chooseFolderTask().catch(Components.utils.reportError),
+  chooseFolder()
+  {
+    return this.chooseFolderTask().catch(Components.utils.reportError);
+  },
   chooseFolderTask: Task.async(function* ()
   {
     let bundlePreferences = document.getElementById("bundlePreferences");
     let title = bundlePreferences.getString("chooseDownloadFolderTitle");
     let folderListPref = document.getElementById("browser.download.folderList");
     let currentDirPref = yield this._indexToFolder(folderListPref.value);
     let defDownloads = yield this._indexToFolder(1);
     let fp = Components.classes["@mozilla.org/filepicker;1"].
--- a/toolkit/components/places/PlacesTransactions.jsm
+++ b/toolkit/components/places/PlacesTransactions.jsm
@@ -194,60 +194,67 @@ TransactionsHistory.__proto__ = {
   __proto__: Array.prototype,
 
   // The index of the first undo entry (if any) - See the documentation
   // at the top of this file.
   _undoPosition: 0,
   get undoPosition() this._undoPosition,
 
   // Handy shortcuts
-  get topUndoEntry() this.undoPosition < this.length ?
-                     this[this.undoPosition] : null,
-  get topRedoEntry() this.undoPosition > 0 ?
-                     this[this.undoPosition - 1] : null,
+  get topUndoEntry() {
+    return this.undoPosition < this.length ? this[this.undoPosition] : null;
+  },
+  get topRedoEntry() {
+    return this.undoPosition > 0 ? this[this.undoPosition - 1] : null;
+  },
 
   // Outside of this module, the API of transactions is inaccessible, and so
   // are any internal properties.  To achieve that, transactions are proxified
   // in their constructors.  This maps the proxies to their respective raw
   // objects.
   proxifiedToRaw: new WeakMap(),
 
   /**
    * Proxify a transaction object for consumers.
    * @param aRawTransaction
    *        the raw transaction object.
    * @return the proxified transaction object.
    * @see getRawTransaction for retrieving the raw transaction.
    */
   proxifyTransaction: function (aRawTransaction) {
     let proxy = Object.freeze({
-      transact() TransactionsManager.transact(this)
+      transact() {
+        return TransactionsManager.transact(this);
+      }
     });
     this.proxifiedToRaw.set(proxy, aRawTransaction);
     return proxy;
   },
 
   /**
    * Check if the given object is a the proxy object for some transaction.
    * @param aValue
    *        any JS value.
    * @return true if aValue is the proxy object for some transaction, false
    * otherwise.
    */
-  isProxifiedTransactionObject:
-  function (aValue) this.proxifiedToRaw.has(aValue),
+  isProxifiedTransactionObject(aValue) {
+    return this.proxifiedToRaw.has(aValue);
+  },
 
   /**
    * Get the raw transaction for the given proxy.
    * @param aProxy
    *        the proxy object
    * @return the transaction proxified by aProxy; |undefined| is returned if
    * aProxy is not a proxified transaction.
    */
-  getRawTransaction(aProxy) this.proxifiedToRaw.get(aProxy),
+  getRawTransaction(aProxy) {
+    return this.proxifiedToRaw.get(aProxy);
+  },
 
   /**
    * Add a transaction either as a new entry, if forced or if there are no undo
    * entries, or to the top undo entry.
    *
    * @param aProxifiedTransaction
    *        the proxified transaction object to be added to the transaction
    *        history.
@@ -335,50 +342,57 @@ let PlacesTransactions = {
    * Asynchronously undo the transaction immediately after the current undo
    * position in the transactions history in the reverse order, if any, and
    * adjusts the undo position.
    *
    * @return {Promises).  The promise always resolves.
    * @note All undo manager operations are queued. This means that transactions
    * history may change by the time your request is fulfilled.
    */
-  undo() TransactionsManager.undo(),
+  undo() {
+    return TransactionsManager.undo();
+  },
 
   /**
    * Asynchronously redo the transaction immediately before the current undo
    * position in the transactions history, if any, and adjusts the undo
    * position.
    *
    * @return {Promises).  The promise always resolves.
    * @note All undo manager operations are queued. This means that transactions
    * history may change by the time your request is fulfilled.
    */
-  redo() TransactionsManager.redo(),
+  redo() {
+    return TransactionsManager.redo();
+  },
 
   /**
    * Asynchronously clear the undo, redo, or all entries from the transactions
    * history.
    *
    * @param [optional] aUndoEntries
    *        Whether or not to clear undo entries.  Default: true.
    * @param [optional] aRedoEntries
    *        Whether or not to clear undo entries.  Default: true.
    *
    * @return {Promises).  The promise always resolves.
    * @throws if both aUndoEntries and aRedoEntries are false.
    * @note All undo manager operations are queued. This means that transactions
    * history may change by the time your request is fulfilled.
    */
-  clearTransactionsHistory(aUndoEntries = true, aRedoEntries = true)
-    TransactionsManager.clearTransactionsHistory(aUndoEntries, aRedoEntries),
+  clearTransactionsHistory(aUndoEntries = true, aRedoEntries = true) {
+    return TransactionsManager.clearTransactionsHistory(aUndoEntries, aRedoEntries);
+  },
 
   /**
    * The numbers of entries in the transactions history.
    */
-  get length() TransactionsHistory.length,
+  get length() {
+    return TransactionsHistory.length;
+  },
 
   /**
    * Get the transaction history entry at a given index.  Each entry consists
    * of one or more transaction objects.
    *
    * @param aIndex
    *        the index of the entry to retrieve.
    * @return an array of transaction objects in their undo order (that is,
@@ -395,27 +409,33 @@ let PlacesTransactions = {
   },
 
   /**
    * The index of the top undo entry in the transactions history.
    * If there are no undo entries, it equals to |length|.
    * Entries past this point
    * Entries at and past this point are redo entries.
    */
-  get undoPosition() TransactionsHistory.undoPosition,
+  get undoPosition() {
+    return TransactionsHistory.undoPosition;
+  },
 
   /**
    * Shortcut for accessing the top undo entry in the transaction history.
    */
-  get topUndoEntry() TransactionsHistory.topUndoEntry,
+  get topUndoEntry() {
+    return TransactionsHistory.topUndoEntry;
+  },
 
   /**
    * Shortcut for accessing the top redo entry in the transaction history.
    */
-  get topRedoEntry() TransactionsHistory.topRedoEntry
+  get topRedoEntry() {
+    return TransactionsHistory.topRedoEntry;
+  }
 };
 
 /**
  * Helper for serializing the calls to TransactionsManager methods. It allows
  * us to guarantee that the order in which TransactionsManager asynchronous
  * methods are called also enforces the order in which they're executed, and
  * that they are never executed in parallel.
  *
@@ -456,17 +476,19 @@ Enqueuer.prototype = {
     // pending anymore.
     let promise = aPromise.catch(console.error);
     this._promise = Promise.all([this._promise, promise]);
   },
 
   /**
    * The promise for this queue.
    */
-  get promise() this._promise
+  get promise() {
+    return this._promise;
+  }
 };
 
 let TransactionsManager = {
   // See the documentation at the top of this file. |transact| calls are not
   // serialized with |batch| calls.
   _mainEnqueuer: new Enqueuer(),
   _transactEnqueuer: new Enqueuer(),
 
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -458,18 +458,19 @@ this.PlacesUtils = {
    * Reverse a host based on the moz_places algorithm, that is reverse the host
    * string and add a trailing period.  For example "google.com" becomes
    * "moc.elgoog.".
    *
    * @param url
    *        the URL to generate a rev host for.
    * @return the reversed host string.
    */
-  getReversedHost(url)
-    url.host.split("").reverse().join("") + ".",
+  getReversedHost(url) {
+    return url.host.split("").reverse().join("") + ".";
+  },
 
   /**
    * String-wraps a result node according to the rules of the specified
    * content type.
    * @param   aNode
    *          The Result node to wrap (serialize)
    * @param   aType
    *          The content type to serialize as