- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 15 Jan 2009 22:12:03 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv4948
Modified Files:
Overview.html
Log Message:
Mute hashchanged until after the load event has fired, to avoid race conditions. Make pushState() objects survive a reload. (whatwg r2671)
Index: Overview.html
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.1840
retrieving revision 1.1841
diff -u -d -r1.1840 -r1.1841
--- Overview.html 15 Jan 2009 00:58:19 -0000 1.1840
+++ Overview.html 15 Jan 2009 22:12:00 -0000 1.1841
@@ -5107,7 +5107,8 @@
changed to "complete" when the parser reaches the end of its input
stream.</p><!-- XXX this should be in its own section, and we
should define 'delay the load event' for XML parsing so that we can
- have the "interactive" state here too. --><p>The <dfn id=dom-document-readystate title=dom-document-readyState><code>readyState</code></dfn> DOM
+ have the "interactive" state here too. also, XML parser will need to
+ fire the /pending state object/, and the 'load' event, and... --><p>The <dfn id=dom-document-readystate title=dom-document-readyState><code>readyState</code></dfn> DOM
attribute must, on getting, return the <a href=#current-document-readiness>current document
readiness</a>.<h4 id=dom-tree-accessors><span class=secno>3.2.4 </span><dfn>DOM tree accessors</dfn></h4><p><dfn id=the-html-element-0>The <code>html</code> element</dfn> of a document is the
document's root element, if there is one and it's an
@@ -30837,13 +30838,7 @@
interface state.<p>Pages can <a href=#dom-history-pushstate title=dom-history-pushState>add</a> <a href=#state-object title="state object">state objects</a> between their entry in the
session history and the next ("forward") entry. These are then <a href=#event-popstate title=event-popstate>returned to the script</a> when the user
(or script) goes back in the history, thus enabling authors to use
- the "navigation" metaphor even in one-page applications.<p>Every <code>Document</code> in the session history is defined to
- have a <dfn id=last-activated-entry>last activated entry</dfn>, which is the <a href=#state-object>state
- object</a> entry associated with that <code>Document</code> which
- was most recently activated. Initially, the <a href=#last-activated-entry>last activated
- entry</a> of a <code>Document</code> must be the first entry for
- the <code>Document</code>, representing the fact that no <a href=#state-object>state
- object</a> entry has yet been activated.<p>At any point, one of the entries in the session history is the
+ the "navigation" metaphor even in one-page applications.<p>At any point, one of the entries in the session history is the
<dfn id=current-entry>current entry</dfn>. This is the entry representing the
<a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
context</a>. The <a href=#current-entry>current entry</a> is usually an entry
@@ -30868,16 +30863,7 @@
entries that shared the same <code>Document</code> object with it
must share the new object as well.<p>When state object entries are added, a URL can be provided. This
URL is used to replace the state object entry if the
- <code>Document</code> is evicted.<p>When a user agent discards the <code>Document</code> object from
- an entry in the session history, it must also discard all the
- entries that share that <code>Document</code> but do not have an
- associated URL (i.e. entries that only have a <a href=#state-object>state
- object</a>). Entries that shared that <code>Document</code>
- object but had a state object and have a different URL must then
- have their <em>state objects</em> removed. Removed entries are not
- recreated if the user or script navigates back to the page. If there
- are no state object entries for that <code>Document</code> object
- then no entries are removed.<h4 id=the-history-interface><span class=secno>5.8.2 </span>The <code><a href=#history-1>History</a></code> interface</h4><pre class=idl>interface <dfn id=history-1>History</dfn> {
+ <code>Document</code> is evicted.<h4 id=the-history-interface><span class=secno>5.8.2 </span>The <code><a href=#history-1>History</a></code> interface</h4><pre class=idl>interface <dfn id=history-1>History</dfn> {
readonly attribute long <a href=#dom-history-length title=dom-history-length>length</a>;
void <a href=#dom-history-go title=dom-history-go>go</a>([Optional] in long delta);
void <a href=#dom-history-back title=dom-history-back>back</a>();
@@ -30908,7 +30894,12 @@
<tr><td><dfn id=dom-history-forward title=dom-history-forward><code>forward()</code></dfn></td>
<td>Must do the same as <code title=dom-history-go><a href=#dom-history-go>go(1)</a></code></td>
</table><p>The <dfn id=dom-history-pushstate title=dom-history-pushState><code>pushState(<var title="">data</var>, <var title="">title</var>, <var title="">url</var>)</code></dfn> method adds a state object to the
- history.<p>When this method is invoked, the user agent must run the following steps:<ol><li>
+ history.<p>When this method is invoked, the user agent must run the following steps:<ol><li><p>Let <var title="">clone data</var> be a <a href=#structured-clone>structured
+ clone</a> of the specified <var title="">data</var>. If this
+ throws an exception, then rethrow that exception and abort these
+ steps.</li>
+
+ <li>
<p>If a third argument is specified, run these substeps:</p>
@@ -30939,12 +30930,13 @@
then no entries are removed.</li>
<li><p>Add a state object entry to the session history, after the
- <a href=#current-entry>current entry</a>, with the specified <var title="">data</var> as the state object, the given <var title="">title</var> as the title, and, if the third argument is
- present, the <a href=#absolute-url>absolute URL</a> that was found in the first
- step as the URL of the entry.</li>
+ <a href=#current-entry>current entry</a>, with <var title="">cloned data</var> as
+ the state object, the given <var title="">title</var> as the title,
+ and, if the third argument is present, the <a href=#absolute-url>absolute
+ URL</a> that was found earlier in this algorithm as the
+ <a href=#url>URL</a> of the entry.</li>
- <li><p>Set this new entry as being the <a href=#last-activated-entry>last activated
- entry</a> for the <code>Document</code>.</li>
+ <!-- XXX update the current address as per bug 6437 -->
<li><p>Update the <a href=#current-entry>current entry</a> to be the this newly
added entry.</li>
@@ -30966,20 +30958,38 @@
history.<h4 id=activating-state-object-entries><span class=secno>5.8.3 </span><dfn title="activate the state object">Activating state object entries</dfn></h4><p>When an entry in the session history is activated (which happens
during <a href=#traverse-the-history title="traverse the history">session traversal</a>,
as described above), the user agent must run the following
- steps:<ol><li><p>First, the user agent must set this new entry as being the
- <a href=#last-activated-entry>last activated entry</a> for the <code>Document</code> to
- which the entry belongs.</li>
+ steps:<ol><!-- only called for the first entry of a Document set and for
+ state object entries, not for frag id change entries --><li><p>If the entry is a <a href=#state-object>state object</a> entry, let <var title="">state</var> be a <a href=#structured-clone>structured clone</a> of that
+ state object. Otherwise, let <var title="">state</var> be
+ null.</li>
- <li><p>If the entry is a <a href=#state-object>state object</a> entry, let <var title="">state</var> be that state object. Otherwise, the entry is
- the first entry for the <code>Document</code>; let <var title="">state</var> be null.</li>
+ <li>
- <li><p>The user agent must then fire a <dfn id=event-popstate title=event-popstate><code>popstate</code></dfn> event in no
- namespace on <a href=#the-body-element-1>the body element</a> using the
- <code><a href=#popstateevent>PopStateEvent</a></code> interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute set to the
- value of <var title="">state</var>. This event bubbles but is not
- cancelable and has no default action.</li>
+ <p>Run the appropriate according to the conditions described:</p>
- </ol><!-- XXX onpopstate should be defined somewhere --><pre class=idl>interface <dfn id=popstateevent>PopStateEvent</dfn> : Event {
+ <dl class=switch><dt>If the <a href=#current-document-readiness>current document readiness</a> is set to the
+ string "complete"</dt>
+
+ <dd><p><a href=#queue-a-task>Queue a task</a> to fire a <dfn id=event-popstate title=event-popstate><code>popstate</code></dfn> event in no
+ namespace on <a href=#the-body-element-1>the body element</a> using the
+ <code><a href=#popstateevent>PopStateEvent</a></code> interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute set to the
+ value of <var title="">state</var>. This event must bubble but
+ not be cancelable and has no default action. The <a href=#task-source>task
+ source</a> for this task is the <a href=#dom-manipulation-task-source>DOM manipulation task
+ source</a>.</dd>
+
+ <dt>Otherwise</dt>
+
+ <dd><p>Let the <code>Document</code>'s <dfn id=pending-state-object>pending state
+ object</dfn> be <var title="">state</var>. (If there was already
+ a <a href=#pending-state-object>pending state object</a>, the previous one is
+ discarded.)</p>
+
+ <p class=note>The event will then be fired just after the <code title=event-load><a href=#event-load>load</a></code> event.</dd>
+
+ </dl></li>
+
+ </ol><p>The <a href=#pending-state-object>pending state object</a> must be initially null.</p><!-- XXX onpopstate should be defined somewhere --><pre class=idl>interface <dfn id=popstateevent>PopStateEvent</dfn> : Event {
readonly attribute any <a href=#dom-popstateevent-state title=dom-PopStateEvent-state>state</a>;
void <a href=#dom-popstateevent-initpopstateevent title=dom-PopStateEvent-initPopStateEvent>initPopStateEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any stateArg);
void <a href=#dom-popstateevent-initpopstateeventns title=dom-PopStateEvent-initPopStateEventNS>initPopStateEventNS</a>(in DOMString namespaceURIArg, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any stateArg);
@@ -31688,17 +31698,6 @@
</ol></li>
- <li><p>If there are any entries with state objects between the
- <a href=#last-activated-entry>last activated entry</a> for the <code>Document</code> of
- the <i>specified entry</i> and the <i>specified entry</i> itself
- (not inclusive), then the user agent must iterate through every
- entry between that <a href=#last-activated-entry>last activated entry</a> and the
- <i>specified entry</i>, starting with the entry closest to the
- <a href=#current-entry>current entry</a>, and ending with the one closest to the
- <i>specified entry</i>. For each entry, if the entry is a state
- object, the user agent must <a href=#activating-state-object-entries>activate the state
- object</a>.</li>
-
<li><p>If the <i>specified entry</i> is a state object or the
first entry for a <code>Document</code>, the user agent must <a href=#activating-state-object-entries title="activate the state object">activate that
entry</a>.</li>
@@ -31706,8 +31705,10 @@
<li><p>If the <i>specified entry</i> has a URL that differs from
the <a href=#current-entry>current entry</a>'s only by its fragment identifier,
and the two share the same <code>Document</code> object, then
- <a href=#fire-a-simple-event>fire a simple event</a> with the name <code title=event-hashchange>hashchange</code> at <a href=#the-body-element-1>the
- <code>body</code> element</a>, and, if the new URL has a
+ first, if the <code>Document</code>'s <a href=#current-document-readiness>current document
+ readiness</a> is the string "complete", then <a href=#fire-a-simple-event>fire a simple
+ event</a> with the name <code title=event-hashchange>hashchange</code> at <a href=#the-body-element-1>the
+ <code>body</code> element</a>; and second, if the new URL has a
fragment identifier, <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
identifier</a>.</li>
@@ -42709,10 +42710,24 @@
not yet been executed.<p>The user agent must then <a href=#fire-a-simple-event>fire a simple event</a> called
<code title=event-DOMContentLoaded>DOMContentLoaded</code> at the
<code>Document</code>.<p>Once everything that <dfn id=delay-the-load-event title="delay the load event">delays the
- load event</dfn> has completed, the user agent must set the
- <a href=#current-document-readiness>current document readiness</a> to "complete", and then
- <a href=#fire-a-load-event title="fire a load event">fire a <code title=event-load>load</code> event</a> at <a href=#the-body-element-1>the
- <code>body</code> element</a>.</p><!-- XXX make sure things "delay the load event" --><p class=XXX>delaying the load event for things like image
+ load event</dfn> has completed, the user agent must run the
+ following steps:<ol><li><a href=#queue-a-task>Queue a task</a> to set the <a href=#current-document-readiness>current document
+ readiness</a> to "complete".</li>
+
+ <li><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-load-event title="fire a load
+ event">fire a <code title=event-load>load</code> event</a> at
+ <a href=#the-body-element-1>the <code>body</code> element</a>.
+
+ <li>If the <code>Document</code> has a <a href=#pending-state-object>pending state
+ object</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event in no namespace on
+ <a href=#the-body-element-1>the body element</a> using the <code><a href=#popstateevent>PopStateEvent</a></code>
+ interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute set to the
+ current value of the <a href=#pending-state-object>pending state object</a>. This event
+ must bubble but not be cancelable and has no default
+ action.</li>
+
+ </ol><p>The <a href=#task-source>task source</a> for these tasks is the <a href=#dom-manipulation-task-source>DOM
+ manipulation task source</a>.</p><!-- XXX make sure things "delay the load event" --><p class=XXX>delaying the load event for things like image
loads allows for intranet port scans (even without
javascript!). Should we really encode that into the spec?</p><!--XXX need to handle
http://lxr.mozilla.org/mozilla/source/parser/htmlparser/src/CNavDTD.cpp#2354
Received on Thursday, 15 January 2009 22:12:14 UTC