This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23477 - Since ArrayBuffer is now part of ES directly, you can't do ArrayBuffer implements Transferable
Summary: Since ArrayBuffer is now part of ES directly, you can't do ArrayBuffer implem...
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-10 01:42 UTC by contributor
Modified: 2014-02-06 20:19 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2013-10-10 01:42:28 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html
Multipage: http://www.whatwg.org/C#transferable-objects
Complete: http://www.whatwg.org/c#transferable-objects
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html

Comment:
Since ArrayBuffer is now part of ES directly, you can't do ArrayBuffer
implements Transferable

Posted from: 98.110.194.76 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:27.0) Gecko/20100101 Firefox/27.0
Comment 1 Boris Zbarsky 2013-10-10 01:43:07 UTC
In fact, it may be better to just define Transferable to be a union or something...  The problem is if other specs want to add new transferables.  :(
Comment 2 Ian 'Hixie' Hickson 2013-10-10 02:06:09 UTC
Uh, wait, what? Why is ES not compatible with the way the Web platform works...?
Comment 3 Boris Zbarsky 2013-10-10 02:30:21 UTC
Well, more precisely ES doesn't know anything about WebIDL interfaces and WebIDL doesn't know anything about using ES built-in types as interface types.  Saying "ArrayBuffer implements Transferable" means about the same as "Array implements Transferable" in spec terms: since the LHS is not a WebIDL interface in either case, WebIDL doesn't allow you to say that....

We should probably fix that; it's not quite clear how.  Both in specs and in implementations.

In practice, for now Gecko will be typedeffing Transferable to a union type or something.
Comment 4 Ian 'Hixie' Hickson 2013-10-11 23:21:21 UTC
I guess we can just have a union and require that if a new type is added, HTML gets updated. :-(

heycam: unless you have a way to fix this on the IDL side (note in particular that the right hand side of 'implements' here is an empty interface).
Comment 5 Anne 2013-10-13 09:36:13 UTC
Well, strictly speaking IDL does not know about ES types at all (e.g. you cannot say something accepts an ArrayBuffer). That seems like what should be fixed here.
Comment 6 Ian 'Hixie' Hickson 2013-10-13 20:58:19 UTC
That needs to be fixed too, but I was using Transferable as a way to annotate interfaces, that also broke.
Comment 7 Anne 2013-10-13 21:09:56 UTC
The long term solution to this is https://github.com/dslomov-chromium/ecmascript-structured-clone integrated into ES by the way. Making ES aware of structured cloning and multiple globals, and then retrofit the platform language in terms of that.
Comment 8 Cameron McCormack 2013-10-13 22:49:06 UTC
Aside from needing to move the typed array intefaces types into built-in type names in Web IDL, perhaps we should have a way of tagging types as being transferable that does not use "implements" (and therefore does not require them to be interfaces).
Comment 9 Anne 2013-10-14 09:26:55 UTC
Yeah, the long term solution would basically demand an IDL annotation for an object being transferable. It would then have an ES [[Transfer]] and such operator defined.
Comment 10 Ian 'Hixie' Hickson 2013-10-14 18:44:47 UTC
That would work too, but it would be less pretty since then I'd need both a union and a way to annotate types.
Comment 11 Anne 2013-10-15 17:16:55 UTC
I think IDL could also offer a type that represents objects that have [[Transfer]] to take care of that. But yes, that would also be needed.
Comment 12 Ian 'Hixie' Hickson 2013-11-18 22:33:25 UTC
heycam, I think Anne's suggestion is the best so far: a way to annotate types, and then a type that means "all the types that were so annotated". Kind of like an automatic union.

This would presumably look like this on the annotaton side:

   [PleaseAlsoConsiderThisTypeToBeA=Transferable] interface Foo { ... }

...and like this on the use side:

   void myMethod(Transferable quux);

Is that feasible?

(Presumably we'd then say that ArrayBuffer was one of these on the prose side, since ES doesn't use IDL?)
Comment 13 Ian 'Hixie' Hickson 2014-02-06 20:19:00 UTC
I ended up just hard-coding it all in HTML. If new specs want to add new Transferables, they can just ask and I'll add it.