[html5] r7114 - [giow] (1) Update 'connect' events in shared workers to include the port on even [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Jun 1 15:44:13 PDT 2012


Author: ianh
Date: 2012-06-01 15:44:12 -0700 (Fri, 01 Jun 2012)
New Revision: 7114

Modified:
   complete.html
   index
   source
Log:
[giow] (1) 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.
Affected topics: DOM APIs, Web Workers

Modified: complete.html
===================================================================
--- complete.html	2012-06-01 02:06:55 UTC (rev 7113)
+++ complete.html	2012-06-01 22:44:12 UTC (rev 7114)
@@ -79399,11 +79399,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><a href=#dom-messageevent-ports>ports</a></code> array as its first (and
-  only) value.</p>
+  for the new client is given by the event object's <code title=dom-messageevent-source><a href=#dom-messageevent-source>source</a></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
@@ -80334,11 +80333,12 @@
        <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
        interface, with the name <code title=event-connect>connect</code>, which does not bubble, is
        not cancelable, has no default action, has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value
-       is initialized to the empty string and has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose
+       is initialized to the empty string, has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose
        value is initialized to a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array containing
-       only the newly created port, and <a href=#queue-a-task>queue a task</a> to
-       dispatch the event at <var title="">worker global
-       scope</var>.</li>
+       only the newly created port, and has a <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute whose
+       value is initialized to the newly created port, and <a href=#queue-a-task>queue
+       a task</a> to dispatch the event at <var title="">worker
+       global scope</var>.</li>
 
        <li>
 
@@ -80389,10 +80389,13 @@
    <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
    interface, with the name <code title=event-connect>connect</code>, which does not bubble, is not
    cancelable, has no default action, has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value is
-   initialized to the empty string and has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose value
+   initialized to the empty string, has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose value
    is initialized to a <a href=#dfn-read-only-array title=dfn-read-only-array>read
-   only</a> array containing only the newly created port, and
-   <a href=#queue-a-task>queue a task</a> to dispatch the event at <var title="">worker global scope</var>.</li>
+   only</a> array containing only the newly created port, and has a
+   <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute whose
+   value is initialized to the newly created port, and <a href=#queue-a-task>queue a
+   task</a> to dispatch the event at <var title="">worker global
+   scope</var>.</li>
 
    <li>
 
@@ -80671,7 +80674,7 @@
   readonly attribute any <a href=#dom-messageevent-data title=dom-MessageEvent-data>data</a>;
   readonly attribute DOMString <a href=#dom-messageevent-origin title=dom-MessageEvent-origin>origin</a>;
   readonly attribute DOMString <a href=#dom-messageevent-lasteventid title=dom-MessageEvent-lastEventId>lastEventId</a>;
-  readonly attribute <a href=#windowproxy>WindowProxy</a>? <a href=#dom-messageevent-source title=dom-MessageEvent-source>source</a>;
+  readonly attribute (<a href=#windowproxy>WindowProxy</a> or <a href=#messageport>MessagePort</a>)? <a href=#dom-messageevent-source title=dom-MessageEvent-source>source</a>;
   readonly attribute <a href=#messageport>MessagePort</a>[]? <a href=#dom-messageevent-ports title=dom-MessageEvent-ports>ports</a>;
 };
 
@@ -80714,7 +80717,9 @@
    <dd>
 
     <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> of the source window, for
-    <a href=#web-messaging>cross-document messaging</a>.</p>
+    <a href=#web-messaging>cross-document messaging</a>, and the
+    <code><a href=#messageport>MessagePort</a></code> being attached, in the <code title=event-connect>connect</code> event fired at
+    <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> objects.</p>
 
    </dd>
 
@@ -80755,7 +80760,9 @@
   created, this attribute must be initialized to null. It represents,
   in <a href=#web-messaging>cross-document messaging</a>, the
   <code><a href=#windowproxy>WindowProxy</a></code> of the <a href=#browsing-context>browsing context</a> of the
-  <code><a href=#window>Window</a></code> object from which the message came.</p>
+  <code><a href=#window>Window</a></code> object from which the message came; and in the
+  <code title=event-connect>connect</code> events used by <a href=#sharedworkerglobalscope title=SharedWorkerGlobalScope>shared workers</a>, the newly
+  connecting <code><a href=#messageport>MessagePort</a></code>.</p>
 
   <p>The <dfn id=dom-messageevent-ports title=dom-MessageEvent-ports><code>ports</code></dfn>
   attribute must return the value it was initialized to. When the

Modified: index
===================================================================
--- index	2012-06-01 02:06:55 UTC (rev 7113)
+++ index	2012-06-01 22:44:12 UTC (rev 7114)
@@ -79399,11 +79399,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><a href=#dom-messageevent-ports>ports</a></code> array as its first (and
-  only) value.</p>
+  for the new client is given by the event object's <code title=dom-messageevent-source><a href=#dom-messageevent-source>source</a></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
@@ -80334,11 +80333,12 @@
        <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
        interface, with the name <code title=event-connect>connect</code>, which does not bubble, is
        not cancelable, has no default action, has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value
-       is initialized to the empty string and has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose
+       is initialized to the empty string, has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose
        value is initialized to a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array containing
-       only the newly created port, and <a href=#queue-a-task>queue a task</a> to
-       dispatch the event at <var title="">worker global
-       scope</var>.</li>
+       only the newly created port, and has a <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute whose
+       value is initialized to the newly created port, and <a href=#queue-a-task>queue
+       a task</a> to dispatch the event at <var title="">worker
+       global scope</var>.</li>
 
        <li>
 
@@ -80389,10 +80389,13 @@
    <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
    interface, with the name <code title=event-connect>connect</code>, which does not bubble, is not
    cancelable, has no default action, has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value is
-   initialized to the empty string and has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose value
+   initialized to the empty string, has a <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose value
    is initialized to a <a href=#dfn-read-only-array title=dfn-read-only-array>read
-   only</a> array containing only the newly created port, and
-   <a href=#queue-a-task>queue a task</a> to dispatch the event at <var title="">worker global scope</var>.</li>
+   only</a> array containing only the newly created port, and has a
+   <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute whose
+   value is initialized to the newly created port, and <a href=#queue-a-task>queue a
+   task</a> to dispatch the event at <var title="">worker global
+   scope</var>.</li>
 
    <li>
 
@@ -80671,7 +80674,7 @@
   readonly attribute any <a href=#dom-messageevent-data title=dom-MessageEvent-data>data</a>;
   readonly attribute DOMString <a href=#dom-messageevent-origin title=dom-MessageEvent-origin>origin</a>;
   readonly attribute DOMString <a href=#dom-messageevent-lasteventid title=dom-MessageEvent-lastEventId>lastEventId</a>;
-  readonly attribute <a href=#windowproxy>WindowProxy</a>? <a href=#dom-messageevent-source title=dom-MessageEvent-source>source</a>;
+  readonly attribute (<a href=#windowproxy>WindowProxy</a> or <a href=#messageport>MessagePort</a>)? <a href=#dom-messageevent-source title=dom-MessageEvent-source>source</a>;
   readonly attribute <a href=#messageport>MessagePort</a>[]? <a href=#dom-messageevent-ports title=dom-MessageEvent-ports>ports</a>;
 };
 
@@ -80714,7 +80717,9 @@
    <dd>
 
     <p>Returns the <code><a href=#windowproxy>WindowProxy</a></code> of the source window, for
-    <a href=#web-messaging>cross-document messaging</a>.</p>
+    <a href=#web-messaging>cross-document messaging</a>, and the
+    <code><a href=#messageport>MessagePort</a></code> being attached, in the <code title=event-connect>connect</code> event fired at
+    <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> objects.</p>
 
    </dd>
 
@@ -80755,7 +80760,9 @@
   created, this attribute must be initialized to null. It represents,
   in <a href=#web-messaging>cross-document messaging</a>, the
   <code><a href=#windowproxy>WindowProxy</a></code> of the <a href=#browsing-context>browsing context</a> of the
-  <code><a href=#window>Window</a></code> object from which the message came.</p>
+  <code><a href=#window>Window</a></code> object from which the message came; and in the
+  <code title=event-connect>connect</code> events used by <a href=#sharedworkerglobalscope title=SharedWorkerGlobalScope>shared workers</a>, the newly
+  connecting <code><a href=#messageport>MessagePort</a></code>.</p>
 
   <p>The <dfn id=dom-messageevent-ports title=dom-MessageEvent-ports><code>ports</code></dfn>
   attribute must return the value it was initialized to. When the

Modified: source
===================================================================
--- source	2012-06-01 02:06:55 UTC (rev 7113)
+++ source	2012-06-01 22:44:12 UTC (rev 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




More information about the Commit-Watchers mailing list