- From: poot <cvsmail@w3.org>
- Date: Tue, 18 Oct 2011 20:50:07 -0400
- To: public-html-diffs@w3.org
postmsg; hixie: Update postMessage() to do the transfers after the cloning so that if cloning fails, the transferables don't get killed. (whatwg r6697) http://dev.w3.org/cvsweb/html5/postmsg/Overview.html?r1=1.104&r2=1.105&f=h http://html5.org/tools/web-apps-tracker?from=6696&to=6697 =================================================================== RCS file: /sources/public/html5/postmsg/Overview.html,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- Overview.html 19 Oct 2011 00:09:15 -0000 1.104 +++ Overview.html 19 Oct 2011 00:49:55 -0000 1.105 @@ -642,7 +642,8 @@ <li> <p>Let <var title="">transfer map</var> be an empty association - list of pairs of <code>Transferable</code> objects.</p> + list of <code>Transferable</code> objects to placeholder + objects.</p> </li> @@ -662,16 +663,11 @@ <li> - <p>If the <var title="">transfer</var> argument is present, then - for each object in <var title="">transfer</var> in turn, obtain - a new object by <span title="transfer a Transferable - object">transferring</span> the object to the - <code>Window</code> object on which the method was invoked, and - add a mapping from the old object to the new transferred object - to <var title="">transfer map</var>. For each new - <code><a href="#messageport">MessagePort</a></code> object obtained in this manner, append - the new transferred object to the <var title="">new ports</var> - array.</p> + <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, add a mapping from <var title="">x</var> to a new unique placeholder object created for + <var title="">x</var> to <var title="">transfer map</var>, and + if <var title="">x</var> is a <code><a href="#messageport">MessagePort</a></code> object, + also append the placeholder object to the <var title="">new + ports</var> array.</p> </li> @@ -679,12 +675,6 @@ <li> - <p>Make <var title="">new ports</var> into a <span title="dfn-read-only-array">read only</span> array.</p> - - </li> - - <li> - <p>Let <var title="">message clone</var> be the result of obtaining a <span>structured clone</span> of the <var title="">message</var> argument, with <var title="">transfer map</var> as the <i>transfer map</i>. If this throws an exception, @@ -692,6 +682,32 @@ </li> + <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p> + + <ol><li> + + <p>Let <var title="">new owner</var> be the <code>Window</code> + object on which the method was invoked.</p> + + </li> + + <li> + + <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, obtain a new object <var title="">y</var> by <span title="transfer a Transferable + object">transferring</span> the object <var title="">x</var> to + <var title="">new owner</var>, and replace the placeholder + object that was created for the object <var title="">x</var> by + the new object <var title="">y</var> wherever the placeholder + exists (i.e. in <var title="">message clone</var> and in <var title="">new ports</var>).</p> + + </li> + + </ol><li> + + <p>Make <var title="">new ports</var> into a <span title="dfn-read-only-array">read only</span> array.</p> + + </li> + <li> <p>Return from the <code title="dom-window-postMessage"><a href="#dom-window-postmessage">postMessage()</a></code> method, but @@ -1002,14 +1018,6 @@ <ol><li><p>Let <var title="">target port</var> be the port with which <var title="">source port</var> is entangled, if any.</li> - <li><p>Let <var title="">new owner</var> be the owner of <var title="">target port</var>, if there is a <var title="">target - port</var>, or else some arbitrary owner. (This <var title="">new - owner</var> is used when transfering objects below. If there is no - <var title="">target port</var>, the <code>Transferable</code> - objects given in the second argument, if any, are still <span title="transfer a Transferable object">transfered</span>, but since - they are then discarded, it doesn't matter where they are - transfered to.)</li> - <li> <p>Let <var title="">new ports</var> be an empty array.</p> @@ -1019,7 +1027,8 @@ <li> <p>Let <var title="">transfer map</var> be an empty association - list of pairs of <code>Transferable</code> objects.</p> + list of <code>Transferable</code> objects to placeholder + objects.</p> </li> @@ -1048,15 +1057,11 @@ <li> - <p>If the <var title="">transfer</var> argument is present, then - for each object in <var title="">transfer</var> in turn, obtain - a new object by <span title="transfer a Transferable - object">transferring</span> the object to <var title="">new - owner</var>, and add a mapping from the old object to the new - transferred object to <var title="">transfer map</var>. If the - objects are <code><a href="#messageport">MessagePort</a></code> objects, also append the - new transferred object to the <var title="">new ports</var> - array.</p> + <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, add a mapping from <var title="">x</var> to a new unique placeholder object created for + <var title="">x</var> to <var title="">transfer map</var>, and + if <var title="">x</var> is a <code><a href="#messageport">MessagePort</a></code> object, + also append the placeholder object to the <var title="">new + ports</var> array.</p> </li> @@ -1064,19 +1069,46 @@ <li> - <p>Make <var title="">new ports</var> into a <span title="dfn-read-only-array">read only</span> array.</p> + <p>Let <var title="">message clone</var> be the result of + obtaining a <span>structured clone</span> of the <var title="">message</var> argument, with <var title="">transfer + map</var> as the <i>transfer map</i>. If this throws an exception, + then throw that exception and abort these steps.</p> </li> - <li><p>Let <var title="">message</var> be the method's first - argument.</li> + <li> + + <p>If the method was invoked with a second argument <var title="">transfer</var>, run these substeps:</p> + + <ol><li> + + <p>Let <var title="">new owner</var> be the owner of <var title="">target port</var>, if there is a <var title="">target + port</var>, or else some arbitrary owner. (This <var title="">new owner</var> is used when transfering objects below. + If there is no <var title="">target port</var>, the + <code>Transferable</code> objects given in the second argument, + if any, are still <span title="transfer a Transferable + object">transfered</span>, but since they are then discarded, it + doesn't matter where they are transfered to.)</p> + + </li> + + + <li> + + <p>For each object <var title="">x</var> in <var title="">transfer</var> in turn, obtain a new object <var title="">y</var> by <span title="transfer a Transferable + object">transferring</span> the object <var title="">x</var> to + <var title="">new owner</var>, and replace the placeholder + object that was created for the object <var title="">x</var> by + the new object <var title="">y</var> wherever the placeholder + exists (i.e. in <var title="">message clone</var> and in <var title="">new ports</var>).</p> + + </li> + + </ol></li> <li> - <p>Let <var title="">message clone</var> be the result of - obtaining a <span>structured clone</span> of the <var title="">message</var> argument, with <var title="">transfer - map</var> as the <i>transfer map</i>. If this throws an exception, - then throw that exception and abort these steps.</p> + <p>Make <var title="">new ports</var> into a <span title="dfn-read-only-array">read only</span> array.</p> </li>
Received on Wednesday, 19 October 2011 00:50:15 UTC