[Bug 27605] [NewObject] and Promise

# bugzilla at jessica.w3.org (2 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27605

Boris Zbarsky bzbarsky@mit.edu changed:

       What    |Removed                     |Added

             CC|                            |bzbarsky@mit.edu

--- Comment #1 from Boris Zbarsky bzbarsky@mit.edu ---

I think restricting [NewObject] to only things that return interface types is just wrong. It should be allowed if the return value is any object type. Specifically, any interface type, "object", a promise, an Error, a DOMException, any buffer source type, or a union of types on which [NewObject] is allowed.

If no one gets to this before I get back from vacation in January, I'll fix webidl accordingly.

For now, Fetch uses [NewObject]

Yes, please!

Contact us to advertise here
# bugzilla at jessica.w3.org (2 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27605

Jonas Sicking jonas@sicking.cc changed:

       What    |Removed                     |Added

             CC|                            |jonas@sicking.cc

--- Comment #2 from Jonas Sicking jonas@sicking.cc ---

Does

[NewObject] Promise<Foo> getMeAFoo();

mean that the Promise instance returned is always a new one, or that once the Promise resolves, that it resolves to an object that was newly created?

Do we need new syntax to better describe the two alternatives?

# bugzilla at jessica.w3.org (2 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27605

--- Comment #3 from Boris Zbarsky bzbarsky@mit.edu ---

It means the Promise instance returned is always a new one. Its fulfillment value might be the same as before.

We could add more syntax to talk about the fulfillment value, I suppose... This quickly gets complicated. It's comparable to asking about this case:

[NewObject] Element createElement(DOMString tagname);

whether the various properties of the Element returned are newly created or preexisting (and the answer is that it depends; the .childNodes will be a never-before-seen object but the .ownerDocument will be the document you called createElement on). The only real difference is that in the Promise case there is a preferred internal slot we're talking about: the fulfillment value. But I think describing how it's filled in via prose is pretty reasonable...

# bugzilla at jessica.w3.org (2 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27605

--- Comment #4 from Anne annevk@annevk.nl ---

createElement() returns a class instance and I think with my internal slots proposal we could define how that works.

Promises however have no such way forward so they might indeed need some way to define this if we want to stop doing that in prose.

# bugzilla at jessica.w3.org (7 months ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27605

Domenic Denicola d@domenic.me changed:

       What    |Removed                     |Added

             CC|                            |d@domenic.me
     Resolution|---                         |MOVED
         Status|NEW                         |RESOLVED

--- Comment #5 from Domenic Denicola d@domenic.me ---

Let's roll this into heycam/webidl#71

Want more features?

Request early access to our private beta of readable email premium.