html5/spec Overview.html,1.4112,1.4113

Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv19431

Modified Files:
	Overview.html 
Log Message:
An attempt at making non-parser scripts inserted while the parser is running fail at document.write() rather than blowing away the document. (whatwg r5157)

Index: Overview.html
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4112
retrieving revision 1.4113
diff -u -d -r1.4112 -r1.4113
--- Overview.html	14 Jul 2010 00:45:58 -0000	1.4112
+++ Overview.html	14 Jul 2010 02:02:47 -0000	1.4113
@@ -9663,6 +9663,14 @@
 
    <li>
 
+    <p>If the <a href="#insertion-point">insertion point</a> is undefined and the
+    <code><a href="#document">Document</a></code> has the <a href="#write-neutralised">"write-neutralised"</a>
+    flag set, then abort these steps.</p>
+
+   </li>
+
+   <li>
+
     <p>If the <a href="#insertion-point">insertion point</a> is undefined, the <code title="dom-document-open"><a href="#dom-document-open">open()</a></code> method must be called
     (with no arguments) on the <code title="Document"><a href="#document">document</a></code>
     object. If the user <a href="#refused-to-allow-the-document-to-be-unloaded">refused to allow the document to be
@@ -11869,7 +11877,16 @@
   <a href="#parser-inserted">"parser-inserted"</a>, to let the parser know when to
   execute the script.</p>
 
-  <p>The fourth and fifth pieces of state are <dfn id="the-script-block-s-type"><var>the script
+  <p>The fourth is a flag indicating whether or not the script block
+  is <dfn id="write-neutralised">"write-neutralised"</dfn>. Initially, <code><a href="#script">script</a></code>
+  elements must have this flag unset (script blocks, when created, are
+  not "write-neutralised"). This flag is used to ensure that scripts
+  <em>not</em> inserted by the parser but inserted while a parser is
+  active do not blow away the document if they use the <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code>
+  API. <code><a href="#document">Document</a></code> objects can also have this flag set; it's
+  propagated to the <code><a href="#document">Document</a></code> when the script runs.</p>
+
+  <p>The fifth and sixth pieces of state are <dfn id="the-script-block-s-type"><var>the script
   block's type</var></dfn> and <dfn id="the-script-block-s-character-encoding"><var>the script block's character
   encoding</var></dfn>. They are determined when the script is run,
   based on the attributes on the element at that time.</p>
@@ -11988,6 +12005,16 @@
 
    </li>
 
+   <li>
+
+    <p>If the element's <code><a href="#document">Document</a></code> has an <a href="#active-parser">active
+    parser</a>, and the parser's <a href="#script-nesting-level">script nesting level</a>
+    is non-zero, but this <code><a href="#script">script</a></code> element does not have
+    the <a href="#parser-inserted">"parser-inserted"</a> flag set, the user agent must
+    set the element's <a href="#write-neutralised">"write-neutralised"</a> flag.</p>
+
+   </li>
+
    <li id="script-processing-src-prepare">
 
     <p>If the element has a <code title="attr-script-src"><a href="#attr-script-src">src</a></code>
@@ -12230,6 +12257,23 @@
 
      <li>
 
+      <p>If the <code><a href="#script">script</a></code> element's
+      <a href="#write-neutralised">"write-neutralised"</a> flag is set, then flag the
+      <code><a href="#document">Document</a></code> the <code><a href="#script">script</a></code> element was in
+      when the <a href="#write-neutralised">"write-neutralised"</a> flag was set as being
+      itself <a href="#write-neutralised">"write-neutralised"</a>. Let <var title="">neutralised doc</var> be that
+      <code><a href="#document">Document</a></code>.</p>
+
+      <!-- theorem: this can only happen when the parser nesting
+      levels of all parsers on this thread are zero, so any scripts
+      inserted while this is true will not themselves have the flag
+      said, so we don't have to worry about this being a counter
+      instead of just a boolean. -->
+
+     </li>
+
+     <li>
+
       <p><a href="#create-a-script-from-a-node" title="create a script from a node">Create a
       script</a> from the <code><a href="#script">script</a></code> element node, using
       <var><a href="#the-script-block-s-source">the script block's source</a></var> and <var><a href="#the-script-block-s-type">the script
@@ -12242,6 +12286,13 @@
 
      <li>
 
+      <p>Remove the <a href="#write-neutralised">"write-neutralised"</a> flag from <var title="">neutralised doc</var>, if it was set in the earlier
+      step.</p>
+
+     </li>
+
+     <li>
+
       <p>If the script is from an external file, <a href="#fire-a-simple-event">fire a simple
       event</a> named <code title="event-load">load</code> at the
       <code><a href="#script">script</a></code> element.</p>

Received on Wednesday, 14 July 2010 02:02:53 UTC