Big changes to Workers and SharedWorkers to make their lifetime model easier. Move 'close' events to v2. Also, fix some omissions and xref problems that I ran across. (whatwg r3143)

Big changes to Workers and SharedWorkers to make their lifetime model
easier. Move 'close' events to v2. Also, fix some omissions and xref
problems that I ran across. (whatwg r3143)

Diffs for this change per section: 
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#clone-a-port
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#status-of-this-document
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#refused-to-allow-the-document-to-be-unloaded
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#ports-and-garbage-collection
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#messageport
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#a-vocabulary-and-associated-apis-for-html-and-xhtml
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#concept-error-handled
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#discard-a-document
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#a-browsing-context-is-discarded
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#editor-s-draft-date-1-january-1970
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#handler-messageport-onmessage
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#dom-messageport-postmessage
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#report-the-error
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#messageportarray
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#runtime-script-errors
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2301.html#controlling-the-input-stream

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2300&r2=1.2301&f=h
http://html5.org/tools/web-apps-tracker?from=3142&to=3143

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2300
retrieving revision 1.2301
diff -u -d -r1.2300 -r1.2301
--- Overview.html 27 May 2009 18:51:13 -0000 1.2300
+++ Overview.html 28 May 2009 07:01:45 -0000 1.2301
@@ -152,7 +152,7 @@
    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
    <!--ZZZ:-->
    <!--<h2 class="no-num no-toc">W3C Working Draft 23 April 2009</h2>-->
-   <h2 class="no-num no-toc" id="editor-s-draft-date-1-january-1970">Editor's Draft 27 May 2009</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-date-1-january-1970">Editor's Draft 28 May 2009</h2>
    <!--:ZZZ-->
    <dl><!-- ZZZ: update the month/day (twice), (un)comment out
     <dt>This Version:</dt>
@@ -245,7 +245,7 @@
   track.
   <!--ZZZ:-->
   <!--This specification is the 23 April 2009 Working Draft.-->
-  This specification is the 27 May 2009 Editor's Draft.
+  This specification is the 28 May 2009 Editor's Draft.
   <!--:ZZZ-->
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href="http://www.whatwg.org/">WHATWG</a>. The two specifications are
   identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of)
@@ -8442,6 +8442,20 @@
    document to be unloaded</a>, then these steps must be
    aborted.</li>
 
+   <!-- XXX should some task sources be emptied here? e.g. what about
+   timeouts that fired after this algorithm started but before the
+   list of timeouts was cleared in the previous step? or database
+   transaction callbacks that were queued after the task that started
+   this algorithm?
+
+   This is what the 'discard a document' algorithm does:
+
+     "any <span title="concept-task">tasks</span> associated with the
+     <code>Document</code> in any <span>task source</span> must be
+     removed without being run"
+
+    -->
+
    <li><p>If the document has an <span>active parser</span><!--XXX
    xref-->, then stop that parser, and throw away any pending content
    in the input stream. <span class="XXX">what about if it
@@ -41648,6 +41662,10 @@
   reference">has a strong reference of its own</a> to its
   <code>Document</code> object.</p>
 
+  <p class="note">Whenever a <code>Document</code> object is <a href="#discard-a-document" title="discard a Document">discarded</a>, it is also removed from
+  the list of <span>the worker's <code>Document</code>s</span> of each
+  worker whose list contains that <code>Document</code>.</p>
+
   <p>When <dfn id="a-browsing-context-is-discarded">a <em><span>browsing context</span></em> is
   discarded</dfn>, the strong reference from the user agent itself to
   the <a href="#browsing-context">browsing context</a> must be severed, and all the
@@ -43201,14 +43219,14 @@
   associated with a <code>Document</code>, the user agent must
   <a href="#report-the-error">report the error</a> using the <code title="handler-window-onerror"><a href="#handler-window-onerror">onerror</a></code> <a href="#event-handler-attributes-0" title="event
   handler attributes">event handler attribute</a> of the
-  <a href="#script-s-global-object">script's global object</a>. If the error is still <i title="">not handled</i> after this, then the error should be
-  reported to the user.</p>
+  <a href="#script-s-global-object">script's global object</a>. If the error is still <i title="concept-error-nothandled"><a href="#concept-error-nothandled">not handled</a></i> after this, then
+  the error should be reported to the user.</p>
 
   <hr><p>When the user agent is required to <dfn id="report-the-error" title="report the
   error">report an error</dfn> <var title="">error</var> using the
   <a href="#event-handler-attributes-0" title="event handler attributes">event handler
   attribute</a> <var title="">onerror</var>, it must run these
-  steps, after which the error is either <i title="">handled</i> or <i title="">not handled</i>:</p>
+  steps, after which the error is either <dfn id="concept-error-handled" title="concept-error-handled"><i>handled</i></dfn> or <dfn id="concept-error-nothandled" title="concept-error-nothandled"><i>not handled</i></dfn>:</p>
 
   <dl class="switch"><dt>If the value of <var title="">onerror</var> is a
    <code><a href="#function">Function</a></code></dt>
@@ -43222,8 +43240,8 @@
     the resource in which the error occurred, and the third must give
     the line number in that resource on which the error occurred.</p>
 
-    <p>If the function returns false, then the error is <i title="">handled</i>. Otherwise, the error is <i title="">not
-    handled</i>.</p>
+    <p>If the function returns false, then the error is <i title="concept-error-handled"><a href="#concept-error-handled">handled</a></i>. Otherwise, the error is
+    <i title="concept-error-nothandled"><a href="#concept-error-nothandled">not handled</a></i>.</p>
 
     <p>Any exceptions thrown or errors caused by this function must be
     reported to the user immediately after the error that the function
@@ -43236,7 +43254,7 @@
 
    <dd>
 
-    <p>The error is <i title="">not handled</i>.</p>
+    <p>The error is <i title="concept-error-nothandled"><a href="#concept-error-nothandled">not handled</a></i>.</p>
 
    </dd>
 
@@ -47183,6 +47201,10 @@
    the <code>Document</code>'s <code><a href="#window">Window</a></code> object, roll them
    back (without invoking any of the callbacks) and set <var title="">salvageable</var> to false.</p>
 
+   <li><p>Empty the <code>Document</code>'s <code><a href="#window">Window</a></code>'s
+   <a href="#list-of-active-timeouts">list of active timeouts</a> and its <a href="#list-of-active-intervals">list of active
+   intervals</a>.</li>
+
    <li><p>If <var title="">salvageable</var> and <var title="">recycle</var> are both false, <a href="#discard-a-document" title="discard a
    document">discard the <code>Document</code></a>.</li>
 
@@ -51979,23 +52001,23 @@
   received by the other port, and vice versa.<pre class="idl">typedef sequence&lt;MessagePort&gt; <dfn id="messageportarray">MessagePortArray</dfn>;
 
 interface <dfn id="messageport">MessagePort</dfn> {
-  readonly attribute boolean <a href="#dom-messageport-active" title="dom-MessagePort-active">active</a>;
-  void <a href="#dom-messageport-postmessage" title="dom-MessagePort-postMessage">postMessage</a>(in any message, [Optional] in <a href="#messageportarray">MessagePortArray</a> ports);<!--
+<!-- v2-onclose  readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
+-->  void <a href="#dom-messageport-postmessage" title="dom-MessagePort-postMessage">postMessage</a>(in any message, [Optional] in <a href="#messageportarray">MessagePortArray</a> ports);<!--
   <span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(in any message);-->
   void <a href="#dom-messageport-start" title="dom-MessagePort-start">start</a>();
   void <a href="#dom-messageport-close" title="dom-MessagePort-close">close</a>();
 
   // event handler attributes
            attribute <a href="#function">Function</a> <a href="#handler-messageport-onmessage" title="handler-MessagePort-onmessage">onmessage</a>;
-};</pre><dl class="domintro"><dt><var title="">port</var> . <code title="dom-MessagePort-active"><a href="#dom-messageport-active">active</a></code></dt>
+};</pre><dl class="domintro"><!-- v2-onclose
+   <dt><var title="">port</var> . <code title="dom-MessagePort-active">active</code></dt>
 
    <dd>
 
     <p>Returns true if the port is still active; otherwise, returns false.</p>
 
    </dd>
-
-   <dt><var title="">port</var> . <code title="dom-MessagePort-poseMessage">postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
+--><dt><var title="">port</var> . <code title="dom-MessagePort-poseMessage">postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
 
    <dd>
 
@@ -52090,11 +52112,13 @@
    <li><p>Return <var title="">new port</var>. It is the
    clone.</li>
 
-  </ol><hr><p>The <dfn id="dom-messageport-active" title="dom-MessagePort-active"><code>active</code></dfn>
+  </ol><hr><!-- v2-onclose
+  <p>The <dfn title="dom-MessagePort-active"><code>active</code></dfn>
   attribute must return true if the port is entangled, and false
   otherwise.</p>
 
-  <hr><p>The <dfn id="dom-messageport-postmessage" title="dom-MessagePort-postMessage"><code>postMessage()</code></dfn>
+  <hr>
+--><p>The <dfn id="dom-messageport-postmessage" title="dom-MessagePort-postMessage"><code>postMessage()</code></dfn>
   method, when called on a port <var title="">source port</var>, must
   cause the user agent to run the following steps:</p>
 
@@ -52258,9 +52282,11 @@
 
   <h5 id="ports-and-garbage-collection"><span class="secno">8.3.3.1 </span>Ports and garbage collection</h5>
 
-  <p>User agents must act as if <code><a href="#messageport">MessagePort</a></code> objects have
-  a strong reference to their entangled <code><a href="#messageport">MessagePort</a></code>
-  object.</p>
+  <p>User agents must either act as if <code><a href="#messageport">MessagePort</a></code>
+  objects have a strong reference to their entangled
+  <code><a href="#messageport">MessagePort</a></code> object or as if each
+  <code><a href="#messageport">MessagePort</a></code> object's owner has a strong reference to
+  the <code><a href="#messageport">MessagePort</a></code> object.</p>
 
   <div class="note">
 
@@ -52269,7 +52295,7 @@
    receive a message, the channel will be maintained.</p>
 
    <p>Of course, if this was to occur on both sides of the channel,
-   then both ports would be garbage collected, since they would not be
+   then both ports could be garbage collected, since they would not be
    reachable from live code, despite having a strong reference to each
    other.</p>
 
@@ -52282,7 +52308,7 @@
   <code><a href="#messageport">MessagePort</a></code> object's <a href="#port-message-queue">port message queue</a> is
   open and there exists a <code title="event-message"><a href="#event-message">message</a></code>
   event in that queue.</p>
-  <!-- we might not need to explicitly say the first part of DOM
+  <!-- we might not need to explicitly say the first part if DOM
   Events is fixed to say that events on a task queue prevent GC -->
 
   <!-- XXX what about ports in the ports attribute of a MessageEvent

Received on Thursday, 28 May 2009 07:03:59 UTC