[html5] r1883 - [] (0) Fire 'unload' on a message port if it is .close()d or if its other end is [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Jul 16 14:11:49 PDT 2008


Author: ianh
Date: 2008-07-16 14:11:48 -0700 (Wed, 16 Jul 2008)
New Revision: 1883

Modified:
   index
   source
Log:
[] (0) Fire 'unload' on a message port if it is .close()d or if its other end is garbage collected.

Modified: index
===================================================================
--- index	2008-07-16 20:02:32 UTC (rev 1882)
+++ index	2008-07-16 21:11:48 UTC (rev 1883)
@@ -1645,10 +1645,13 @@
        <li><a href="#message0"><span class=secno>7.5.3 </span>Message
         ports</a>
         <ul class=toc>
-         <li><a href="#ports"><span class=secno>7.5.3.1. </span>Ports and
+         <li><a href="#unentangling"><span class=secno>7.5.3.1.
+          </span>Unentangling</a>
+
+         <li><a href="#ports"><span class=secno>7.5.3.2. </span>Ports and
           browsing contexts</a>
 
-         <li><a href="#ports0"><span class=secno>7.5.3.2. </span>Ports and
+         <li><a href="#ports0"><span class=secno>7.5.3.3. </span>Ports and
           garbage collection</a>
         </ul>
       </ul>
@@ -35216,8 +35219,8 @@
    message ports</a>, if the document is the <a href="#active">active
    document</a>, or otherwise any ports in that document's <a
    href="#list-of3">list of message ports</a>, if the document is not the <a
-   href="#active">active document</a>, must be <span>deactivated</span> and
-   unentangled.
+   href="#active">active document</a>, must be <span>unentangled with
+   prejudice</span>.
 
   <p class=big-issue>Also, <code title=event-unload>unload</code> events
    should fire.
@@ -42317,7 +42320,7 @@
 
    <li>
     <p>Wait for all scripts in the <a href="#unit-of">unit of related
-     browsing contexts</a> to which the the <code><a
+     browsing contexts</a> to which the <code><a
      href="#window">Window</a></code> object on which the method was invoked
      belongs to have finished executing any pending scripts.</p>
     <!-- XXX define this in terms of the
@@ -42404,7 +42407,7 @@
 
    <li>
     <p>Wait for all scripts in the <a href="#unit-of">unit of related
-     browsing contexts</a> to which the the <code><a
+     browsing contexts</a> to which the <code><a
      href="#window">Window</a></code> object on which the method was invoked
      belongs to have finished executing any pending scripts.</p>
     <!-- XXX define this in terms of the
@@ -42746,7 +42749,7 @@
 
    <li>
     <p>Wait for all scripts in the <a href="#unit-of">unit of related
-     browsing contexts</a> to which the the <a href="#ownerwindow"
+     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
@@ -42761,35 +42764,11 @@
 
   <p>The <dfn id=close2
    title=dom-MessagePort-close><code>close()</code></dfn> method, when called
-   on a port <var title="">local port</var>, must cause the user agent to run
-   the following steps:
+   on a port <var title="">local port</var> that is entangled with another
+   port, must cause the <var title="">local port</var> to be
+   <span>unentangled with prejudice</span>. If the method is called on a port
+   that is not entangled, then the method must do nothing.
 
-  <ol>
-   <li>
-    <p>If <var title="">local port</var> is entangled with another port, then
-     let <var title="">remote port</var> be that port and run these substeps:</p>
-
-    <ol>
-     <li>
-      <p>Unentangle <var title="">remote port</var>, so that it is no longer
-       entangled with any ports.
-
-     <li>
-      <p>Set the <code title=dom-MessagePort-active><a
-       href="#active0">active</a></code> attribute of <var title="">remote
-       port</var> to false.
-
-     <li>
-      <p>Unentangle <var title="">local port</var>, so that it is no longer
-       entangled with any ports.
-    </ol>
-
-   <li>
-    <p>Set the <code title=dom-MessagePort-active><a
-     href="#active0">active</a></code> attribute of <var title="">local
-     port</var> to false.
-  </ol>
-
   <hr>
 
   <p>The following are the <a href="#event4">event handler DOM attributes</a>
@@ -42832,14 +42811,39 @@
   </dl>
 
   <p class=note>Nothing in this specification causes any <code
-   title=event-load><a href="#load0">load</a></code>, <code
-   title=event-error><a href="#error1">error</a></code>, or <code
-   title=event-unload>unload</code> events to be targetted at a <code><a
-   href="#messageport0">MessagePort</a></code> object. This feature is
-   intended for use with Workers. <a href="#refsWORKERS">[WORKERS]</a>
+   title=event-load><a href="#load0">load</a></code> or <code
+   title=event-error><a href="#error1">error</a></code> events to be
+   targetted at a <code><a href="#messageport0">MessagePort</a></code>
+   object. Those features are intended for use with Workers. <a
+   href="#refsWORKERS">[WORKERS]</a>
 
-  <h5 id=ports><span class=secno>7.5.3.1. </span>Ports and browsing contexts</h5>
+  <h5 id=unentangling><span class=secno>7.5.3.1. </span>Unentangling</h5>
 
+  <p>A message port is entangled and unentangled as part of the normal
+   processing of message channels. When a channel is closed permanently but
+   in a controlled fashion, however, the user agent will be required to <dfn
+   id=unentangle title="unentangle with prejudice">unentangle a port with
+   prejudice</dfn>, which means it must run the following steps:
+
+  <ol>
+   <li>
+    <p>Unentangle the two ports.
+
+   <li>
+    <p>Set both ports' <code title=dom-messageport-active><a
+     href="#active0">active</a></code> attribute to false.
+
+   <li>
+    <p>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 each of the message
+     ports. If the two message ports are in the same <a href="#unit-of">unit
+     of related browsing contexts</a>, then the port being unentangled with
+     prejudice must receive the event first.
+  </ol>
+
+  <h5 id=ports><span class=secno>7.5.3.2. </span>Ports and browsing contexts</h5>
+
   <p>During <a href="#traverse" title="traverse the history">session history
    traversal</a> (e.g. when a user <a href="#navigate"
    title=navigate>navigates</a> a <a href="#browsing1">browsing context</a>
@@ -42871,7 +42875,7 @@
    href="#active0">active</a></code> attribute of the port's entangled port,
    not its own attribute.
 
-  <h5 id=ports0><span class=secno>7.5.3.2. </span>Ports and garbage
+  <h5 id=ports0><span class=secno>7.5.3.3. </span>Ports and garbage
    collection</h5>
 
   <p>User agents must act as if <code><a
@@ -42893,10 +42897,10 @@
   </div>
 
   <p>When an entangled message port is about to be garbage collected, it must
-   be <a href="#deactivate" title="deactivate a port">deactivated</a> and
-   then unentangled, so that the two ports are no longer related and so that
-   the other port's <code title=dom-MessagePort-active><a
-   href="#active0">active</a></code> attribute is set to false.
+   be <span>unentangled with prejudice</span>, so that the two ports are no
+   longer related and so that the other port's <code
+   title=dom-MessagePort-active><a href="#active0">active</a></code>
+   attribute is set to false.
 
   <h2 id=syntax><span class=secno>8. </span>The HTML syntax</h2>
 

Modified: source
===================================================================
--- source	2008-07-16 20:02:32 UTC (rev 1882)
+++ source	2008-07-16 21:11:48 UTC (rev 1883)
@@ -32861,8 +32861,8 @@
   message ports</span>, if the document is the <span>active
   document</span>, or otherwise any ports in that document's
   <span>list of message ports</span>, if the document is not the
-  <span>active document</span>, must be <span>deactivated</span> and
-  unentangled.</p>
+  <span>active document</span>, must be <span>unentangled with
+  prejudice</span>.</p>
 
   <p class="big-issue">Also, <code title="event-unload">unload</code>
   events should fire.</p>
@@ -39970,7 +39970,7 @@
    <li>
 
     <p>Wait for all scripts in the <span>unit of related browsing
-    contexts</span> to which the the <code>Window</code> object on
+    contexts</span> to which the <code>Window</code> object on
     which the method was invoked belongs to have finished executing
     any pending scripts.</p> <!-- XXX define this in terms of the
     event queue -->
@@ -40080,7 +40080,7 @@
    <li>
 
     <p>Wait for all scripts in the <span>unit of related browsing
-    contexts</span> to which the the <code>Window</code> object on
+    contexts</span> to which the <code>Window</code> object on
     which the method was invoked belongs to have finished executing
     any pending scripts.</p> <!-- XXX define this in terms of the
     event queue -->
@@ -40414,7 +40414,7 @@
    steps.</p></li>
 
    <li><p>Wait for all scripts in the <span>unit of related browsing
-   contexts</span> to which the the <span
+   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>
@@ -40427,37 +40427,12 @@
   <hr>
 
   <p>The <dfn title="dom-MessagePort-close"><code>close()</code></dfn>
-  method, when called on a port <var title="">local port</var>, must
-  cause the user agent to run the following steps:</p>
+  method, when called on a port <var title="">local port</var> that is
+  entangled with another port, must cause the <var title="">local
+  port</var> to be <span>unentangled with prejudice</span>. If the
+  method is called on a port that is not entangled, then the method
+  must do nothing.</p>
 
-  <ol>
-
-   <li>
-
-    <p>If <var title="">local port</var> is entangled with another
-    port, then let <var title="">remote port</var> be that port and
-    run these substeps:</p>
-
-    <ol>
-
-     <li><p>Unentangle <var title="">remote port</var>, so that it is
-     no longer entangled with any ports.</p></li>
-
-     <li><p>Set the <code title="dom-MessagePort-active">active</code>
-     attribute of <var title="">remote port</var> to false.</p></li>
-
-     <li><p>Unentangle <var title="">local port</var>, so that it is
-     no longer entangled with any ports.</p></li>
-
-    </ol>
-
-   </li>
-
-   <li><p>Set the <code title="dom-MessagePort-active">active</code>
-   attribute of <var title="">local port</var> to false.</p></li>
-
-  </ol>
-
   <hr>
 
   <p>The following are the <span>event handler DOM attributes</span>
@@ -40493,14 +40468,41 @@
   </dl>
 
   <p class="note">Nothing in this specification causes any <code
-  title="event-load">load</code>, <code
-  title="event-error">error</code>, or <code
-  title="event-unload">unload</code> events to be targetted at a
-  <code>MessagePort</code> object. This feature is intended for use
+  title="event-load">load</code> or <code
+  title="event-error">error</code> events to be targetted at a
+  <code>MessagePort</code> object. Those features are intended for use
   with Workers. <a href="#refsWORKERS">[WORKERS]</a></p>
 
 
 
+  <h5>Unentangling</h5>
+
+  <p>A message port is entangled and unentangled as part of the normal
+  processing of message channels. When a channel is closed permanently
+  but in a controlled fashion, however, the user agent will be
+  required to <dfn title="unentangle with prejudice">unentangle a port
+  with prejudice</dfn>, which means it must run the following
+  steps:</p>
+
+  <ol>
+
+   <li><p>Unentangle the two ports.</p></li>
+
+   <li><p>Set both ports' <code
+   title="dom-messageport-active">active</code> attribute to
+   false.</p></li>
+
+   <li><p>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
+   each of the message ports. If the two message ports are in the same
+   <span>unit of related browsing contexts</span>, then the port being
+   unentangled with prejudice must receive the event first.</p></li>
+
+  </ol>
+
+
+
   <h5>Ports and browsing contexts</h5>
 
   <p>During <span title="traverse the history">session history
@@ -40559,9 +40561,8 @@
   </div>
 
   <p>When an entangled message port is about to be garbage collected,
-  it must be <span title="deactivate a port">deactivated</span> and
-  then unentangled, so that the two ports are no longer related and so
-  that the other port's <code
+  it must be <span>unentangled with prejudice</span>, so that the two
+  ports are no longer related and so that the other port's <code
   title="dom-MessagePort-active">active</code> attribute is set to
   false.</p>
 




More information about the Commit-Watchers mailing list