Closed Bug 774816 Opened 12 years ago Closed 12 years ago

Make the Promise module available to Toolkit consumers

Categories

(Toolkit :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 756542

People

(Reporter: Paolo, Unassigned)

References

Details

Attachments

(1 file)

(In reply to Dave Townsend (:Mossop) from comment #107)
> We still need to figure out packaging it into the build and making it
> available to all consumers, it might be better to do that in other bugs now
> that this one is past 100 comments!

I've filed this bug as the last step that allows implementing basic "Task.js"
interfaces in bug 763311.

I think the discussion here will be about the JSM module name, and whether and
how we should namespace the exported functions.
I've implemented a temporary glue stub in order to make the dependent bugs work.

With this, there's a working queue made of bug 763295, bug 774816, bug 763311,
and bug 740468 with which the asynchronous bookmarks export that uses Task.jsm
can be tried out.

I've namespaced the module, and I'm also proposing to rename the exported
"resolve" function to "resolved", and "reject" to "rejected", because they're
substantially different from the "resolve" and "reject" functions that exist
on the object returned by "defer".

In fact, "deferred.resolve" allows the associated promise to be resolved or
rejected (active action, no return value), while "Promise.resolved" returns a
new promise that is already resolved (has a definite return value).
Just noticed that if the module functions are namespaced, you can do this:

XPCOMUtils.defineLazyModuleGetter(this, "Promise",
                                  "resource://gre/modules/Promise.jsm");
Blocks: 775495
It appears bug 756542 will make the promise/core.js module loadable directly,
I'm moving the discussuion there.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
(In reply to Paolo Amadini [:paolo] from comment #1)
> Created attachment 643108 [details] [diff] [review]
> Temporary glue code.
> 
> I've implemented a temporary glue stub in order to make the dependent bugs
> work.
> 
> With this, there's a working queue made of bug 763295, bug 774816, bug
> 763311,
> and bug 740468 with which the asynchronous bookmarks export that uses
> Task.jsm
> can be tried out.
> 
> I've namespaced the module, and I'm also proposing to rename the exported
> "resolve" function to "resolved", and "reject" to "rejected", because they're
> substantially different from the "resolve" and "reject" functions that exist
> on the object returned by "defer".

I second this suggestion.
You need to log in before you can comment on or make changes to this bug.