You need to
before you can comment on or make changes to this bug.
I was attempting to object detect support for binary type support in the WebSocket object and discovered that the binaryType attribute is not visible in the prototype (https://bugs.webkit.org/show_bug.cgi?id=67335#add_comment). For WebSocket object detection this is a blocking issue because instantiating the object triggers a network connection (even if you immediately call close() and null the websocket object in the same execution context).
However, it seems like a more general issue of efficiency (object detection without needing instantiantion) and also of compliance with the WebIDL definition of attributes: http://dev.w3.org/2006/webapi/WebIDL/#es-attributes:
"For each attribute defined on the interface, there must exist a corresponding property. If the attribute was declared with the [Unforgeable] extended attribute, then the property exists on every object that implements the interface. Otherwise, it exists on the interface’s interface prototype object."
I'm not sure how widely this problem exists Chrome, but at least for WebSocket attributes, firefox and opera are correct and have the attributes names visible on the prototype.
I don't have "canconfirm" permission but I can nonetheless confirm that WebKit violates the spec here.
For example, what should happen if you call "WebSocket.prototype.readyState" without creating a WebSocket instance?
Firefox Aurora raises a cryptic exception, which actually made me get surprised.
[Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: Web Console :: <TOP_LEVEL> :: line 1" data: no]
Does this match what the spec expects?
Pasting Sam's comment at https://bugs.webkit.org/show_bug.cgi?id=67335#c10 for the record
> For the record, it is currently our intention to eventually put attributes on the prototype, we just need to figure out a way to do it with regressing performance (which is a bit difficult). In the mean time, one can always construct a dummy object and test for the attributes presence to do feature detection.
*** Bug 70929 has been marked as a duplicate of this bug. ***
Is this the same as bug 49739?
*** This bug has been marked as a duplicate of bug 49739 ***