Closed Bug 989417 Opened 11 years ago Closed 11 years ago

Use Task.spawn in Netmonitor code to improve code readability

Categories

(DevTools :: Netmonitor, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 31

People

(Reporter: vporof, Assigned: vporof)

Details

Attachments

(1 file, 1 obsolete file)

There are a few places in the netmonitor code that would benefit from using Task instead of awkwardly and sequentially then-ing.
Attached patch v1 (obsolete) — Splinter Review
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Attachment #8398639 - Flags: review?(rcampbell)
I'd suggest giving async a try. Its pretty neat imho. It removes the need for extra indentation.
I actually like that.
Attached patch v2Splinter Review
Attachment #8398639 - Attachment is obsolete: true
Attachment #8398639 - Flags: review?(rcampbell)
Attachment #8398968 - Flags: review?(rcampbell)
Comment on attachment 8398968 [details] [diff] [review] v2 Review of attachment 8398968 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/devtools/netmonitor/netmonitor-view.js @@ +1217,5 @@ > * The type of information that is to be updated. > * @param any aValue > * The new value to be shown. > + * @return object > + * A promise that is resolved once the information is displayed. is this true? I don't see a return anywhere in here. @@ +1779,5 @@ > * The data source (this should be the attachment of a request item). > * @return object > * Returns a promise that resolves upon population of the subview. > */ > + populate: Task.async(function*(aData) { aren't you just on the cutting edge? @@ +2260,5 @@ > * The "requestPostData" message received from the server. > * @return object > * A promise that is resolved when the request post params are set. > */ > + _setRequestPostParams: Task.async(function*(aHeadersResponse, aHeadersFromUploadStream, aPostDataResponse) { long line is long. @@ +2269,3 @@ > let { headers: requestHeaders } = aHeadersResponse; > let { headers: payloadHeaders } = aHeadersFromUploadStream; > let allHeaders = [...payloadHeaders, ...requestHeaders]; if you use every language feature in one function do you win a prize? @@ +2269,5 @@ > let { headers: requestHeaders } = aHeadersResponse; > let { headers: payloadHeaders } = aHeadersFromUploadStream; > let allHeaders = [...payloadHeaders, ...requestHeaders]; > > + let contentTypeHeader = allHeaders.find(e => e.name.toLowerCase() == "content-type"); <b>This is an experimental technology, part of the Harmony (ECMAScript 6) proposal.</b> THANKS FOR MAKING ME LEARN STUFF, jerkface.
Attachment #8398968 - Flags: review?(rcampbell) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 31
QA Whiteboard: [qa-]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: