[html5] r6903 - [e] (0) Add more explanatory text about postMessage()'s first argument. Affected [...]
whatwg at whatwg.org
whatwg at whatwg.org
Wed Jan 18 14:56:50 PST 2012
Author: ianh
Date: 2012-01-18 14:56:49 -0800 (Wed, 18 Jan 2012)
New Revision: 6903
Modified:
complete.html
index
source
Log:
[e] (0) Add more explanatory text about postMessage()'s first argument.
Affected topics: DOM APIs, HTML, Web Workers
Modified: complete.html
===================================================================
--- complete.html 2012-01-18 00:02:50 UTC (rev 6902)
+++ complete.html 2012-01-18 22:56:49 UTC (rev 6903)
@@ -240,7 +240,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 17 January 2012</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 18 January 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
@@ -75840,6 +75840,15 @@
immediately invoked the method of the same name on the port, with
the same arguments, and returned the same return value.</p>
+ <div class=example>
+
+ <p>The <code title=dom-Worker-postMessage><a href=#dom-worker-postmessage>postMessage()</a></code>
+ method's first argument can be structured data:</p>
+
+ <pre>worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});</pre>
+
+ </div>
+
<p>The following are the <a href=#event-handlers>event handlers</a> (and their
corresponding <a href=#event-handler-event-type title="event handler event type">event handler
event types</a>) that must be supported, as IDL attributes, by
@@ -78328,9 +78337,17 @@
<dd>
- <p>Posts a message to the given window. Objects listed in <var title="">transfer</var> are transferred, not just cloned, meaning
- that they are no longer usable on the sending side.</p>
+ <p>Posts a message to the given window. Messages can be structured
+ objects, e.g. nested objects and arrays, can contain JavaScript
+ values (strings, numbers, <code>Date</code>s, etc), and can
+ contain certain data objects such as <code><a href=#file>File</a></code>
+ <code><a href=#blob>Blob</a></code>, <code><a href=#filelist>FileList</a></code>, and
+ <code><a href=#arraybuffer>ArrayBuffer</a></code> objects.</p>
+ <p>Objects listed in <var title="">transfer</var> are transferred,
+ not just cloned, meaning that they are no longer usable on the
+ sending side.</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
@@ -78547,7 +78564,12 @@
// ...
}</pre>
+ <p>Data sent on a port can be structured data; for example here an
+ array of strings is passed:</p>
+ <pre>port1.postMessage(['hello', 'world'], 'http://example.com');</pre>
+
+
<h5 id=ports-as-the-basis-of-an-object-capability-model-on-the-web><span class=secno>10.5.1.1 </span>Ports as the basis of an object-capability model on the Web</h5>
<p><i>This section is non-normative.</i></p>
@@ -98077,6 +98099,7 @@
Eira Monstad,
Eitan Adler,
Eliot Graff,
+ Elisabeth Robson,
Elizabeth Castro,
Elliott Sprehn,
Elliotte Harold,
Modified: index
===================================================================
--- index 2012-01-18 00:02:50 UTC (rev 6902)
+++ index 2012-01-18 22:56:49 UTC (rev 6903)
@@ -240,7 +240,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 17 January 2012</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 18 January 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
@@ -75840,6 +75840,15 @@
immediately invoked the method of the same name on the port, with
the same arguments, and returned the same return value.</p>
+ <div class=example>
+
+ <p>The <code title=dom-Worker-postMessage><a href=#dom-worker-postmessage>postMessage()</a></code>
+ method's first argument can be structured data:</p>
+
+ <pre>worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});</pre>
+
+ </div>
+
<p>The following are the <a href=#event-handlers>event handlers</a> (and their
corresponding <a href=#event-handler-event-type title="event handler event type">event handler
event types</a>) that must be supported, as IDL attributes, by
@@ -78328,9 +78337,17 @@
<dd>
- <p>Posts a message to the given window. Objects listed in <var title="">transfer</var> are transferred, not just cloned, meaning
- that they are no longer usable on the sending side.</p>
+ <p>Posts a message to the given window. Messages can be structured
+ objects, e.g. nested objects and arrays, can contain JavaScript
+ values (strings, numbers, <code>Date</code>s, etc), and can
+ contain certain data objects such as <code><a href=#file>File</a></code>
+ <code><a href=#blob>Blob</a></code>, <code><a href=#filelist>FileList</a></code>, and
+ <code><a href=#arraybuffer>ArrayBuffer</a></code> objects.</p>
+ <p>Objects listed in <var title="">transfer</var> are transferred,
+ not just cloned, meaning that they are no longer usable on the
+ sending side.</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
@@ -78547,7 +78564,12 @@
// ...
}</pre>
+ <p>Data sent on a port can be structured data; for example here an
+ array of strings is passed:</p>
+ <pre>port1.postMessage(['hello', 'world'], 'http://example.com');</pre>
+
+
<h5 id=ports-as-the-basis-of-an-object-capability-model-on-the-web><span class=secno>10.5.1.1 </span>Ports as the basis of an object-capability model on the Web</h5>
<p><i>This section is non-normative.</i></p>
@@ -98077,6 +98099,7 @@
Eira Monstad,
Eitan Adler,
Eliot Graff,
+ Elisabeth Robson,
Elizabeth Castro,
Elliott Sprehn,
Elliotte Harold,
Modified: source
===================================================================
--- source 2012-01-18 00:02:50 UTC (rev 6902)
+++ source 2012-01-18 22:56:49 UTC (rev 6903)
@@ -87931,6 +87931,15 @@
immediately invoked the method of the same name on the port, with
the same arguments, and returned the same return value.</p>
+ <div class="example">
+
+ <p>The <code title="dom-Worker-postMessage">postMessage()</code>
+ method's first argument can be structured data:</p>
+
+ <pre>worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});</pre>
+
+ </div>
+
<p>The following are the <span>event handlers</span> (and their
corresponding <span title="event handler event type">event handler
event types</span>) that must be supported, as IDL attributes, by
@@ -90914,10 +90923,17 @@
<dd>
- <p>Posts a message to the given window. Objects listed in <var
- title="">transfer</var> are transferred, not just cloned, meaning
- that they are no longer usable on the sending side.</p>
+ <p>Posts a message to the given window. Messages can be structured
+ objects, e.g. nested objects and arrays, can contain JavaScript
+ values (strings, numbers, <code>Date</code>s, etc), and can
+ contain certain data objects such as <code>File</code>
+ <code>Blob</code>, <code>FileList</code>, and
+ <code>ArrayBuffer</code> objects.</p>
+ <p>Objects listed in <var title="">transfer</var> are transferred,
+ not just cloned, meaning that they are no longer usable on the
+ sending side.</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
@@ -91177,7 +91193,12 @@
// ...
}</pre>
+ <p>Data sent on a port can be structured data; for example here an
+ array of strings is passed:</p>
+ <pre>port1.postMessage(['hello', 'world'], 'http://example.com');</pre>
+
+
<h5>Ports as the basis of an object-capability model on the Web</h5>
<!--END dev-html--><p><i>This section is non-normative.</i></p><!--START dev-html-->
@@ -114916,6 +114937,7 @@
Eira Monstad,
Eitan Adler,
Eliot Graff,
+ Elisabeth Robson,
Elizabeth Castro,
Elliott Sprehn,
Elliotte Harold,
More information about the Commit-Watchers
mailing list