On Thu, Apr 26, 2018 at 04:12:09PM -0400, Ben Kelly wrote:
I pushed a new helper class to inbound today to make it easier to work with
MozPromise in DOM code.  Specifically, it allows you to auto-disconnect a
Thenable request when the global dies.

Thank you! I've been worried about these kinds of footguns for a while. We could probably use something similar for JS...

   RefPtr<DOMMozPromiseRequestHolder<GenericPromise>> holder =
     new DOMMozPromiseRequestHolder<GenericPromise>(global);

Note, this can be written a bit more concisely as:

   auto holder = MakeRefPtr<DOMMozPromiseRequestHolder<GenericPromise>>(global);

--
Kris Maglione
Senior Firefox Add-ons Engineer
Mozilla Corporation

All the hundreds of millions of people who, in their time, believed
the Earth was flat never succeeded in unrounding it by an inch.
        --Isaac Asimov

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

Reply via email to