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 13525 - Define what .origin should be for message events
Summary: Define what .origin should be for message events
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebSocket API (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-02 18:51 UTC by Jonas Sicking (Not reading bugmail)
Modified: 2011-08-08 21:43 UTC (History)
4 users (show)

See Also:


Attachments

Description Jonas Sicking (Not reading bugmail) 2011-08-02 18:51:34 UTC
Right now the websocket protocol doesn't say what event.origin should return for message events fired for incoming data, which I believe implicitly means that it should be the empty string.

It seems nice if it was more consistent with EventSource which uses the origin of the server we're connected to.
Comment 1 Jonas Sicking (Not reading bugmail) 2011-08-02 22:01:35 UTC
Oops, wrong component.
Comment 2 Ian 'Hixie' Hickson 2011-08-08 21:16:39 UTC
http://www.whatwg.org/specs/web-apps/current-work/complete.html#messageevent defines the default as being the empty string, yes.

What origin would you want it set to? Web Sockets by definition are same-origin with whatever script created them (they don't connect successfully otherwise). I suppose we could parse WebSocket.url and set MessageEvent.origin to the scheme, host, and port parts of that URL, but that seems a bit awkward (and wouldn't really be an origin in the technical sense).
Comment 3 Jonas Sicking (Not reading bugmail) 2011-08-08 21:24:11 UTC
Why wouldn't that be a origin in the technical sense?
Comment 4 Ian 'Hixie' Hickson 2011-08-08 21:41:12 UTC
We talked about this on IRC. I'll do what EventSource does (it also doesn't use what is technically the origin, but this is mostly a matter of how you view things and if it'll help authors, why not expose it).
Comment 5 contributor 2011-08-08 21:43:36 UTC
Checked in as WHATWG revision r6386.
Check-in comment: Make event.origin for WebSockets work like it does for EventSource, for consistency.
http://html5.org/tools/web-apps-tracker?from=6385&to=6386