Closed Bug 1115369 Opened 11 years ago Closed 11 years ago

Use notifications instead of getViewItem for DownloadsView

Categories

(Firefox :: Downloads Panel, defect)

defect
Not set
normal
Points:
2

Tracking

()

RESOLVED FIXED
Firefox 38
Iteration:
38.1 - 26 Jan

People

(Reporter: Paolo, Assigned: Paolo)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch The patchSplinter Review
Based on how we use these notifications, this turns out to be less code, and no need to build objects on the fly anymore.
Attachment #8541256 - Flags: review?(jaws)
The new function names better reflect what these notifications have actually become. Note how in the future we may get rid of onDataItemStateChanged entirely, in favor of checks for previous state inside onDataItemChanged in individual views that need them. This means each view would be able to detect only changes in the state it is interested in. This is the model used by the Downloads API.
Attachment #8541256 - Flags: review?(mak77)
Assignee: nobody → paolo.mozmail
Flags: qe-verify-
Flags: firefox-backlog+
Comment on attachment 8541256 [details] [diff] [review] The patch Review of attachment 8541256 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/components/downloads/content/allDownloadsViewOverlay.js @@ +931,5 @@ > // download is retired, onDataItemAdded is called again for the same > // data item. Thus, we also check that we make sure we don't have a view item > // already. > if (!shouldCreateShell && > + aDataItem && !this._viewItemsForDataItems.get(aDataItem)) { should use .has() instead of .get()
Attachment #8541256 - Flags: review?(mak77) → review+
Comment on attachment 8541256 [details] [diff] [review] The patch Review of attachment 8541256 [details] [diff] [review]: ----------------------------------------------------------------- I'll let Marco's r+ here stand, but I'm just curious about the below change. ::: browser/components/downloads/DownloadsCommon.jsm @@ -1366,5 @@ > - * @return Object that can be used to notify item status events. > - */ > - getViewItem(aDataItem) { > - let data = this._isPrivate ? PrivateDownloadsIndicatorData > - : DownloadsIndicatorData; Why don't we need to make a differentiation here for private versus non-private downloads anymore?
Attachment #8541256 - Flags: review?(jaws)
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #3) > ::: browser/components/downloads/DownloadsCommon.jsm > @@ -1366,5 @@ > > - * @return Object that can be used to notify item status events. > > - */ > > - getViewItem(aDataItem) { > > - let data = this._isPrivate ? PrivateDownloadsIndicatorData > > - : DownloadsIndicatorData; > > Why don't we need to make a differentiation here for private versus > non-private downloads anymore? It happens that "this" is already DownloadsIndicatorData or PrivateDownloadsIndicatorData depending on this._isPrivate. So it was just a longer way to say "let data = this;".
Points: --- → 2
Status: NEW → ASSIGNED
Iteration: --- → 38.1 - 26 Jan
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: