Bug 1207491 - Part 6: Remove use of expression closure from browser/components/downloads/. r=Gijs

--HG--
extra : commitid : 8BIIBSCXIf9
extra : rebase_source : cca677e0c83e99cca719f5b6f794060fa0144205
This commit is contained in:
Tooru Fujisawa 2015-09-23 18:36:20 +09:00
parent a9634adc70
commit e3e8c7540e
5 changed files with 63 additions and 23 deletions

View File

@ -660,7 +660,9 @@ DownloadsDataCtor.prototype = {
* 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.

View File

@ -151,7 +151,9 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
* 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.

View File

@ -220,16 +220,22 @@ HistoryDownloadElementShell.prototype = {
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) {
@ -245,7 +251,9 @@ HistoryDownloadElementShell.prototype = {
},
_historyDownload: null,
get historyDownload() this._historyDownload,
get historyDownload() {
return this._historyDownload;
},
set historyDownload(aValue) {
if (this._historyDownload != aValue) {
if (!aValue && !this._sessionDownload) {
@ -550,9 +558,13 @@ function DownloadsPlacesView(aRichListBox, aActive = 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)
@ -930,7 +942,9 @@ DownloadsPlacesView.prototype = {
},
_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) {
@ -955,7 +969,9 @@ DownloadsPlacesView.prototype = {
},
_result: null,
get result() this._result,
get result() {
return this._result;
},
set result(val) {
if (this._result == val) {
return val;
@ -990,7 +1006,9 @@ DownloadsPlacesView.prototype = {
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)
@ -1085,9 +1103,13 @@ DownloadsPlacesView.prototype = {
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) {

View File

@ -98,22 +98,33 @@ const DownloadsPanel = {
_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.
@ -1329,7 +1340,9 @@ const DownloadsSummary = {
/**
* Returns the active state of the downloads summary.
*/
get active() this._active,
get active() {
return this._active;
},
_active: false,

View File

@ -40,8 +40,9 @@ 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