[html5] r2024 - [] (0) Simplify garbage collection for ports even further. Define dicarding of D [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Aug 6 00:57:33 PDT 2008


Author: ianh
Date: 2008-08-06 00:57:32 -0700 (Wed, 06 Aug 2008)
New Revision: 2024

Modified:
   index
   source
Log:
[] (0) Simplify garbage collection for ports even further. Define dicarding of Document objects better for ports. Prevent inactive documents from receiving messages.

Modified: index
===================================================================
--- index	2008-08-06 07:24:38 UTC (rev 2023)
+++ index	2008-08-06 07:57:32 UTC (rev 2024)
@@ -44002,6 +44002,17 @@
    href="#messageport0">MessagePort</a></code> object, and remove the event
    from the queue.
 
+  <p>If the <code><a href="#messageport0">MessagePort</a></code> is owned by
+   a <code><a href="#window">Window</a></code> object and the
+   <code>Document</code> that was the <a href="#active">active document</a>
+   in that <a href="#browsing1">browsing context</a> when the <code><a
+   href="#messageport0">MessagePort</a></code> was created is not <a
+   href="#fully">fully active</a>, then an opportunity doesn't exist —
+   events in such cases must only be dispatched once the
+   <code>Document</code> in question becomes <a href="#fully">fully
+   active</a>. If that doesn't happen before that <code>Document</code> is
+   discarded, then the events are lost.
+
   <hr>
 
   <p>The <dfn id=close3
@@ -44080,12 +44091,43 @@
 
   <h5 id=ports><span class=secno>7.5.3.1. </span>Ports and browsing contexts</h5>
 
-  <p>Ports are 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 owns them is <a href="#discard" title="discard a
-   document">discarded</a>.
+  <p>When a <code>Document</code> is <a href="#discard" title="discard a
+   document">discarded</a>, if there are any <code><a
+   href="#messageport0">MessagePort</a></code> objects that:
 
+  <ul class=brief>
+   <li>are entangled, and
+
+   <li>are owned by the <a href="#browsing1">browsing context</a> that
+    contained that <code>Document</code>, and
+
+   <li>were created while that <code>Document</code> was the <a
+    href="#active">active document</a> of that <a href="#browsing1">browsing
+    context</a>, and
+
+   <li>are entangled with a port that is either not owned by that <a
+    href="#browsing1">browsing context</a> or was not created while that
+    <code>Document</code> was the <a href="#active">active document</a> of
+    that <a href="#browsing1">browsing context</a>,
+  </ul>
+
+  <p>...then the user agent must run the following steps for each such port:
+
+  <ol>
+   <li>
+    <p>Let <var title="">surviving port</var> be the port with which the
+     <code><a href="#messageport0">MessagePort</a></code> object in question
+     is entangled.
+
+   <li>
+    <p>Unentangle the two ports.</p>
+
+   <li>At the next available opportunity, after any scripts have finished
+    executing<!-- XXX queue -->, <a href="#firing2">fire a simple event</a>
+    called <code title=event-unload>unload</code> at <var title="">surviving
+    port</var>.
+  </ol>
+
   <h5 id=ports0><span class=secno>7.5.3.2. </span>Ports and garbage
    collection</h5>
 
@@ -44104,12 +44146,6 @@
     live code, despite having a strong reference to each other.</p>
   </div>
 
-  <p>When an entangled message port is about to be garbage collected, it must
-   be unentangled. Because of the aforementioned strong reference, this can
-   only happen if either both ports are about to be garbage collected as a
-   pair, or if the entire <a href="#script2">script execution context</a> of
-   the port is being discarded.
-
   <h2 id=syntax><span class=secno>8. </span>The HTML syntax</h2>
 
   <h3 id=writing0><span class=secno>8.1 </span>Writing HTML documents</h3>

Modified: source
===================================================================
--- source	2008-08-06 07:24:38 UTC (rev 2023)
+++ source	2008-08-06 07:57:32 UTC (rev 2024)
@@ -41406,6 +41406,16 @@
   <code>MessagePort</code> object, and remove the event from the
   queue.</p>
 
+  <p>If the <code>MessagePort</code> is owned by a <code>Window</code>
+  object and the <code>Document</code> that was the <span>active
+  document</span> in that <span>browsing context</span> when the
+  <code>MessagePort</code> was created is not <span>fully
+  active</span>, then an opportunity doesn't exist — events in
+  such cases must only be dispatched once the <code>Document</code> in
+  question becomes <span>fully active</span>. If that doesn't happen
+  before that <code>Document</code> is discarded, then the events are
+  lost.</p>
+
   <hr>
 
   <p>The <dfn title="dom-MessagePort-close"><code>close()</code></dfn>
@@ -41486,13 +41496,37 @@
 
   <h5>Ports and browsing contexts</h5>
 
-  <p>Ports are 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 owns them is
-  <span title="discard a document">discarded</span>.</p>
+  <p>When a <code>Document</code> is <span title="discard a
+  document">discarded</span>, if there are any
+  <code>MessagePort</code> objects that:</p>
 
+  <ul class="brief">
+   <li>are entangled, and</li>
+   <li>are owned by the <span>browsing context</span> that contained that <code>Document</code>, and</li>
+   <li>were created while that <code>Document</code> was the <span>active document</span> of that <span>browsing context</span>, and</li>
+   <li>are entangled with a port that is either not owned by that <span>browsing context</span> or was not created while that <code>Document</code> was the <span>active document</span> of that <span>browsing context</span>,</li>
+  </ul>
 
+  <p>...then the user agent must run the following steps for each such
+  port:</p>
 
+  <ol>
+
+   <li><p>Let <var title="">surviving port</var> be the port with
+   which the <code>MessagePort</code> object in question is
+   entangled.</p></li>
+
+   <li><p>Unentangle the two ports.</p></p>
+
+   <li>At the next available opportunity, after any scripts have
+   finished executing<!-- XXX queue -->, <span>fire a simple
+   event</span> called <code title="event-unload">unload</code> at
+   <var title="">surviving port</var>.</p>
+
+  </ol>
+
+
+
   <h5>Ports and garbage collection</h5>
 
   <p>User agents must act as if <code>MessagePort</code> objects have
@@ -41512,18 +41546,8 @@
 
   </div>
 
-  <p>When an entangled message port is about to be garbage collected,
-  it must be unentangled. Because of the aforementioned strong
-  reference, this can only happen if either both ports are about to be
-  garbage collected as a pair, or if the entire <span>script execution
-  context</span> of the port is being discarded.</p>
 
 
-
-
-
-
-
   <h2 id="syntax">The HTML syntax</h2>
 
   <h3>Writing HTML documents</h3>




More information about the Commit-Watchers mailing list