Skip to content
Permalink
Browse files

[] (0) Make MessagePort objects not be owned by Windows necessarily, …

…and remove ownerWindow.

git-svn-id: http://svn.whatwg.org/webapps@2020 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 6, 2008
1 parent 9d1d348 commit 71a6bddb479968811cc750784552c887ecdc83e8
Showing with 40 additions and 58 deletions.
  1. +21 −30 index
  2. +19 −28 source
51 index
@@ -28,7 +28,7 @@

<h1 id=html-5>HTML 5</h1>

<h2 class="no-num no-toc" id=draft>Draft Recommendation &mdash; 5 August
<h2 class="no-num no-toc" id=draft>Draft Recommendation &mdash; 6 August
2008</h2>

<p>You can take part in this work. <a
<ol>
<li>
<p><a href="#create">Create a new <code>MessagePort</code> object</a>
owned by the <a href="#script3">script browsing context</a>, and let
owned by the <a href="#script2">script execution context</a>, and let
<var title="">port1</var> be that object.

<li>
<p><a href="#create">Create a new <code>MessagePort</code> object</a>
owned by the <a href="#script3">script browsing context</a>, and let
owned by the <a href="#script2">script execution context</a>, and let
<var title="">port2</var> be that object.

<li>
received by the other port, and vice versa.

<pre class=idl>interface <dfn id=messageport0>MessagePort</dfn> {
readonly attribute <a href="#window">Window</a> <a href="#ownerwindow" title=dom-MessagePort-ownerWindow>ownerWindow</a>;
readonly attribute boolean <a href="#active0" title=dom-MessagePort-active>active</a>;
boolean <a href="#postmessage1" title=dom-MessagePort-postMessage>postMessage</a>(in DOMString message);
boolean <a href="#postmessage1" title=dom-MessagePort-postMessage>postMessage</a>(in DOMString message, in <a href="#messageport0">MessagePort</a> messagePort);
};</pre>

<p>When the user agent is to <dfn id=create>create a new
<code>MessagePort</code> object</dfn> owned by a <code><a
href="#window">Window</a></code> object <var title="">owner</var>, it must
run the following steps:
<code>MessagePort</code> object</dfn> owned by a <a href="#script2">script
execution context</a> object <var title="">owner</var>, it must run the
following steps:

<ol>
<li>
<p>Instantiate a new <code><a href="#messageport0">MessagePort</a></code>
object, and let <var title="">port</var> be that object.

<li>
<p>Set the <code title=dom-MessagePort-ownerWindow><a
href="#ownerwindow">ownerWindow</a></code> attribute of <var
title="">port</var> to <var title="">owner</var>.
<p>Let <var title="">port</var>'s owner be <var title="">owner</var>.

<li>
<p>Set the <code title=dom-MessagePort-active><a

<hr>

<p>The <dfn id=ownerwindow
title=dom-MessagePort-ownerWindow><code>ownerWindow</code></dfn> attribute
must return the value it was assigned when the <code><a
href="#messageport0">MessagePort</a></code> object was created.

<p>The <dfn id=active0
title=dom-MessagePort-active><code>active</code></dfn> attribute must
return the last value that it was set to according to the rules of this
<li>
<p>Try to obtain a <var title="">new data port</var> by <a
href="#clone" title="clone a port">cloning</a> the <var title="">data
port</var> with the <a href="#ownerwindow"
title=dom-MessagePort-ownerWindow>owner</a> 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.
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>Let the <code title=dom-MessageEvent-messagePort><a
<p>Return true from the method, but continue with these steps.

<li>
<p>Wait for all scripts in the <a href="#unit-of">unit of related
browsing contexts</a> to which the <a href="#ownerwindow"
title=dom-MessagePort-ownerWindow>owner</a> of the <var title="">target
port</var> belongs to have executed to completion, and then dispatch the
event at the <var title="">target port</var> object. If this never
happens (e.g. the relevant <a href="#browsing1">browsing context</a> is
closed by the user before the event can be dispatched), then discard the
event.
<p>Wait for all scripts in the conceptual thread that the <a
href="#script2">script execution context</a> that owns the <var
title="">target port</var> belongs to have executed to completion. If
this never happens (e.g. the relevant <a href="#browsing1">browsing
context</a> is closed by the user before the event can be dispatched),
then discard the event.
</li>
<!-- XXX queue -->

<li>
<p>Dispatch the event at the <var title="">target port</var> object.
</ol>

<p class=big-issue>People often request the ability to send name/value
<p>Ports are deactivated and unentangled when the <code>Document</code>
that was the <a href="#active">active document</a> of the <a
href="#browsing1">browsing context</a> corresponding to the <code><a
href="#window">Window</a></code> object that <a href="#ownerwindow"
title=dom-MessagePort-ownerWindow>owns</a> them is <a href="#discard"
title="discard a document">discarded</a>.
href="#window">Window</a></code> object that owns them is <a
href="#discard" title="discard a document">discarded</a>.

<p>To <dfn id=deactivate>deactivate a port</dfn> <var title="">local
port</var> that is entangled with a second port <var title="">remote
47 source
<ol>

<li><p><span>Create a new <code>MessagePort</code> object</span>
owned by the <span>script browsing context</span>, and let <var
owned by the <span>script execution context</span>, and let <var
title="">port1</var> be that object.</p></li>

<li><p><span>Create a new <code>MessagePort</code> object</span>
owned by the <span>script browsing context</span>, and let <var
owned by the <span>script execution context</span>, and let <var
title="">port2</var> be that object.</p></li>

<li><p><span>Entangle</span> the <var title="">port1</var> and <var
received by the other port, and vice versa.</p>

<pre class="idl">interface <dfn>MessagePort</dfn> {
readonly attribute <span>Window</span> <span title="dom-MessagePort-ownerWindow">ownerWindow</span>;
readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
boolean <span title="dom-MessagePort-postMessage">postMessage</span>(in DOMString message);
boolean <span title="dom-MessagePort-postMessage">postMessage</span>(in DOMString message, in <span>MessagePort</span> messagePort);
};</pre>

<p>When the user agent is to <dfn>create a new
<code>MessagePort</code> object</dfn> owned by a <code>Window</code>
object <var title="">owner</var>, it must run the following
steps:</p>
<code>MessagePort</code> object</dfn> owned by a <span>script
execution context</span> object <var title="">owner</var>, it must
run the following steps:</p>

<ol>

<li><p>Instantiate a new <code>MessagePort</code> object, and let
<var title="">port</var> be that object.</p></li>

<li><p>Set the <code
title="dom-MessagePort-ownerWindow">ownerWindow</code> attribute of
<var title="">port</var> to <var title="">owner</var>.</p></li>
<li><p>Let <var title="">port</var>'s owner be <var
title="">owner</var>.</p></li>

<li><p>Set the <code title="dom-MessagePort-active">active</code>
attribute of <var title="">port</var> be false.</p></li>

<hr>

<p>The <dfn
title="dom-MessagePort-ownerWindow"><code>ownerWindow</code></dfn>
attribute must return the value it was assigned when the
<code>MessagePort</code> object was created.</p>

<p>The <dfn title="dom-MessagePort-active"><code>active</code></dfn>
attribute must return the last value that it was set to according to
the rules of this specification.</p>

<li><p>Try to obtain a <var title="">new data port</var> by <span
title="clone a port">cloning</span> the <var title="">data
port</var> with the <span
title="dom-MessagePort-ownerWindow">owner</span> 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.</p></li>
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.</p></li>

<li><p>Let the <code
title="dom-MessageEvent-messagePort">messagePort</code> attribute
<li><p>Return true from the method, but continue with these
steps.</p></li>

<li><p>Wait for all scripts in the <span>unit of related browsing
contexts</span> to which the <span
title="dom-MessagePort-ownerWindow">owner</span> of the <var
title="">target port</var> belongs to have executed to completion,
and then dispatch the event at the <var title="">target port</var>
object. If this never happens (e.g. the relevant <span>browsing
<li><p>Wait for all scripts in the conceptual thread that the
<span>script execution context</span> that owns the <var
title="">target port</var> belongs to have executed to
completion. If this never happens (e.g. the relevant <span>browsing
context</span> is closed by the user before the event can be
dispatched), then discard the event.</p></li><!-- XXX queue -->

<li><p>Dispatch the event at the <var title="">target port</var>
object.</p></li>

</ol>

<p class="big-issue">People often request the ability to send
<p>Ports are deactivated and unentangled when the
<code>Document</code> that was the <span>active document</span> of
the <span>browsing context</span> corresponding to the
<code>Window</code> object that <span
title="dom-MessagePort-ownerWindow">owns</span> them is <span
title="discard a document">discarded</span>.</p>
<code>Window</code> object that owns them is <span title="discard a
document">discarded</span>.</p>

<p>To <dfn>deactivate a port</dfn> <var title="">local port</var>
that is entangled with a second port <var title="">remote

0 comments on commit 71a6bdd

Please sign in to comment.
You can’t perform that action at this time.