On 4/21/14, 7:31 PM, Joshua Cranmer 🐧 wrote:
Now, creating a Promise (via mozilla::dom::Promise) from C++ and passing
it to JS is possible but kind of difficult, since I need to materialize
an nsIGlobalObject which requires too much code.

You basically need the window the promise will be associated with. Is the problem that finding the right window in your case is too complicated?

It's not really
possible to cast to this method from a JS implemented Promise (since the
notion of "promise" in JS is "I have a callable property named then").

No, the notion of "promise" in JS is/will-be http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects

Not like that makes it simpler to work with in C++...

It's also the only way you can react to a promise from C++ without
stabbing yourself.

I'm not following this.

Since I need C++ to be able to react to
JS-implemented stuff, this kind of means I have to use XPIDL instead of
WebIDL.

I'm not following the reasoning, but chances are it's wrong. Unless you need your thing to be gettable from C++ via createInstace/getService, you shouldn't need XPIDL.

If there is a real problem here apart from that one, please explain what it is: getting rid of such problems is high on my priority list.

Can promises be specified in XPIDL in such a way that they are usable
from C++?

No, for lots of reasons.  Please don't try to use XPIDL here.

I've thought about ways to fix this, but they all require modifying
xpconnect to some degree, so I wondered if anyone had better solutions
to this problem space.

I'd like to better understand what your issues are with the current Promise implementation...

-Boris

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

Reply via email to