Skip to content

Commit

Permalink
[giow] (2) Make form submission via .submit(), and page navigation vi…
Browse files Browse the repository at this point in the history
…a location.href, when either is done before the page has completely loaded, result in a history replacement (like a redirect) rather than a regular load.

git-svn-id: http://svn.whatwg.org/webapps@5685 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Nov 30, 2010
1 parent 82cc161 commit 6f5820a
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 123 deletions.
80 changes: 39 additions & 41 deletions complete.html
Expand Up @@ -47239,12 +47239,17 @@ <h5 id=form-submission-algorithm><span class=secno>4.10.22.3 </span>Form submiss
<var title="">scripted-submit</var> flag set, the user agent must
run the following steps:</p>

<ol><li id=sandboxSubmitBlocked><p>If <var title="">form</var> is in
a <code><a href=#document>Document</a></code> that has no associated <a href=#browsing-context>browsing
context</a> or whose <a href=#browsing-context>browsing context</a> had its
<a href=#sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</a> set when the
<code><a href=#document>Document</a></code> was created, then abort these steps without
doing anything.</li>
<ol><li><p>Let <var title="">form document</var> be the <var title="">form</var>'s <code><a href=#document>Document</a></code>.</li>

<li id=sandboxSubmitBlocked><p>If <var title="">form
document</var> has no associated <a href=#browsing-context>browsing context</a> or
its <a href=#browsing-context>browsing context</a> had its <a href=#sandboxed-forms-browsing-context-flag>sandboxed forms
browsing context flag</a> set when the <code><a href=#document>Document</a></code> was
created, then abort these steps without doing anything.</li>

<li><p>Let <var title="">form browsing context</var> be the
<a href=#browsing-context>browsing context</a> of <var title="">form
document</var>.</li>

<li><p>If <var title="">form</var> is already being submitted
(i.e. the form was <a href=#concept-form-submit title=concept-form-submit>submitted</a> again while processing
Expand Down Expand Up @@ -47450,7 +47455,8 @@ <h5 id=form-submission-algorithm><span class=secno>4.10.22.3 </span>Form submiss

<li>

<p>If <var title="">action</var> is the empty string, let <var title="">action</var> be <a href="#the-document's-address">the document's address</a>.</p>
<p>If <var title="">action</var> is the empty string, let <var title="">action</var> be <a href="#the-document's-address">the document's address</a> of
the <var title="">form document</var>.</p>

<p class=note>This step is a <a href=#willful-violation>willful violation</a> of
RFC 3986, which would require base URL processing here. This
Expand Down Expand Up @@ -47484,16 +47490,15 @@ <h5 id=form-submission-algorithm><span class=secno>4.10.22.3 </span>Form submiss
<li><p>If the user indicated a specific <a href=#browsing-context>browsing
context</a> to use when submitting the form, then let <var title="">target browsing context</var> be that <a href=#browsing-context>browsing
context</a>. Otherwise, apply <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a
browsing context given a browsing context name</a> using <var title="">target</var> as the name and the <a href=#browsing-context>browsing
context</a> of <var title="">form</var> as the context in which
the algorithm is executed, and let <var title="">target browsing
context</var> be the resulting <a href=#browsing-context>browsing
context</a>.</li>
browsing context given a browsing context name</a> using <var title="">target</var> as the name and <var title="">form browsing
context</var> as the context in which the algorithm is executed,
and let <var title="">target browsing context</var> be the
resulting <a href=#browsing-context>browsing context</a>.</li>

<li><p>If <var title="">target browsing context</var> was created
in the previous step, then let <var title="">replace</var> be true.
Otherwise, let it be false.</li>
<!-- XXXXX this is about to change -->
in the previous step, or if the <var title="">form document</var>
has not yet <a href=#completely-loaded>completely loaded</a>, then let <var title="">replace</var> be true. Otherwise, let it be
false.</li>

<li>

Expand Down Expand Up @@ -47581,11 +47586,10 @@ <h5 id=form-submission-algorithm><span class=secno>4.10.22.3 </span>Form submiss

</dl><!--<p>If <var title="">method</var> is anything but (GET or)
POST, and the <span>origin</span> of <var title="">action</var>
is not the <span>same origin</span> as that of the
<code>form</code> element's <code>Document</code>, then abort
these steps.</p> [or do CORS] (this is commented out since only
POST can trigger this now, and that's historically
unrestricted)--><p>Otherwise, <a href=#navigate>navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">action</var> using the HTTP method given by <var title="">method</var> and with <var title="">entity body</var>
is not the <span>same origin</span> as that of <var
title="">form document</var>, then abort these steps.</p> [or do
CORS] (this is commented out since only POST can trigger this
now, and that's historically unrestricted)--><p>Otherwise, <a href=#navigate>navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">action</var> using the HTTP method given by <var title="">method</var> and with <var title="">entity body</var>
as the entity body, of type <var title="">MIME type</var>. If
<var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement
Expand Down Expand Up @@ -58893,22 +58897,13 @@ <h4 id=the-location-interface><span class=secno>6.4.3 </span>The <code><a href=#
address">the current address</a> of the associated
<code><a href=#document>Document</a></code> object, as an <a href=#absolute-url>absolute URL</a>.</p>

<p>On setting, <!-- READ ME WHEN EDITING THIS: Mozilla does this,
but IE doesn't. What should we do?: the behavior depends on the
context in which the script that set the attribute is running. If
the script ran as the direct result of the execution of a
<code>script</code> element in the document represented by the
<code>Location</code> object's associated <code>Document</code>
object, then the user agent must act as if the <code
title="dom-location-replace">replace()</code> method had been called
with the new value as its argument. Otherwise,--> the user agent
must act as if the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code>
method had been called with the new value as its argument.</p><!--
v2: may wish to allow replace instead as a UI improvement -->
<!-- XXXXX the above is about to change -->

<!-- we could change the magic .location setter to simply refer
straight to assign(), so we don't have two levels of indirection -->
<p>On setting, if the <code><a href=#location>Location</a></code> object's associated
<code><a href=#document>Document</a></code> object has <a href=#completely-loaded>completely loaded</a>,
then the user agent must act as if the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> method had been called
with the new value as its argument. Otherwise, the user agent must
act as if the <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code>
method had been called with the new value as its argument.</p>
<!--DONAV location.href, defined in terms of the paragraphs below-->

<p>When the <dfn id=dom-location-assign title=dom-location-assign><code>assign(<var title="">url</var>)</code></dfn> method is invoked, the UA must
<a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative to
Expand All @@ -58929,7 +58924,7 @@ <h4 id=the-location-interface><span class=secno>6.4.3 </span>The <code><a href=#
<a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative to
the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
URL</a>, and if that is successful,
<a href=#navigate>navigate</a><!--DONAV location.replace--> the
<a href=#navigate>navigate</a><!--DONAV location.href/replace--> the
<a href=#browsing-context>browsing context</a> to the specified <var title="">url</var> with <a href=#replacement-enabled>replacement enabled</a>.</p>

<p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done
Expand Down Expand Up @@ -62049,8 +62044,8 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.6.4 </sp
target <code><a href=#applicationcache>ApplicationCache</a></code> object <var title="">target</var>, the user agent must run the appropriate steps
from the following list:</p>

<dl><dt>If <var title="">target</var>'s <code><a href=#document>Document</a></code> has
<a href=#completely-loaded>completely loaded</a></dt>
<dl><dt>If <var title="">target</var>'s <code><a href=#document>Document</a></code> is
<a href=#ready-for-post-load-tasks>ready for post-load tasks</a></dt>

<dd><p><a href=#queue-a-task title="queue a task">Queue</a> the task <var title="">task</var>.</dd>

Expand Down Expand Up @@ -82523,8 +82518,11 @@ <h4 id=the-end><span class=secno>12.2.6 </span>The end</h4>
for these <a href=#concept-task title=concept-task>tasks</a> is the
<a href=#networking-task-source>networking task source</a>.</li>

<li><p>The <code><a href=#document>Document</a></code> is now <dfn id=completely-loaded>completely
loaded</dfn>.</li>
<li><p>The <code><a href=#document>Document</a></code> is now <dfn id=ready-for-post-load-tasks>ready for post-load
tasks</dfn>.</li>

<li><p><a href=#queue-a-task>Queue a task</a> to mark the <code><a href=#document>Document</a></code>
as <dfn id=completely-loaded>completely loaded</dfn>.</li>

</ol><p>When the user agent is to <dfn id=abort-a-parser>abort a parser</dfn>, it must run
the following steps:</p>
Expand Down
80 changes: 39 additions & 41 deletions index
Expand Up @@ -47219,12 +47219,17 @@ fur
<var title="">scripted-submit</var> flag set, the user agent must
run the following steps:</p>

<ol><li id=sandboxSubmitBlocked><p>If <var title="">form</var> is in
a <code><a href=#document>Document</a></code> that has no associated <a href=#browsing-context>browsing
context</a> or whose <a href=#browsing-context>browsing context</a> had its
<a href=#sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</a> set when the
<code><a href=#document>Document</a></code> was created, then abort these steps without
doing anything.</li>
<ol><li><p>Let <var title="">form document</var> be the <var title="">form</var>'s <code><a href=#document>Document</a></code>.</li>

<li id=sandboxSubmitBlocked><p>If <var title="">form
document</var> has no associated <a href=#browsing-context>browsing context</a> or
its <a href=#browsing-context>browsing context</a> had its <a href=#sandboxed-forms-browsing-context-flag>sandboxed forms
browsing context flag</a> set when the <code><a href=#document>Document</a></code> was
created, then abort these steps without doing anything.</li>

<li><p>Let <var title="">form browsing context</var> be the
<a href=#browsing-context>browsing context</a> of <var title="">form
document</var>.</li>

<li><p>If <var title="">form</var> is already being submitted
(i.e. the form was <a href=#concept-form-submit title=concept-form-submit>submitted</a> again while processing
Expand Down Expand Up @@ -47430,7 +47435,8 @@ fur

<li>

<p>If <var title="">action</var> is the empty string, let <var title="">action</var> be <a href="#the-document's-address">the document's address</a>.</p>
<p>If <var title="">action</var> is the empty string, let <var title="">action</var> be <a href="#the-document's-address">the document's address</a> of
the <var title="">form document</var>.</p>

<p class=note>This step is a <a href=#willful-violation>willful violation</a> of
RFC 3986, which would require base URL processing here. This
Expand Down Expand Up @@ -47464,16 +47470,15 @@ fur
<li><p>If the user indicated a specific <a href=#browsing-context>browsing
context</a> to use when submitting the form, then let <var title="">target browsing context</var> be that <a href=#browsing-context>browsing
context</a>. Otherwise, apply <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a
browsing context given a browsing context name</a> using <var title="">target</var> as the name and the <a href=#browsing-context>browsing
context</a> of <var title="">form</var> as the context in which
the algorithm is executed, and let <var title="">target browsing
context</var> be the resulting <a href=#browsing-context>browsing
context</a>.</li>
browsing context given a browsing context name</a> using <var title="">target</var> as the name and <var title="">form browsing
context</var> as the context in which the algorithm is executed,
and let <var title="">target browsing context</var> be the
resulting <a href=#browsing-context>browsing context</a>.</li>

<li><p>If <var title="">target browsing context</var> was created
in the previous step, then let <var title="">replace</var> be true.
Otherwise, let it be false.</li>
<!-- XXXXX this is about to change -->
in the previous step, or if the <var title="">form document</var>
has not yet <a href=#completely-loaded>completely loaded</a>, then let <var title="">replace</var> be true. Otherwise, let it be
false.</li>

<li>

Expand Down Expand Up @@ -47561,11 +47566,10 @@ fur

</dl><!--<p>If <var title="">method</var> is anything but (GET or)
POST, and the <span>origin</span> of <var title="">action</var>
is not the <span>same origin</span> as that of the
<code>form</code> element's <code>Document</code>, then abort
these steps.</p> [or do CORS] (this is commented out since only
POST can trigger this now, and that's historically
unrestricted)--><p>Otherwise, <a href=#navigate>navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">action</var> using the HTTP method given by <var title="">method</var> and with <var title="">entity body</var>
is not the <span>same origin</span> as that of <var
title="">form document</var>, then abort these steps.</p> [or do
CORS] (this is commented out since only POST can trigger this
now, and that's historically unrestricted)--><p>Otherwise, <a href=#navigate>navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">action</var> using the HTTP method given by <var title="">method</var> and with <var title="">entity body</var>
as the entity body, of type <var title="">MIME type</var>. If
<var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement
Expand Down Expand Up @@ -58873,22 +58877,13 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
address">the current address</a> of the associated
<code><a href=#document>Document</a></code> object, as an <a href=#absolute-url>absolute URL</a>.</p>

<p>On setting, <!-- READ ME WHEN EDITING THIS: Mozilla does this,
but IE doesn't. What should we do?: the behavior depends on the
context in which the script that set the attribute is running. If
the script ran as the direct result of the execution of a
<code>script</code> element in the document represented by the
<code>Location</code> object's associated <code>Document</code>
object, then the user agent must act as if the <code
title="dom-location-replace">replace()</code> method had been called
with the new value as its argument. Otherwise,--> the user agent
must act as if the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code>
method had been called with the new value as its argument.</p><!--
v2: may wish to allow replace instead as a UI improvement -->
<!-- XXXXX the above is about to change -->

<!-- we could change the magic .location setter to simply refer
straight to assign(), so we don't have two levels of indirection -->
<p>On setting, if the <code><a href=#location>Location</a></code> object's associated
<code><a href=#document>Document</a></code> object has <a href=#completely-loaded>completely loaded</a>,
then the user agent must act as if the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> method had been called
with the new value as its argument. Otherwise, the user agent must
act as if the <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code>
method had been called with the new value as its argument.</p>
<!--DONAV location.href, defined in terms of the paragraphs below-->

<p>When the <dfn id=dom-location-assign title=dom-location-assign><code>assign(<var title="">url</var>)</code></dfn> method is invoked, the UA must
<a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative to
Expand All @@ -58909,7 +58904,7 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
<a href=#resolve-a-url title="resolve a url">resolve</a> the argument, relative to
the <a href=#entry-script>entry script</a>'s <a href="#script's-base-url" title="script's base URL">base
URL</a>, and if that is successful,
<a href=#navigate>navigate</a><!--DONAV location.replace--> the
<a href=#navigate>navigate</a><!--DONAV location.href/replace--> the
<a href=#browsing-context>browsing context</a> to the specified <var title="">url</var> with <a href=#replacement-enabled>replacement enabled</a>.</p>

<p>Navigation for the <code title=dom-location-assign><a href=#dom-location-assign>assign()</a></code> and <code title=dom-location-replace><a href=#dom-location-replace>replace()</a></code> methods must be done
Expand Down Expand Up @@ -62038,8 +62033,8 @@ NETWORK:
target <code><a href=#applicationcache>ApplicationCache</a></code> object <var title="">target</var>, the user agent must run the appropriate steps
from the following list:</p>

<dl><dt>If <var title="">target</var>'s <code><a href=#document>Document</a></code> has
<a href=#completely-loaded>completely loaded</a></dt>
<dl><dt>If <var title="">target</var>'s <code><a href=#document>Document</a></code> is
<a href=#ready-for-post-load-tasks>ready for post-load tasks</a></dt>

<dd><p><a href=#queue-a-task title="queue a task">Queue</a> the task <var title="">task</var>.</dd>

Expand Down Expand Up @@ -78437,8 +78432,11 @@ document.body.appendChild(text);
for these <a href=#concept-task title=concept-task>tasks</a> is the
<a href=#networking-task-source>networking task source</a>.</li>

<li><p>The <code><a href=#document>Document</a></code> is now <dfn id=completely-loaded>completely
loaded</dfn>.</li>
<li><p>The <code><a href=#document>Document</a></code> is now <dfn id=ready-for-post-load-tasks>ready for post-load
tasks</dfn>.</li>

<li><p><a href=#queue-a-task>Queue a task</a> to mark the <code><a href=#document>Document</a></code>
as <dfn id=completely-loaded>completely loaded</dfn>.</li>

</ol><p>When the user agent is to <dfn id=abort-a-parser>abort a parser</dfn>, it must run
the following steps:</p>
Expand Down

0 comments on commit 6f5820a

Please sign in to comment.