Closed Bug 1261683 Opened 4 years ago Closed 4 years ago

convert some internal objects in the Activity manager to Maps

Categories

(Thunderbird :: General, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 48.0

People

(Reporter: aceman, Assigned: aceman)

Details

Attachments

(1 file, 1 obsolete file)

21.70 KB, patch
aceman
: review+
Details | Diff | Splinter Review
I propose to convert some internal objects in activity manager to Maps, because storing things in properties of a object seems fragile (there exist properties of an object we need to skip over) and Map is the object created to store [key,value] pairs. Also in some places we dereference object[id], when the .id property actually does not exist. It can produce a JS srict warning. The result is "undefined" which we then check for (see e.g. pop3Download.js::onDownloadCompleted()). Converting to map.get(id) also returns "undefined" but at least does not produce a warning. Also we have the possibility to call map.has(id) to get a clean existence check.
Comment on attachment 8737613 [details] [diff] [review]
patch

Review of attachment 8737613 [details] [diff] [review]:
-----------------------------------------------------------------

::: mail/components/activity/modules/pop3Download.js
@@ +89,5 @@
>  
>    onDownloadCompleted : function(aFolder, aNumMsgsDownloaded) {
>      this.log.info("in onDownloadCompleted");
>  
> +    this.activityMgr.removeActivity(this._mostRecentActivityForFolder.get(aFolder.URI).eventID);

odd indention (or bugzilla just displaying it wrong?)

::: mail/components/activity/nsActivity.js
@@ +56,5 @@
>      this._subjects.push(aSubject);
>    },
>  
>    getSubjects: function(aCount) {
> +    let list = [...this._subjects];

maybe just 
let list = this._subjects.slice();
Attachment #8737613 - Flags: review?(mkmelin+mozilla) → review+
Attached patch patch v1.1Splinter Review
Thanks.
The indentation was correct, but the line was too long so the display may have been affected.
Attachment #8737613 - Attachment is obsolete: true
Attachment #8737631 - Flags: review+
I've split the line.
Keywords: checkin-needed
http://hg.mozilla.org/comm-central/rev/e0699438de93
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 48.0
You need to log in before you can comment on or make changes to this bug.