Navigation Menu

Skip to content

Commit

Permalink
[giow] (1) People apparently don't like it when the spec requires thi…
Browse files Browse the repository at this point in the history
…ngs 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

git-svn-id: http://svn.whatwg.org/webapps@8306 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Nov 21, 2013
1 parent 50d65e8 commit 5527e04
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 18 deletions.
33 changes: 27 additions & 6 deletions complete.html
Expand Up @@ -80415,6 +80415,14 @@ <h4 id=message-ports><span class=secno>9.5.3 </span>Message ports</h4>
<ol><!-- a lot of this is similar or identical to window.postMessage --><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="">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>
Expand Down Expand Up @@ -80443,12 +80451,22 @@ <h4 id=message-ports><span class=secno>9.5.3 </span>Message ports</h4>

<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
Expand Down Expand Up @@ -80478,9 +80496,10 @@ <h4 id=message-ports><span class=secno>9.5.3 </span>Message ports</h4>

<!--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>

Expand All @@ -80506,12 +80525,14 @@ <h4 id=message-ports><span class=secno>9.5.3 </span>Message ports</h4>

</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.
Expand Down
33 changes: 27 additions & 6 deletions index
Expand Up @@ -80415,6 +80415,14 @@ interface <dfn id=messagechannel>MessageChannel</dfn> {
<ol><!-- a lot of this is similar or identical to window.postMessage --><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="">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>
Expand Down Expand Up @@ -80443,12 +80451,22 @@ interface <dfn id=messagechannel>MessageChannel</dfn> {

<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
Expand Down Expand Up @@ -80478,9 +80496,10 @@ interface <dfn id=messagechannel>MessageChannel</dfn> {

<!--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>

Expand All @@ -80506,12 +80525,14 @@ interface <dfn id=messagechannel>MessageChannel</dfn> {

</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.
Expand Down
34 changes: 28 additions & 6 deletions source
Expand Up @@ -90134,6 +90134,15 @@ interface <dfn>MessageChannel</dfn> {
<li><p>Let <var data-x="">target port</var> be the port with which <var data-x="">source port</var>
is entangled, if any.</p></li>

<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>
Expand Down Expand Up @@ -90165,12 +90174,22 @@ interface <dfn>MessageChannel</dfn> {

<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
Expand Down Expand Up @@ -90205,9 +90224,10 @@ interface <dfn>MessageChannel</dfn> {

<!--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>

Expand Down Expand Up @@ -90236,12 +90256,14 @@ interface <dfn>MessageChannel</dfn> {

</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
Expand Down

0 comments on commit 5527e04

Please sign in to comment.