Closed Bug 603301 Opened 9 years ago Closed 9 years ago
Add async resource API
Let's make resource.js export an async API as well so that we can make new features (such as the J-PAKE client) use that. If/once bug 581560 lands on m-c, we can consider basing our code on top of that then.
Helper for chaining async functions. Very useful for writing tests for an async API, or in general ensuring that a set of async functions are executed in series.
Assignee: nobody → philipp
Attachment #482227 - Flags: review?(mconnor)
The async API is exposed as Resource2 which is functionally equivalent to Resource. The latter is now a synchronous wrapper around Resource2.
Attachment #482228 - Flags: review?(mconnor)
Why don't you do this work in bug 581560 instead? We should have one Resource.jsm, in the core, and Sync should use it. What's preventing that from happening?
(In reply to comment #4) > Why don't you do this work in bug 581560 instead? We should have one > Resource.jsm, in the core, and Sync should use it. I agree. The main obstacle right now is that Sync has to work on Firefox 3.5/3.6 as well so shipping this stuff in services/sync works better for us. Although it looks like the new stuff that's going to be using the async resource API won't target Firefox 3.x anyway, so we might be able to do this just in toolkit after all. FWIW I don't think one has to block the other. I'd love to switch over to a Resource.jsm in toolkit as soon as we're sure we're not going to need it in Firefox 3.x.
Comment on attachment 482227 [details] [diff] [review] Pre-req (v1): Helper for chaining async functions As discussed on IRC, this probably could use an example somewhere of how this decomposes. It's pretty slick, once you warp your brain around it enough.
Attachment #482227 - Flags: review?(mconnor) → review+
Comment on attachment 482228 [details] [diff] [review] Async resource API * s/Resource2/asyncResource/ please, Foo2 is not descriptive. * At some point the Resource constructor should log a warning to the dev console in the constructor. Too early for that, but yeah.
Attachment #482228 - Flags: review?(mconnor) → review+
Comment on attachment 482227 [details] [diff] [review] Pre-req (v1): Helper for chaining async functions Landed the async chain helper with review comments addressed (added note on how a chain decomposes) because bug 606695 needed it too: http://hg.mozilla.org/services/fx-sync/rev/1f0d9cd72f29
Attachment #482227 - Attachment is obsolete: true
Addressed review comment (s/Resource2/AsyncResource/) and landed: http://hg.mozilla.org/services/fx-sync/rev/68accdbb86db http://hg.mozilla.org/services/fx-sync/rev/f3c2a161e2d3
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.