HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/7114

SVNBugCommentTime (UTC)
7114[Gecko] [Internet Explorer] [Opera] [Webkit] Update 'connect' events in shared workers to include the port on event.source, as well as event.ports[0], to make the event more intuitive.2012-06-01 22:44
Index: source
===================================================================
--- source	(revision 7113)
+++ source	(revision 7114)
@@ -92209,11 +92209,10 @@
   <p>Inside the shared worker, new clients of the worker are announced
   using the <code title="event-connect">connect</code> event. The port
   for the new client is given by the event object's <code
-  title="dom-messageevent-ports">ports</code> array as its first (and
-  only) value.</p>
+  title="dom-messageevent-source">source</code> attribute.</p>
 
   <pre>onconnect = function (event) {
-  var newPort = event.ports[0];
+  var newPort = event.source;
   // set up a listener
   newPort.onmessage = function (event) { ... };
   // send a message back to the port
@@ -93328,13 +93327,15 @@
        title="event-connect">connect</code>, which does not bubble, is
        not cancelable, has no default action, has a <code
        title="dom-MessageEvent-data">data</code> attribute whose value
-       is initialized to the empty string and has a <code
+       is initialized to the empty string, has a <code
        title="dom-MessageEvent-ports">ports</code> attribute whose
        value is initialized to a <span
        title="dfn-read-only-array">read only</span> array containing
-       only the newly created port, and <span>queue a task</span> to
-       dispatch the event at <var title="">worker global
-       scope</var>.</p></li>
+       only the newly created port, and has a <code
+       title="dom-MessageEvent-source">source</code> attribute whose
+       value is initialized to the newly created port, and <span>queue
+       a task</span> to dispatch the event at <var title="">worker
+       global scope</var>.</p></li>
 
        <li>
 
@@ -93396,12 +93397,14 @@
    title="event-connect">connect</code>, which does not bubble, is not
    cancelable, has no default action, has a <code
    title="dom-MessageEvent-data">data</code> attribute whose value is
-   initialized to the empty string and has a <code
+   initialized to the empty string, has a <code
    title="dom-MessageEvent-ports">ports</code> attribute whose value
    is initialized to a <span title="dfn-read-only-array">read
-   only</span> array containing only the newly created port, and
-   <span>queue a task</span> to dispatch the event at <var
-   title="">worker global scope</var>.</p></li>
+   only</span> array containing only the newly created port, and has a
+   <code title="dom-MessageEvent-source">source</code> attribute whose
+   value is initialized to the newly created port, and <span>queue a
+   task</span> to dispatch the event at <var title="">worker global
+   scope</var>.</p></li>
 
    <li>
 
@@ -93735,7 +93738,7 @@
   readonly attribute any <span title="dom-MessageEvent-data">data</span>;
   readonly attribute DOMString <span title="dom-MessageEvent-origin">origin</span>;
   readonly attribute DOMString <span title="dom-MessageEvent-lastEventId">lastEventId</span>;
-  readonly attribute <span>WindowProxy</span>? <span title="dom-MessageEvent-source">source</span>;
+  readonly attribute (<span>WindowProxy</span> or <span>MessagePort</span>)? <span title="dom-MessageEvent-source">source</span>;
   readonly attribute <span>MessagePort</span>[]? <span title="dom-MessageEvent-ports">ports</span>;
 };
 
@@ -93781,7 +93784,10 @@
    <dd>
 
     <p>Returns the <code>WindowProxy</code> of the source window, for
-    <span>cross-document messaging</span>.</p>
+    <span>cross-document messaging</span>, and the
+    <code>MessagePort</code> being attached, in the <code
+    title="event-connect">connect</code> event fired at
+    <code>SharedWorkerGlobalScope</code> objects.</p>
 
    </dd>
 
@@ -93828,7 +93834,10 @@
   created, this attribute must be initialized to null. It represents,
   in <span>cross-document messaging</span>, the
   <code>WindowProxy</code> of the <span>browsing context</span> of the
-  <code>Window</code> object from which the message came.</p>
+  <code>Window</code> object from which the message came; and in the
+  <code title="event-connect">connect</code> events used by <span
+  title="SharedWorkerGlobalScope">shared workers</span>, the newly
+  connecting <code>MessagePort</code>.</p>
 
   <p>The <dfn title="dom-MessageEvent-ports"><code>ports</code></dfn>
   attribute must return the value it was initialized to. When the

|