2009/dap/file-system file-writer.html,1.19,1.20

Update of /sources/public/2009/dap/file-system
In directory hutz:/tmp/cvs-serv29500

Modified Files:
	file-writer.html 
Log Message:
Fixed abort sequence to remove a race condition.  See "small tweak to
FileWriter's event sequences" on public-webapps.


Index: file-writer.html
===================================================================
RCS file: /sources/public/2009/dap/file-system/file-writer.html,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- file-writer.html	23 Sep 2010 22:10:25 -0000	1.19
+++ file-writer.html	28 Sep 2010 21:48:51 -0000	1.20
@@ -309,16 +309,17 @@
             When the <code>abort</code> method is called, <a>user agents</a>
             MUST run the steps below:<!-->TODO: refs<-->
             <ol>
-              <li>If <code>readyState</code> is <code>DONE</code>, throw a
-              <code>FileException</code> with error code
-              <code>INVALID_STATE_ERR</code> and terminate this overall series
-              of steps.</li>
-              <li>Set readyState to DONE.</li>
+              <li>If <code>readyState</code> is <code>DONE</code> or
+              <code>INIT</code>, throw a <code>FileException</code> with error
+              code <code>INVALID_STATE_ERR</code> and terminate this overall
+              series of steps.</li>
               <li>Terminate any steps having to do with writing a file.</li>
-              <li>Dispatch a progress event called error. Set the error
-              attribute to a FileError object with the appropriate code (in this
-              case, ABORT_ERR; see error conditions).</li>
+              <li>Set the error attribute to a FileError object with the
+              appropriate code (in this case, ABORT_ERR; see error
+              conditions).</li>
+              <li>Dispatch a progress event called error.</li>
               <li>Dispatch a progress event called abort</li>
+              <li>Set readyState to <code>DONE</code>.</li>
               <li>Dispatch a progress event called writeend</li>
               <li>Stop dispatching any further progress events.</li>
             </ol>
@@ -436,15 +437,15 @@
         </p>
         <ol>
           <li>Set <code>readyState</code> to <code>WRITING</code>.</li>
-          <li>If an error occurs during file write, set
-            <code>readyState</code> to <code>DONE</code>.
-            Proceed to the error steps below.
+          <li>If an error occurs during file write, proceed to the error steps
+          below.
               <ol>
-                <li>Dispatch a progress event called <code>error</code>.  Set
-                  the <code>error</code> attribute; on getting the
-                  <code>error</code> attribute MUST be a
-                  <code>FileError</code> object with a valid error code that
-                  indicates the kind of file error that has occurred.</li>
+                <li>Set the <code>error</code> attribute; on getting the
+                <code>error</code> attribute MUST be a <code>FileError</code>
+                object with a valid error code that indicates the kind of file
+                error that has occurred.</li>
+                <li>Dispatch a progress event called <code>error</code>.</li>
+                <li>Set readyState to <code>DONE</code>.</li>
                 <li>Dispatch a progress event called <code>writeend</code>.</li>
                 <li>Terminate this overall set of steps.</li>
               </ol>
@@ -452,12 +453,14 @@
           <li>Queue a task to dispatch a progress event called
             <code>writestart</code>.</li>
           <li>Make progress notifications.</li>
-          <li>When the data has been fully written, set
-            <code>readyState</code> to <code>DONE</code>.
+          <li>When the data has been fully written:
+            <ol>
+              <li>Dispatch a progress event called <code>write</code></li>
+              <li>Set readyState to <code>DONE</code>.</li>
+              <li>Dispatch a progress event called <code>writeend</code></li>
+              <li>Terminate this overall set of steps.</li>
+            </ol>
           </li>
-          <li>Dispatch a progress event called <code>write</code></li>
-          <li>Dispatch a progress event called <code>writeend</code></li>
-          <li>Terminate this overall set of steps.</li>
         </ol>
       </section>
       <section>
@@ -572,24 +575,22 @@
               <code>INVALID_STATE_ERR</code> and terminate this overall series
               of steps.</li>
               <li>Set <code>readyState</code> to <code>WRITING</code>.</li>
-              <li>If an error occurs during file write, set
-                <code>readyState</code> to <code>DONE</code>.
-                Proceed to the error steps below.
-                  <ol>
-                    <li>
-                      Dispatch a progress event called <code>error</code>.  Set
-                      the <code>error</code> attribute; on getting the
-                      <code>error</code> attribute MUST be a
-                      <code>FileError</code> object with a valid error code that
-                      indicates the kind of file
-                      error that has occurred.</li>
-                    <li>Dispatch a progress event called
-                      <code>writeend</code></li>
-                    <li>On getting, the <code>length</code> and
-                      <code>position</code> attributes SHOULD indicate any
-                      fractional data successfully written to the file.</li>
-                    <li>Terminate this overall set of steps.</li>
-                  </ol>
+              <li>If an error occurs during file write, proceed to the error
+              steps below.
+                <ol>
+                  <li>Set the <code>error</code> attribute; on getting the
+                  <code>error</code> attribute MUST be a <code>FileError</code>
+                  object with a valid error code that indicates the kind of file
+                  error that has occurred.</li>
+                  <li>Dispatch a progress event called <code>error</code>.</li>
+                  <li>Set readyState to <code>DONE</code>.</li>
+                  <li>Dispatch a progress event called
+                    <code>writeend</code></li>
+                  <li>On getting, the <code>length</code> and
+                    <code>position</code> attributes SHOULD indicate any
+                    fractional data successfully written to the file.</li>
+                  <li>Terminate this overall set of steps.</li>
+                </ol>
               </li>
               <li>Queue a task to dispatch a progress event called
                 <code>writestart</code>.</li>
@@ -598,15 +599,18 @@
                 <code>position</code> attributes SHOULD indicate the progress
                 made in writing the file as of the last progress notification.
               </li>
-              <li>When the data has been fully written, set
-                <code>readyState</code> to <code>DONE</code>.  Upon successful
-                completion, <code>position</code> and <code>length</code> MUST
-                indicate an increase of <code>data.size</code> over their
-                pre-write states, indicating the change to the underlying file.
-              </li>
-              <li>Dispatch a progress event called <code>write</code></li>
-              <li>Dispatch a progress event called <code>writeend</code></li>
-              <li>Terminate this overall set of steps.</li>
+              <li>Upon successful completion:
+                <ol>
+                  <li><code>position</code> and <code>length</code> MUST
+                  indicate an increase of <code>data.size</code> over their
+                  pre-write states, indicating the change to the underlying
+                  file.</li>
+                  <li>Dispatch a progress event called <code>write</code></li>
+                  <li>Set readyState to <code>DONE</code>.</li>
+                  <li>Dispatch a progress event called
+                    <code>writeend</code></li>
+                  <li>Terminate this overall set of steps.</li>
+                </ol>
             </ol>
           </p>
           <dl class='parameters'>
@@ -668,15 +672,15 @@
             <code>INVALID_STATE_ERR</code> and terminate this overall series of
             steps.</li>
             <li>Set <code>readyState</code> to <code>WRITING</code>.</li>
-            <li>If an error occurs during truncate, set
-              <code>readyState</code> to <code>DONE</code>.
-              Proceed to the error steps below.
+            <li>If an error occurs during truncate, proceed to the error steps
+              below.
                 <ol>
-                  <li>Dispatch a progress event called <code>error</code>.  Set
-                    the <code>error</code> attribute; on getting the
-                    <code>error</code> attribute MUST be a
-                    <code>FileError</code> object with a valid error code that
-                    indicates the kind of file error that has occurred.</li>
+                  <li>Set the <code>error</code> attribute; on getting the
+                  <code>error</code> attribute MUST be a <code>FileError</code>
+                  object with a valid error code that indicates the kind of file
+                  error that has occurred.</li>
+                  <li>Dispatch a progress event called <code>error</code>.</li>
+                  <li>Set readyState to <code>DONE</code>.</li>
                   <li>Dispatch a progress event called
                     <code>writeend</code></li>
                   <li>On getting, the <code>length</code> and
@@ -687,9 +691,7 @@
             </li>
             <li>Queue a task to dispatch a progress event called
               <code>writestart</code>.</li>
-            <li>When the file has been truncated, set
-            <code>readyState</code> to <code>DONE</code>.
-            <br />Upon successful completion:
+            <li>Upon successful completion:
               <ul>
                 <li><code>length</code> MUST be equal to <code>size</code>.</li>
                 <li><code>position</code> MUST be the lesser of
@@ -698,11 +700,12 @@
                     <li><code>size</code>.</li>
                   </ul>
                 </li>
+                <li>Dispatch a progress event called <code>write</code></li>
+                <li>Set readyState to <code>DONE</code>.</li>
+                <li>Dispatch a progress event called <code>writeend</code></li>
+                <li>Terminate this overall set of steps.</li>
               </ul>
             </li>
-            <li>Dispatch a progress event called <code>write</code></li>
-            <li>Dispatch a progress event called <code>writeend</code></li>
-            <li>Terminate this overall set of steps.</li>
           </ol>
           </p>
           <dl class='parameters'>

Received on Tuesday, 28 September 2010 21:48:56 UTC