Closed Bug 1095119 Opened 10 years ago Closed 9 years ago

Remove Promise.defer usage

Categories

(Calendar :: Internal Components, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
4.0.0.1

People

(Reporter: Fallen, Assigned: discoman)

Details

(Whiteboard: [good first bug][lang=js])

Attachments

(2 files, 2 obsolete files)

I totally liked Promise.defer, but this is not a feature of DOM promises, which will supersede Promise.jsm at some point and will be removed in bug 1034599. We need to replace them with DOM promises in calendar code or use PromiseUtils from bug 1093021.
Attached patch bug-1095119.diff (obsolete) β€” β€” Splinter Review
https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred

Here, I realized that implementation of new Promise() as deferred object would require a helper function first and so it's better to look out for places where new Promise can be implemented easily and I found it was in only test_deleted_items.js, every where else our beloved deferred object is used to resolve promise in different parts of code,so I implemented new Promise() here. Would request a review and help in case I have done something wrong.
Attachment #8556857 - Flags: review?(philipp)
Comment on attachment 8556857 [details] [diff] [review]
bug-1095119.diff

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

You are right, we surprisingly don't use promises that much. Code looks great, thanks for the patch! Let me know if you need more issues to work on. r=philipp.

For checkin, could you change the patch message from "Remove Promise.defer" to something like "Bug 1095119 - Remove Promise.defer usage. r=philipp", upload that as a new attachment and set the checkin-needed keyword? You can directly set review+ on the new patch since I've already +'d this one.
Attachment #8556857 - Flags: review?(philipp) → review+
Assignee: nobody → sparshpaliwal123
Status: NEW → ASSIGNED
Attached patch bug-1095119.diff β€” β€” Splinter Review
Thank you very much for the help,I never submitted a patch so quickly. If something is wrong with this one we will get back to it. Meanwhile which of these you think i should do next-
Bug-366680
Bug-396515
Bug-842383
Bug-472630
Attachment #8557016 - Flags: review+
Attachment #8557016 - Flags: checkin?
Attachment #8556857 - Attachment is obsolete: true
I think bug 472630 would be nice, if you want another simple one then bug 842383 is also a good candidate.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 4.0
Attached patch fix test failure (obsolete) β€” β€” Splinter Review
The patch caused a failure in the test it is touching:
TEST-UNEXPECTED-FAIL | xpcshell-icaljs.ini:calendar/test/unit/test_deleted_items.js | xpcshell return code: 0
SyntaxError: expected expression, got ')' at /builds/slave/test/build/tests/xpcshell/tests/calendar/test/unit/test_deleted_items.js:31
ReferenceError: run_test is not defined at /builds/slave/test/build/tests/xpcshell/head.js:504

I try to fix the syntax error in this patch.

Aryx, please push to try server.
Flags: needinfo?(archaeopteryx)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch fix test failure v2 β€” β€” Splinter Review
Didn't work :)
Attachment #8557388 - Attachment is obsolete: true
Attachment #8557426 - Flags: review?(philipp)
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
Sorry about the missing push comment, my python script had an error. I'll update the other bugs in case they haven't already been.
Comment on attachment 8557426 [details] [diff] [review]
fix test failure v2

Oops I totally missed you already uploaded a patch, sorry about that. The patch I pushed does about the same thing and also fixes the order of setting the handleCompletion function and calling aFunc().
Attachment #8557426 - Flags: review?(philipp)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: