Closed
Bug 1034599
Opened 11 years ago
Closed 8 years ago
Convert remaining Promise.defer() uses to PromiseUtils.defer() or to an inline helper
Categories
(Toolkit :: Async Tooling, defect, P1)
Toolkit
Async Tooling
Tracking
()
People
(Reporter: Irving, Assigned: florian)
References
Details
(Whiteboard: [photon-performance])
Attachments
(3 files)
11.77 KB,
text/plain
|
Details | |
58.73 KB,
patch
|
mconley
:
review+
|
Details | Diff | Splinter Review |
49.46 KB,
patch
|
Details | Diff | Splinter Review |
Promise.jsm provides a non-standard way of constructing new Promises, using the Promise.defer() static method.
Because ES6 standardized "new Promise(function(resolve, reject){..})" as the way of constructing Promises, we should officially deprecate Promise.defer().
Comment 1•11 years ago
|
||
The first step is addressing the dev-doc-needed from bug 941757 on MDN:
https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm
We may at the same time add deprecation notes to the existing documentation.
After this is done, we should find all the "defer" calls in mozilla-central and either:
- Convert to them "new Promise" directly, or
- Replace "Promise.defer" calls with a local helper (that only calls "new Promise"),
and file a bug against the component for the final conversion to "new Promise".
When there are no more mozilla-central calls, we can add a deprecation warning to the API itself to get add-ons converted as well.
All this work is required for migration to DOM Promises when ready.
Comment 2•10 years ago
|
||
David, can we use the defer defined in Promise-backend.js or is there any problem in that approach?
Comment 4•10 years ago
|
||
Well, we can't call it, because it is going to disappear, but the same implementation should work.
Updated•8 years ago
|
Summary: Deprecate Promise.jsm Promise.defer() constructor → Convert remaining Promise.defer() uses to PromiseUtils.defer() or to an inline helper
Updated•8 years ago
|
Whiteboard: [qf][photon]
Updated•8 years ago
|
Whiteboard: [qf][photon] → [qf] [photon-performance] [triage]
Updated•8 years ago
|
Flags: qe-verify-
Priority: -- → P2
Whiteboard: [qf] [photon-performance] [triage] → [qf] [photon-performance]
Updated•8 years ago
|
Whiteboard: [qf] [photon-performance] → [qf:p1] [photon-performance]
Updated•8 years ago
|
Blocks: qf-bugs-upforgrabs
Assignee | ||
Comment 5•8 years ago
|
||
Here is the output of my script from bug 1362882, listing the Promise.defer calls it didn't dare replacing, and explaining why.
Updated•8 years ago
|
Assignee: nobody → florian
Status: NEW → ASSIGNED
Iteration: --- → 56.1 - Jun 26
Priority: P2 → P1
Assignee | ||
Comment 6•8 years ago
|
||
This handles only the Firefox code. Test, mobile and devtools code will be for follow-up (and I'm not volunteering to fix them).
This is mostly done by hand, although I sometimes used some help from the bug 1362882 script (when converting to new Promise() after tweaking a bit the original file to let the script pass).
Attachment #8880184 -
Flags: review?(paolo.mozmail)
Assignee | ||
Comment 7•8 years ago
|
||
Diff -w version of attachment 8880184 [details] [diff] [review] for easier review.
Comment 8•8 years ago
|
||
Comment on attachment 8880184 [details] [diff] [review]
Patch
Review of attachment 8880184 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/jsdownloads/src/DownloadCore.jsm
@@ +840,5 @@
> return Promise.resolve();
> }
>
> + if (!this._promiseRemovePartialData) {
> + this._promiseRemovePartialData = (async () => {
Whoa, today I learned about async () => {}
Attachment #8880184 -
Flags: review?(paolo.mozmail) → review+
Pushed by florian@queze.net:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ea3fb9e7622e
Convert remaining Promise.defer() uses to PromiseUtils.defer() or new Promise(), r=mconley.
Comment 10•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Updated•3 years ago
|
Performance Impact: --- → P1
Whiteboard: [qf:p1] [photon-performance] → [photon-performance]
You need to log in
before you can comment on or make changes to this bug.
Description
•