[html5] r8306 - [giow] (1) People apparently don't like it when the spec requires things that ar [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Nov 21 15:49:00 PST 2013


Author: ianh
Date: 2013-11-21 15:48:58 -0800 (Thu, 21 Nov 2013)
New Revision: 8306

Modified:
   complete.html
   index
   source
Log:
[giow] (1) People apparently don't like it when the spec requires things that are impossible to implement, go figure. (In this case, synchronously detecting that one of the MessagePorts being Transferred in the MessagePort message is actually the target of the message. You can't necessarily know this synchronously, since if the port has been shunted around between workers, you might only discover who the final target actually is after the message has itself bounced between threads for a while.)
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=23685
Affected topics: DOM APIs

Modified: complete.html
===================================================================
--- complete.html	2013-11-21 22:57:48 UTC (rev 8305)
+++ complete.html	2013-11-21 23:48:58 UTC (rev 8306)
@@ -80417,6 +80417,14 @@
 
    <li>
 
+    <p>Let <var title="">doomed</var> be false. It is set to true if a condition is detected that
+    will make this message cause the port to be unusable; specifically, if the message contains <var title="">target port</var> as one of the objects being <a href=#transfer-a-transferable-object title="transfer a Transferable
+    object">transferred</a>. (This condition cannot necessarily be detected synchronously.)</p>
+
+   </li>
+
+   <li>
+
     <p>Let <var title="">new ports</var> be an empty array.</p>
 
    </li>
@@ -80443,14 +80451,24 @@
 
      <li>
 
-      <p>If any of the objects in <var title="">transfer</var> are either the <var title="">source
-      port</var> or the <var title="">target port</var> (if any), then throw a
+<!--CLEANUP-->
+      <p>If any of the objects in <var title="">transfer</var> are the <var title="">source
+      port</var>, then throw a
       <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort these steps.</p>
 
      </li>
 
      <li>
 
+      <p>If any of the objects in <var title="">transfer</var> are the <var title="">target
+      port</var>, if any, then let <var title="">doomed</var> be true, and optionally report to a
+      developer console that the target port was posted to itself, causing the communication channel
+      to be lost.</p>
+
+     </li>
+
+     <li>
+
       <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
@@ -80478,9 +80496,10 @@
 
 <!--CLEANUP-->
       <p>Let <var title="">new owner</var> be the <a href=#concept-port-owner title=concept-port-owner>owner</a> of <var title="">target port</var>, if there
-      is a <var title="">target port</var>, or else some arbitrary owner. (This <var title="">new
+      is a <var title="">target port</var> and <var title="">doomed</var> is false, or else some arbitrary owner. (This <var title="">new
       owner</var> is used when transferring objects below. If there is no <var title="">target
-      port</var>, the <code><a href=#transferable>Transferable</a></code> objects given in the second argument, if any, are
+      port</var>, or if the <var title="">target port</var> is one of the objects being <a href=#transfer-a-transferable-object title="transfer a Transferable
+      object">transferred</a>, the <code><a href=#transferable>Transferable</a></code> objects given in the second argument, if any, are
       still <a href=#transfer-a-transferable-object title="transfer a Transferable object">transferred</a>, but since they are then
       discarded, it doesn't matter where they are transferred to.)</p>
 
@@ -80506,12 +80525,14 @@
 
    </li>
 
+<!--CLEANUP-->
    <li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is
-   not entangled), then abort these steps.</li> <!-- we don't throw an exception if there is no
+   not entangled), or if <var title="">doomed</var> is true, then abort these steps.</li> <!-- we don't throw an exception if there is no
    target port because this can happen at a moment's notice. we don't return false because if the
    port is _about_ to be closed, the message might not be listened for anyway. we don't do this
    before the steps above because otherwise you can tell the difference (in whether the ports have
-   become useless, or in when the structured clone algorithm runs scripts -->
+   become useless, or in when the structured clone algorithm runs scripts). We don't throw an
+   exception for 'doomed' being true, because this can't necessarily be detected synchronously -->
 
    <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code> interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
    default action.

Modified: index
===================================================================
--- index	2013-11-21 22:57:48 UTC (rev 8305)
+++ index	2013-11-21 23:48:58 UTC (rev 8306)
@@ -80417,6 +80417,14 @@
 
    <li>
 
+    <p>Let <var title="">doomed</var> be false. It is set to true if a condition is detected that
+    will make this message cause the port to be unusable; specifically, if the message contains <var title="">target port</var> as one of the objects being <a href=#transfer-a-transferable-object title="transfer a Transferable
+    object">transferred</a>. (This condition cannot necessarily be detected synchronously.)</p>
+
+   </li>
+
+   <li>
+
     <p>Let <var title="">new ports</var> be an empty array.</p>
 
    </li>
@@ -80443,14 +80451,24 @@
 
      <li>
 
-      <p>If any of the objects in <var title="">transfer</var> are either the <var title="">source
-      port</var> or the <var title="">target port</var> (if any), then throw a
+<!--CLEANUP-->
+      <p>If any of the objects in <var title="">transfer</var> are the <var title="">source
+      port</var>, then throw a
       <code><a href=#datacloneerror>DataCloneError</a></code> exception and abort these steps.</p>
 
      </li>
 
      <li>
 
+      <p>If any of the objects in <var title="">transfer</var> are the <var title="">target
+      port</var>, if any, then let <var title="">doomed</var> be true, and optionally report to a
+      developer console that the target port was posted to itself, causing the communication channel
+      to be lost.</p>
+
+     </li>
+
+     <li>
+
       <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
@@ -80478,9 +80496,10 @@
 
 <!--CLEANUP-->
       <p>Let <var title="">new owner</var> be the <a href=#concept-port-owner title=concept-port-owner>owner</a> of <var title="">target port</var>, if there
-      is a <var title="">target port</var>, or else some arbitrary owner. (This <var title="">new
+      is a <var title="">target port</var> and <var title="">doomed</var> is false, or else some arbitrary owner. (This <var title="">new
       owner</var> is used when transferring objects below. If there is no <var title="">target
-      port</var>, the <code><a href=#transferable>Transferable</a></code> objects given in the second argument, if any, are
+      port</var>, or if the <var title="">target port</var> is one of the objects being <a href=#transfer-a-transferable-object title="transfer a Transferable
+      object">transferred</a>, the <code><a href=#transferable>Transferable</a></code> objects given in the second argument, if any, are
       still <a href=#transfer-a-transferable-object title="transfer a Transferable object">transferred</a>, but since they are then
       discarded, it doesn't matter where they are transferred to.)</p>
 
@@ -80506,12 +80525,14 @@
 
    </li>
 
+<!--CLEANUP-->
    <li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is
-   not entangled), then abort these steps.</li> <!-- we don't throw an exception if there is no
+   not entangled), or if <var title="">doomed</var> is true, then abort these steps.</li> <!-- we don't throw an exception if there is no
    target port because this can happen at a moment's notice. we don't return false because if the
    port is _about_ to be closed, the message might not be listened for anyway. we don't do this
    before the steps above because otherwise you can tell the difference (in whether the ports have
-   become useless, or in when the structured clone algorithm runs scripts -->
+   become useless, or in when the structured clone algorithm runs scripts). We don't throw an
+   exception for 'doomed' being true, because this can't necessarily be detected synchronously -->
 
    <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code> interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
    default action.

Modified: source
===================================================================
--- source	2013-11-21 22:57:48 UTC (rev 8305)
+++ source	2013-11-21 23:48:58 UTC (rev 8306)
@@ -90136,6 +90136,15 @@
 
    <li>
 
+    <p>Let <var data-x="">doomed</var> be false. It is set to true if a condition is detected that
+    will make this message cause the port to be unusable; specifically, if the message contains <var
+    data-x="">target port</var> as one of the objects being <span data-x="transfer a Transferable
+    object">transferred</span>. (This condition cannot necessarily be detected synchronously.)</p>
+
+   </li>
+
+   <li>
+
     <p>Let <var data-x="">new ports</var> be an empty array.</p>
 
    </li>
@@ -90165,14 +90174,24 @@
 
      <li>
 
-      <p>If any of the objects in <var data-x="">transfer</var> are either the <var data-x="">source
-      port</var> or the <var data-x="">target port</var> (if any), then throw a
+<!--CLEANUP-->
+      <p>If any of the objects in <var data-x="">transfer</var> are the <var data-x="">source
+      port</var>, then throw a
       <code>DataCloneError</code> exception and abort these steps.</p>
 
      </li>
 
      <li>
 
+      <p>If any of the objects in <var data-x="">transfer</var> are the <var data-x="">target
+      port</var>, if any, then let <var data-x="">doomed</var> be true, and optionally report to a
+      developer console that the target port was posted to itself, causing the communication channel
+      to be lost.</p>
+
+     </li>
+
+     <li>
+
       <p>For each object <var data-x="">x</var> in <var data-x="">transfer</var> in turn, add a
       mapping from <var data-x="">x</var> to a new unique placeholder object created for <var
       data-x="">x</var> to <var data-x="">transfer map</var>, and if <var data-x="">x</var> is a
@@ -90205,9 +90224,10 @@
 
 <!--CLEANUP-->
       <p>Let <var data-x="">new owner</var> be the <span data-x="concept-port-owner">owner</span> of <var data-x="">target port</var>, if there
-      is a <var data-x="">target port</var>, or else some arbitrary owner. (This <var data-x="">new
+      is a <var data-x="">target port</var> and <var data-x="">doomed</var> is false, or else some arbitrary owner. (This <var data-x="">new
       owner</var> is used when transferring objects below. If there is no <var data-x="">target
-      port</var>, the <code>Transferable</code> objects given in the second argument, if any, are
+      port</var>, or if the <var data-x="">target port</var> is one of the objects being <span data-x="transfer a Transferable
+      object">transferred</span>, the <code>Transferable</code> objects given in the second argument, if any, are
       still <span data-x="transfer a Transferable object">transferred</span>, but since they are then
       discarded, it doesn't matter where they are transferred to.)</p>
 
@@ -90236,12 +90256,14 @@
 
    </li>
 
+<!--CLEANUP-->
    <li><p>If there is no <var data-x="">target port</var> (i.e. if <var data-x="">source port</var> is
-   not entangled), then abort these steps.</p></li> <!-- we don't throw an exception if there is no
+   not entangled), or if <var data-x="">doomed</var> is true, then abort these steps.</p></li> <!-- we don't throw an exception if there is no
    target port because this can happen at a moment's notice. we don't return false because if the
    port is _about_ to be closed, the message might not be listened for anyway. we don't do this
    before the steps above because otherwise you can tell the difference (in whether the ports have
-   become useless, or in when the structured clone algorithm runs scripts -->
+   become useless, or in when the structured clone algorithm runs scripts). We don't throw an
+   exception for 'doomed' being true, because this can't necessarily be detected synchronously -->
 
    <li><p>Create an event that uses the <code>MessageEvent</code> interface, with the name <code
    data-x="event-message">message</code>, which does not bubble, is not cancelable, and has no




More information about the Commit-Watchers mailing list