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 11827 - [Workers] "connect" event interface type not defined
Summary: [Workers] "connect" event interface type not defined
Status: CLOSED WORKSFORME
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Web Workers (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P2 major
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-21 00:00 UTC by Travis Leithead [MSFT]
Modified: 2011-02-02 00:43 UTC (History)
3 users (show)

See Also:


Attachments

Description Travis Leithead [MSFT] 2011-01-21 00:00:54 UTC
I fully expected to see an interface ConnectEvent used to describe that APIs are available to a Shared Worker on the onconnect event handler. 

As this is implemented in Opera and Chrome and Safari today, I checked and there seems to be some disagreement in the implementations...

Both report the event name to be MessageEvent, but WebKit doesn't have a "data" property as expected (undefined) and Opera populates a "data" property with value "connect".

This delta is obviously due to an under-specification of the "connect" event type that should be fired in this case.

Can this clarification please be added?
Comment 1 Ian 'Hixie' Hickson 2011-01-21 00:38:45 UTC
As far as I can tell the spec is unambiguous about this. The event is called 'connect', it's of type "MessageEvent", does not bubble, is not cancelable, has no default action, has a data attribute whose value is the empty string and has a ports attribute whose value is an array containing only the newly created port, and is fired asynchronously:

http://www.whatwg.org/specs/web-apps/current-work/complete/workers.html#shared-workers-and-the-sharedworker-interface

The MessageEvent interface additionally says that "Except where otherwise specified, when the user agent creates and dispatches a message event in the algorithms described in the following sections, the lastEventId attribute must be the empty string, the origin attribute must be the empty string, the source attribute must be null, and the ports attribute must be null":

http://www.whatwg.org/specs/web-apps/current-work/complete/comms.html#messageevent

It looks like WebKit and Opera both have bugs; they should set 'data' to the empty string.

Please reopen this bug if I'm wrong. Thanks!
Comment 2 Travis Leithead [MSFT] 2011-02-02 00:43:03 UTC
yes, it looks like I just missed the portion of the spec describing the connect event's type and related info.