Bug 1150855 - Remove uses of the curly syntax. r=jaws

This commit is contained in:
Tom Schuster 2015-05-22 21:23:57 +02:00
parent 97fe3f07ee
commit c6a949ea47
6 changed files with 65 additions and 26 deletions

View File

@ -152,20 +152,28 @@ function URL(url, base) {
Object.defineProperties(this, { Object.defineProperties(this, {
toString: { toString: {
value() new String(uri.spec).toString(), value() {
return new String(uri.spec).toString();
},
enumerable: false enumerable: false
}, },
valueOf: { valueOf: {
value() new String(uri.spec).valueOf(), value() {
return new String(uri.spec).valueOf();
},
enumerable: false enumerable: false
}, },
toSource: { toSource: {
value() new String(uri.spec).toSource(), value() {
return new String(uri.spec).toSource();
},
enumerable: false enumerable: false
}, },
// makes more sense to flatten to string, easier to travel across JSON // makes more sense to flatten to string, easier to travel across JSON
toJSON: { toJSON: {
value() new String(uri.spec).toString(), value() {
return new String(uri.spec).toString();
},
enumerable: false enumerable: false
} }
}); });

View File

@ -374,7 +374,9 @@ let gEditItemOverlay = {
XPCOMUtils.generateQI([Components.interfaces.nsIDOMEventListener, XPCOMUtils.generateQI([Components.interfaces.nsIDOMEventListener,
Components.interfaces.nsINavBookmarkObserver]), Components.interfaces.nsINavBookmarkObserver]),
_element(aID) document.getElementById("editBMPanel_" + aID), _element(aID) {
return document.getElementById("editBMPanel_" + aID);
},
uninitPanel(aHideCollapsibleElements) { uninitPanel(aHideCollapsibleElements) {
if (aHideCollapsibleElements) { if (aHideCollapsibleElements) {

View File

@ -444,7 +444,10 @@ var gMainPane = {
* downloads are automatically saved, updating preferences and UI in * downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made. * 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* () chooseFolderTask: Task.async(function* ()
{ {
let bundlePreferences = document.getElementById("bundlePreferences"); let bundlePreferences = document.getElementById("bundlePreferences");

View File

@ -308,7 +308,10 @@ var gMainPane = {
* downloads are automatically saved, updating preferences and UI in * downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made. * 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* () chooseFolderTask: Task.async(function* ()
{ {
let bundlePreferences = document.getElementById("bundlePreferences"); let bundlePreferences = document.getElementById("bundlePreferences");

View File

@ -199,10 +199,12 @@ TransactionsHistory.__proto__ = {
get undoPosition() this._undoPosition, get undoPosition() this._undoPosition,
// Handy shortcuts // Handy shortcuts
get topUndoEntry() this.undoPosition < this.length ? get topUndoEntry() {
this[this.undoPosition] : null, return this.undoPosition < this.length ? this[this.undoPosition] : null;
get topRedoEntry() this.undoPosition > 0 ? },
this[this.undoPosition - 1] : null, get topRedoEntry() {
return this.undoPosition > 0 ? this[this.undoPosition - 1] : null;
},
// Outside of this module, the API of transactions is inaccessible, and so // Outside of this module, the API of transactions is inaccessible, and so
// are any internal properties. To achieve that, transactions are proxified // are any internal properties. To achieve that, transactions are proxified
@ -219,7 +221,9 @@ TransactionsHistory.__proto__ = {
*/ */
proxifyTransaction: function (aRawTransaction) { proxifyTransaction: function (aRawTransaction) {
let proxy = Object.freeze({ let proxy = Object.freeze({
transact() TransactionsManager.transact(this) transact() {
return TransactionsManager.transact(this);
}
}); });
this.proxifiedToRaw.set(proxy, aRawTransaction); this.proxifiedToRaw.set(proxy, aRawTransaction);
return proxy; return proxy;
@ -232,8 +236,9 @@ TransactionsHistory.__proto__ = {
* @return true if aValue is the proxy object for some transaction, false * @return true if aValue is the proxy object for some transaction, false
* otherwise. * otherwise.
*/ */
isProxifiedTransactionObject: isProxifiedTransactionObject(aValue) {
function (aValue) this.proxifiedToRaw.has(aValue), return this.proxifiedToRaw.has(aValue);
},
/** /**
* Get the raw transaction for the given proxy. * Get the raw transaction for the given proxy.
@ -242,7 +247,9 @@ TransactionsHistory.__proto__ = {
* @return the transaction proxified by aProxy; |undefined| is returned if * @return the transaction proxified by aProxy; |undefined| is returned if
* aProxy is not a proxified transaction. * 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 * Add a transaction either as a new entry, if forced or if there are no undo
@ -340,7 +347,9 @@ let PlacesTransactions = {
* @note All undo manager operations are queued. This means that transactions * @note All undo manager operations are queued. This means that transactions
* history may change by the time your request is fulfilled. * 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 * Asynchronously redo the transaction immediately before the current undo
@ -351,7 +360,9 @@ let PlacesTransactions = {
* @note All undo manager operations are queued. This means that transactions * @note All undo manager operations are queued. This means that transactions
* history may change by the time your request is fulfilled. * 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 * Asynchronously clear the undo, redo, or all entries from the transactions
@ -367,13 +378,16 @@ let PlacesTransactions = {
* @note All undo manager operations are queued. This means that transactions * @note All undo manager operations are queued. This means that transactions
* history may change by the time your request is fulfilled. * history may change by the time your request is fulfilled.
*/ */
clearTransactionsHistory(aUndoEntries = true, aRedoEntries = true) clearTransactionsHistory(aUndoEntries = true, aRedoEntries = true) {
TransactionsManager.clearTransactionsHistory(aUndoEntries, aRedoEntries), return TransactionsManager.clearTransactionsHistory(aUndoEntries, aRedoEntries);
},
/** /**
* The numbers of entries in the transactions history. * 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 * Get the transaction history entry at a given index. Each entry consists
@ -400,17 +414,23 @@ let PlacesTransactions = {
* Entries past this point * Entries past this point
* Entries at and past this point are redo entries. * 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. * 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. * Shortcut for accessing the top redo entry in the transaction history.
*/ */
get topRedoEntry() TransactionsHistory.topRedoEntry get topRedoEntry() {
return TransactionsHistory.topRedoEntry;
}
}; };
/** /**
@ -461,7 +481,9 @@ Enqueuer.prototype = {
/** /**
* The promise for this queue. * The promise for this queue.
*/ */
get promise() this._promise get promise() {
return this._promise;
}
}; };
let TransactionsManager = { let TransactionsManager = {

View File

@ -463,8 +463,9 @@ this.PlacesUtils = {
* the URL to generate a rev host for. * the URL to generate a rev host for.
* @return the reversed host string. * @return the reversed host string.
*/ */
getReversedHost(url) getReversedHost(url) {
url.host.split("").reverse().join("") + ".", return url.host.split("").reverse().join("") + ".";
},
/** /**
* String-wraps a result node according to the rules of the specified * String-wraps a result node according to the rules of the specified