On 19/11/2013 1.38, Nikhil Marathe wrote:
> DOM Promise has been in the tree for a while
> We currently have two JS promise implementations in our codebase:
> toolkit/modules/Promise.jsm

Though it may seem counter-intuitive, the non-native Promise.jsm has
grown better error reporting and debuggability, and maybe even better
performance (depending on whether DOM Promises are optimized for not
returning to the outer OS event loop when resolving promise chains).

I just used the debuggability features to find a pending promise handler
that was causing a memory leak today, and I've taken screenshots:

https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise#Debugging

I hope to see a comparable or even better level of debuggability in the
native Promise implementation soon!

In the meantime, I think we should switch Promise.jsm consumers to use
the new style of constructor (bug 941757), so that we'll not need to
do any change to the code when DOM Promises are ready to replace
Promise.jsm.

> addon-sdk/source/lib/sdk/core/promise.js

I think we should continue the ongoing work to convert users of this
non-conforming implementation to Promise.jsm. This is the most
difficult part because the code following "then" is often executed after
the registered callbacks, on a fulfilled or rejected promise.

To recap, I think these can proceed in parallel:
* Implement new Promise.jsm constructor and covert consumers
* Improve DOM Promise debuggability, then replace Promise.jsm
* Make promise.js users compatible with Promise.jsm / DOM promises

Cheers,
Paolo
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to