- From: poot <cvsmail@w3.org>
- Date: Sat, 21 Mar 2009 06:11:48 +0900 (JST)
- To: public-html-diffs@w3.org
postMessage() methods that take MessagePort objects now take MessagePortArray objects. (whatwg r2885) 7.2.3 Posting messages http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#posting-messages ports http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#dom-messageevent-ports 7.3.3.1 Ports and garbage collection http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#ports-and-garbage-collection MessagePort http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#messageport message http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#event-message 7.2 Cross-document messaging http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#crossDocumentMessages 8 The HTML syntax http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#syntax postMessage(message, targetOrigin) http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#dom-window-postmessage-2 postMessage(message, ports, targetOrigin) http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#dom-window-postmessage-3 Window http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#window source http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#dom-messageevent-source port2 http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#dom-channel-port2 7.2.4 Posting messages with message ports http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#posting-messages-with-message-ports 7.2.2.2 User agents http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#user-agents postMessage() http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#dom-messageport-postmessage 8.1 Writing HTML documents http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#writing-html-documents 7.3.3 Message ports http://people.w3.org/mike/diffs/html5/spec/Overview.1.2057.html#message-ports http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2056&r2=1.2057&f=h http://html5.org/tools/web-apps-tracker?from=2884&to=2885 =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.2056 retrieving revision 1.2057 diff -u -d -r1.2056 -r1.2057 --- Overview.html 20 Mar 2009 20:03:58 -0000 1.2056 +++ Overview.html 20 Mar 2009 21:09:45 -0000 1.2057 @@ -34525,7 +34525,7 @@ // <a href=#crossDocumentMessages>cross-document messaging</a> void <a href=#dom-window-postmessage-2 title=dom-window-postMessage-2>postMessage</a>(in any message, in DOMString targetOrigin); - void <a href=#dom-window-postmessage-3 title=dom-window-postMessage-3>postMessage</a>(in any message, in <a href=#messageport>MessagePort</a> messagePort, in DOMString targetOrigin); + void <a href=#dom-window-postmessage-3 title=dom-window-postMessage-3>postMessage</a>(in any message, in <span>MessagePortArray</span> ports, in DOMString targetOrigin); // <a href=#event-handler-dom-attributes>event handler DOM attributes</a> attribute <a href=#function>Function</a> <a href=#handler-onabort title=handler-onabort>onabort</a>; @@ -44450,9 +44450,9 @@ 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=#messageport>MessagePort</a> <a href=#dom-messageevent-messageport title=dom-MessageEvent-messagePort>messagePort</a>; - void <a href=#dom-messageevent-initmessageevent title=dom-MessageEvent-initMessageEvent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <a href=#messageport>MessagePort</a> messagePortArg); - void <a href=#dom-messageevent-initmessageeventns title=dom-MessageEvent-initMessageEventNS>initMessageEventNS</a>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <a href=#messageport>MessagePort</a> messagePortArg); + readonly attribute <span>MessagePortArray</span> <a href=#dom-messageevent-ports title=dom-MessageEvent-ports>ports</a>; + void <a href=#dom-messageevent-initmessageevent title=dom-MessageEvent-initMessageEvent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <span>MessagePortArray</span> portsArg); + void <a href=#dom-messageevent-initmessageeventns title=dom-MessageEvent-initMessageEventNS>initMessageEventNS</a>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <span>MessagePortArray</span> portsArg); };</pre><dl class=domintro><dt><var title="">event</var> . <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code></dt> <dd> @@ -44488,13 +44488,13 @@ </dd> - <dt><var title="">event</var> . <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code></dt> + <dt><var title="">event</var> . <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code></dt> <dd> - <p>Returns the <code><a href=#messageport>MessagePort</a></code> sent with the message, for - <a href=#crossDocumentMessages>cross-document messaging</a> and <a href=#channel-messaging>channel - messaging</a>.</p> + <p>Returns the <code>MessagePortArray</code> sent with the + message, for <a href=#crossDocumentMessages>cross-document messaging</a> and + <a href=#channel-messaging>channel messaging</a>.</p> </dd> @@ -44524,18 +44524,18 @@ <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> - <p>The <dfn id=dom-messageevent-messageport title=dom-MessageEvent-messagePort><code>messagePort</code></dfn> + <p>The <dfn id=dom-messageevent-ports title=dom-MessageEvent-ports><code>ports</code></dfn> attribute represents, in <a href=#crossDocumentMessages>cross-document messaging</a> and - <a href=#channel-messaging>channel messaging</a> the <code><a href=#messageport>MessagePort</a></code> being - sent, if any.</p> + <a href=#channel-messaging>channel messaging</a> the <code>MessagePortArray</code> + being sent, if any.</p> <p>Unless otherwise specified, when the user agent creates and dispatches a <code title=event-message><a href=#event-message>message</a></code> event in the algorithms described in the following sections, the <code title=dom-MessageEvent-lastEventId><a href=#dom-messageevent-lasteventid>lastEventId</a></code> attribute must be the empty string, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be the empty string, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be - null, and the <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code> - attribute must be null.</p> + null, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute + must be null.</p> </div><h3 id=crossDocumentMessages><span class=secno>7.2 </span><dfn>Cross-document messaging</dfn></h3><p>Web browsers, for security and privacy reasons, prevent documents in different domains from affecting each other; that is, cross-site @@ -44610,17 +44610,22 @@ disallowed for security reasons. It also requires that UAs be careful to allow access to certain properties but not others.</p> - </div><h4 id=posting-messages><span class=secno>7.2.3 </span>Posting messages</h4><dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage</a></code>(<var title="">message</var>, [ <var title="">port</var>, ] <var title="">targetOrigin</var>)</dt> + </div><h4 id=posting-messages><span class=secno>7.2.3 </span>Posting messages</h4><dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage</a></code>(<var title="">message</var>, [ <var title="">ports</var>, ] <var title="">targetOrigin</var>)</dt> <dd> - <p>Posts a message, optionally with a port, to the given window.</p> + <p>Posts a message, optionally with an array of ports, to the + given window.</p> <p>If the origin of the target window doesn't match the given origin, the message is discarded, to avoid information leakage. To send the message to the target regardless of origin, set the target origin to "<code title="">*</code>".</p> + <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array is not null and it contains + either null entries, duplicate ports, or ports that are not + entangled.</p> + </dd> </dl><div class=impl> @@ -44696,7 +44701,7 @@ <h4 id=posting-messages-with-message-ports><span class=secno>7.2.4 </span>Posting messages with message ports</h4> - <p>When a script invokes the <dfn id=dom-window-postmessage-3 title=dom-window-postMessage-3><code>postMessage(<var title="">message</var>, <var title="">messagePort</var>, <var title="">targetOrigin</var>)</code></dfn> method (with three + <p>When a script invokes the <dfn id=dom-window-postmessage-3 title=dom-window-postMessage-3><code>postMessage(<var title="">message</var>, <var title="">ports</var>, <var title="">targetOrigin</var>)</code></dfn> method (with three arguments) on a <code><a href=#window>Window</a></code> object, the user agent must follow these steps: @@ -44723,7 +44728,7 @@ <li> <!-- NEW STEP --> - <p>If the <var title="">messagePort</var> argument is null, then + <p>If the <var title="">ports</var> argument is null, then act as if the method had just been <a href=#dom-window-postmessage-2 title=dom-window-postMessage-2>called with two arguments</a>, <var title="">message</var> and <var title="">targetOrigin</var>.</p> @@ -44731,10 +44736,27 @@ <li> <!-- NEW STEP --> - <p>Try to obtain a <var title="">new port</var> by <a href=#clone-a-port title="clone a port">cloning</a> the <var title="">messagePort</var> argument with the <code><a href=#window>Window</a></code> - object on which the method was invoked as the owner of the - clone. If this returns an exception, then throw that exception and - abort these steps.</p> + <p>If any of the entries in <var title="">ports</var> are + null, if any of the entries in <var title="">ports</var> + are not entangled <code><a href=#messageport>MessagePort</a></code> objects, or if any + <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, then throw an + <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</p> + + </li> + + <li> <!-- NEW STEP --> + + <p>Let <var title="">new ports</var> be an empty array.</p> + + <p>For each port in <var title="">ports</var> in turn, + obtain a new port by <a href=#clone-a-port title="clone a port">cloning</a> the + port with the <code><a href=#window>Window</a></code> object on which the method was + invoked as the owner of the clone, and append the clone to the + <var title="">new ports</var> array.</p> + + <p class=note>If the original <var title="">ports</var> + array was empty, then the <var title="">new ports</var> array will + also be empty.</p> </li> @@ -44773,8 +44795,8 @@ <li> <!-- NEW STEP --> - <p>Let the <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code> attribute - of the event be the <var title="">new port</var>.</p> + <p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute + of the event be the <var title="">new ports</var> array.</p> </li> @@ -44855,9 +44877,11 @@ <code><a href=#messagechannel>MessageChannel</a></code> object was created.</p> </div><h4 id=message-ports><span class=secno>7.3.3 </span>Message ports</h4><p>Each channel has two message ports. Data sent through one port is - received by the other port, and vice versa.<pre class=idl>interface <dfn id=messageport>MessagePort</dfn> { + received by the other port, and vice versa.<pre class=idl>typedef sequence<MessagePort> MessagePortArray; + +interface <dfn id=messageport>MessagePort</dfn> { readonly attribute boolean <a href=#dom-messageport-active title=dom-MessagePort-active>active</a>; - void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, [Optional] in <a href=#messageport>MessagePort</a> messagePort);<!-- + void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, [Optional] in <span>MessagePortArray</span> ports);<!-- <span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(in any message);--> void <a href=#dom-messageport-start title=dom-MessagePort-start>start</a>(); void <a href=#dom-messageport-close title=dom-MessagePort-close>close</a>(); @@ -44872,14 +44896,16 @@ </dd> - <dt><var title="">port</var> . <code title=dom-MessagePort-poseMessage>postMessage</code>(<var title="">message</var> [, <var title="">port</var>] )</dt> + <dt><var title="">port</var> . <code title=dom-MessagePort-poseMessage>postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt> <dd> - <p>Posts a message through the channel, optionally with the given port.</p> + <p>Posts a message through the channel, optionally with the given + ports.</p> - <p>Throws an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> if the port to be - sent is one of the ports involved in the communication.</p> + <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array is not null and it contains + either null entries, duplicate ports, ports that are not + entangled, or the source or target port.</p> </dd> @@ -45000,20 +45026,37 @@ attribute of the event have the value of <var title="">message clone</var>.</li> - <li><p>If the method was called with a second argument <var title="">data port</var> and that argument isn't null, then run the - following substeps:</p> + <li><p>If the method was called with a second argument <var title="">ports</var> and that argument isn't null, then run + the following substeps:</p> - <ol><li><p>If the <var title="">data port</var> is the <var title="">source port</var> or the <var title="">target - port</var>, then throw an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> - exception and abort all these steps.</li> + <ol><li> - <li><p>Try to obtain a <var title="">new data port</var> by <a href=#clone-a-port title="clone a port">cloning</a> the <var title="">data - port</var> with the owner of the <var title="">target port</var> - as the owner of the clone. If this returns an exception, then - throw that exception and abort these steps.</li> + <p>If any of the entries in <var title="">ports</var> are + null, if any of the entries in <var title="">ports</var> + are not entangled <code><a href=#messageport>MessagePort</a></code> objects, or if any + <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, then throw an + <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</p> + + </li> + + <li> + + <p>Let <var title="">new ports</var> be an empty array.</p> + + <p>For each port in <var title="">ports</var> in turn, + obtain a new port by <a href=#clone-a-port title="clone a port">cloning</a> + the port with the owner of the <var title="">target port</var> + as the owner of the clone, and append the clone to the <var title="">new ports</var> array.</p> + + <p class=note>If the original <var title="">ports</var> + array was empty, then the <var title="">new ports</var> array will + also be empty.</p> + + </li> - <li><p>Let the <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code> attribute - of the event be the <var title="">new data port</var>.</li> + <li><p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> + attribute of the event be the <var title="">new ports</var> + array.</li> </ol></li> @@ -45071,8 +45114,9 @@ title="">message</var>, the method's first argument.</p></li> <li><p>Let the <code - title="dom-MessageEvent-messagePort">messagePort</code> attribute - of the event be <var title="">port2</var>.</p></li> + title="dom-MessageEvent-ports">ports</code> attribute + of the event be an array containing only <var + title="">port2</var>.</p></li> <li><p>Return <var title="">port1</var> from the method, but continue with these steps.</p></li> @@ -45149,6 +45193,9 @@ <!-- we might not need to explicitly say the first part of DOM Events is fixed to say that events on a task queue prevent GC --> + <!-- XXX what about ports in the ports attribute of a MessageEvent + that isn't dispatched yet? --> + </div><h2 id=syntax><span class=secno>8 </span><dfn>The HTML syntax</dfn></h2><p class=note>This section only describes the rules for <code title="">text/html</code> resources. Rules for XML resources are discussed in the section below entitled "<a href=#the-xhtml-syntax>The XHTML syntax</a>".<h3 id=writing-html-documents><span class=secno>8.1 </span>Writing HTML documents</h3><div class=impl>
Received on Friday, 20 March 2009 21:12:26 UTC