[Webkit-unassigned] [Bug 166752] Handle IDLPromise<> properly

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 19 13:52:03 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=166752

--- Comment #1 from Sam Weinig <sam at webkit.org> ---
Any thoughts on a design for this, I have been struggling a bit. 

The biggest issue is that unlike all other types, the way our promise code works, you always have to pass a JSDOMGlobalObject and an ExecState to any function that might want to create a promise. Ideally, what we would do would be to have a new type that can be instantiated without a JSDOMGlobalObject and an ExecState, that gets wrapped by the JS promise once it enters the bindings. e.g.

Ref<NonJSPromise> MyClass::load()
{
    ...

    m_promise = NonJSPromise::create();

    ...

    return m_promise.releaseNonNull();
}

And then the bindings layer does something that creates a JSPromiseDeferred from the NonJSPromise, but I am not clear on how the lifetime of the JSPromiseDeferred would be managed. Perhaps the NonJSPromise (now even more poorly named) could act as a lazy WebCore::DeferredPromise, and fill in the JSPromiseDeferred and JSDOMGlobalObject when it gets passed into the bindings layer?

Anyway, maybe you have a better design in mind.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170119/310cb660/attachment.html>


More information about the webkit-unassigned mailing list