spec/Overview.html 1.1212 2024 Simplify garbage collection for ports ev

Simplify garbage collection for ports even further. Define dicarding of
Document objects better for ports. Prevent inactive documents from
receiving messages. (whatwg r2024)

8.1 Writing HTML documents
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1212.html#writing0
close()
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1212.html#close3
onunload
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1212.html#onunload0
start()
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1212.html#start6
8. The HTML syntax
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1212.html#syntax
7.5.3.1. Ports and browsing contexts
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1212.html#ports
7.5.3.2. Ports and garbage collection
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1212.html#ports0

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.1211&r2=1.1212&f=h
http://html5.org/tools/web-apps-tracker?from=2023&to=2024

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.1211
retrieving revision 1.1212
diff -u -d -r1.1211 -r1.1212
--- Overview.html 6 Aug 2008 07:25:14 -0000 1.1211
+++ Overview.html 6 Aug 2008 07:57:36 -0000 1.1212
@@ -44024,6 +44024,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 &mdash;
+   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
@@ -44102,11 +44113,42 @@
 
   <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>
@@ -44126,12 +44168,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>

Received on Wednesday, 6 August 2008 08:01:05 UTC