Skip to content

Commit 64ea795

Browse files
authored
Ensure Refresh pragma always uses a URL record
Before this change you could sometimes end up passing a string to navigate. This also reduces the number of jumps, adds a flag we can reuse for the eventual definition of the HTTP Refresh header, and confines the remaining jumps to a single block.
1 parent 5dc7db2 commit 64ea795

File tree

1 file changed

+62
-65
lines changed

1 file changed

+62
-65
lines changed

source

Lines changed: 62 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -14282,24 +14282,23 @@ people expect to have work and what is necessary.
1428214282

1428314283
<p>This pragma acts as timed redirect.</p>
1428414284

14285+
<p>A <code>Document</code> object has an associated <dfn data-dfn-for="Document">will
14286+
declaratively refresh</dfn> (a boolean). It is initially false.</p>
14287+
1428514288
<div w-nodev>
1428614289

1428714290
<ol>
1428814291
<!-- TESTS: https://www.hixie.ch/tests/adhoc/html/meta/refresh/ -->
1428914292
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=734 -->
14293+
<li><p>Let <var>document</var> be the <code>meta</code> element's <span>node
14294+
document</span>.</p></li>
1429014295

14291-
<li><p>If another <code>meta</code> element with an <code
14292-
data-x="attr-meta-http-equiv">http-equiv</code> attribute in the <span
14293-
data-x="attr-meta-http-equiv-refresh">Refresh state</span> has already been successfully
14294-
processed (i.e. when it was inserted the user agent processed it and reached the step labeled
14295-
<i>end</i>), then return.</p></li>
14296+
<li><p>If <var>document</var>'s <span>will declaratively refresh</span> is true, then
14297+
return.</p></li>
1429614298

1429714299
<li><p>If the <code>meta</code> element has no <code data-x="attr-meta-content">content</code>
1429814300
attribute, or if that attribute's value is the empty string, then return.</p></li>
1429914301

14300-
<li><p>Let <var>document</var> be the <code>meta</code> element's <span>node
14301-
document</span>.</p></li>
14302-
1430314302
<li><p>Let <var>input</var> be the value of the element's <code
1430414303
data-x="attr-meta-content">content</code> attribute.</p></li>
1430514304

@@ -14331,79 +14330,83 @@ people expect to have work and what is necessary.
1433114330
U+002E FULL STOP characters (.) from <var>input</var> given <var>position</var>. Ignore any
1433214331
collected characters.</p></li>
1433314332

14334-
<li><p>Let <var>url</var> be <var>document</var>'s <span
14335-
data-x="concept-document-URL">URL</span>, <span
14336-
data-x="concept-url-serializer">serialized</span>.</p></li>
14333+
<li><p>Let <var>urlRecord</var> be <var>document</var>'s <span
14334+
data-x="concept-document-URL">URL</span>.</p></li>
1433714335

14338-
<li><p>If <var>position</var> is past the end of <var>input</var>, jump to the step labeled
14339-
<i>end</i>.</p></li>
14336+
<li>
14337+
<p>If <var>position</var> is not past the end of <var>input</var>, then:</p>
1434014338

14341-
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var> is
14342-
not U+003B (;), U+002C (,), or <span>ASCII whitespace</span>, then return.</p></li>
14339+
<ol>
14340+
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var>
14341+
is not U+003B (;), U+002C (,), or <span>ASCII whitespace</span>, then return.</p></li>
1434314342

14344-
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14345-
<var>position</var>.</p></li>
14343+
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14344+
<var>position</var>.</p></li>
1434614345

14347-
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var> is
14348-
U+003B (;) or U+002C (,), then advance <var>position</var> to the next <span>code
14349-
point</span>.</p></li>
14346+
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var>
14347+
is U+003B (;) or U+002C (,), then advance <var>position</var> to the next <span>code
14348+
point</span>.</p></li>
1435014349

14351-
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14352-
<var>position</var>.</p></li>
14350+
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14351+
<var>position</var>.</p></li>
14352+
</ol>
14353+
</li>
1435314354

14354-
<li><p>If <var>position</var> is past the end of <var>input</var>, jump to the step labeled
14355-
<i>end</i>.</p></li>
14355+
<li>
14356+
<p>If <var>position</var> is not past the end of <var>input</var>, then:</p>
14357+
14358+
<ol>
14359+
<li><p>Let <var>urlString</var> be the substring of <var>input</var> from the
14360+
<span>code point</span> at <var>position</var> to the end of the string.</p></li>
1435614361

14357-
<li><p>Set <var>url</var> to the substring of <var>input</var> from the <span>code point</span>
14358-
at <var>position</var> to the end of the string.</p></li>
14362+
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var>
14363+
is U+0055 (U) or U+0075 (u), then advance <var>position</var> to the next <span>code
14364+
point</span>. Otherwise, jump to the step labeled <i>skip quotes</i>.</p></li>
1435914365

14360-
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var> is
14361-
U+0055 (U) or U+0075 (u), then advance <var>position</var> to the next <span>code point</span>.
14362-
Otherwise, jump to the step labeled <i>skip quotes</i>.</p></li>
14366+
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var>
14367+
is U+0052 (R) or U+0072 (r), then advance <var>position</var> to the next <span>code
14368+
point</span>. Otherwise, jump to the step labeled <i>parse</i>.</p></li>
1436314369

14364-
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var> is
14365-
U+0052 (R) or U+0072 (r), then advance <var>position</var> to the next <span>code point</span>.
14366-
Otherwise, jump to the step labeled <i>parse</i>.</p></li>
14370+
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var>
14371+
is U+004C (L) or U+006C (l), then advance <var>position</var> to the next <span>code
14372+
point</span>. Otherwise, jump to the step labeled <i>parse</i>.</p></li>
1436714373

14368-
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var> is
14369-
U+004C (L) or U+006C (l), then advance <var>position</var> to the next <span>code point</span>.
14370-
Otherwise, jump to the step labeled <i>parse</i>.</p></li>
14374+
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14375+
<var>position</var>.</p></li>
1437114376

14372-
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14373-
<var>position</var>.</p></li>
14377+
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var>
14378+
is U+003D (=), then advance <var>position</var> to the next <span>code point</span>.
14379+
Otherwise, jump to the step labeled <i>parse</i>.</p></li>
1437414380

14375-
<li><p>If the <span>code point</span> in <var>input</var> pointed to by <var>position</var> is
14376-
U+003D (=), then advance <var>position</var> to the next <span>code point</span>. Otherwise,
14377-
jump to the step labeled <i>parse</i>.</p></li>
14381+
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14382+
<var>position</var>.</p></li>
1437814383

14379-
<li><p><span>Skip ASCII whitespace</span> within <var>input</var> given
14380-
<var>position</var>.</p></li>
14384+
<li><p><i>Skip quotes</i>: If the <span>code point</span> in <var>input</var> pointed to by
14385+
<var>position</var> is U+0027 (') or U+0022 ("), then let <var>quote</var> be that <span>code
14386+
point</span>, and advance <var>position</var> to the next <span>code point</span>. Otherwise,
14387+
let <var>quote</var> be the empty string.</p></li>
1438114388

14382-
<li><p><i>Skip quotes</i>: If the <span>code point</span> in <var>input</var> pointed to by
14383-
<var>position</var> is U+0027 (') or U+0022 ("), then let <var>quote</var> be that <span>code
14384-
point</span>, and advance <var>position</var> to the next <span>code point</span>. Otherwise,
14385-
let <var>quote</var> be the empty string.</p></li>
14389+
<li><p>Set <var>urlString</var> to the substring of <var>input</var> from the <span>code
14390+
point</span> at <var>position</var> to the end of the string.</p></li>
1438614391

14387-
<li><p>Set <var>url</var> to the substring of <var>input</var> from the <span>code point</span>
14388-
at <var>position</var> to the end of the string.</p></li>
14392+
<li><p>If <var>quote</var> is not the empty string, and there is a <span>code point</span> in
14393+
<var>urlString</var> equal to <var>quote</var>, then truncate <var>urlString</var> at that
14394+
<span>code point</span>, so that it and all subsequent <span data-x="code point">code
14395+
points</span> are removed.</p>
1438914396

14390-
<li><p>If <var>quote</var> is not the empty string, and there is a <span>code point</span> in
14391-
<var>url</var> equal to <var>quote</var>, then truncate <var>url</var> at that <span>code
14392-
point</span>, so that it and all subsequent <span data-x="code point">code points</span> are
14393-
removed.</p>
14397+
<li><p><i>Parse</i>: <span data-x="parse a url">Parse</span> <var>urlString</var> relative to
14398+
<var>document</var>. If that fails, return. Otherwise, set <var>urlRecord</var> to the
14399+
<span>resulting URL record</span>.</p></li>
14400+
</ol>
14401+
</li>
1439414402

14395-
<li><p><i>Parse</i>: <span data-x="parse a url">Parse</span> <var>url</var> relative to
14396-
<var>document</var>. If that fails, return. Otherwise, let <var>urlRecord</var> be the
14397-
<span>resulting URL record</span>.</p></li>
14403+
<li><p>Set <var>document</var>'s <span>will declaratively refresh</span> to true.</p></li>
1439814404

1439914405
<li>
14400-
14401-
<p><i>End</i>: Perform one or more of the following steps:</p>
14406+
<p>Perform one or more of the following steps:</p>
1440214407

1440314408
<ul>
14404-
1440514409
<li>
14406-
1440714410
<p>After the refresh has come due (as defined below), if the user has not canceled the
1440814411
redirect and <var>document</var>'s <span>active sandboxing flag set</span> does not have the
1440914412
<span>sandboxed automatic features browsing context flag</span> set, <span
@@ -14417,7 +14420,6 @@ people expect to have work and what is necessary.
1441714420
the <em>later</em> of the following two conditions occurs:</p>
1441814421

1441914422
<ul>
14420-
1442114423
<li>At least <var>time</var> seconds have elapsed since <var>document</var> has
1442214424
<span>completely loaded</span>, adjusted to take into account user or user agent
1442314425
preferences.</li>
@@ -14427,13 +14429,11 @@ people expect to have work and what is necessary.
1442714429
<span data-x="node is inserted into a document">inserted into the document</span>
1442814430
<var>document</var>, adjusted to take into account user or user agent preferences.</li>
1442914431
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=772 -->
14430-
1443114432
</ul>
1443214433

1443314434
<p class="note">It is important to use <var>document</var> here, and not the
1443414435
<code>meta</code> element's <span>node document</span>, as that might have changed between
1443514436
the initial set of steps and the refresh coming due.</p>
14436-
1443714437
</li>
1443814438

1443914439
<li><p>Provide the user with an interface that, when selected, <span
@@ -14443,15 +14443,12 @@ people expect to have work and what is necessary.
1444314443
context</span>.</p></li>
1444414444

1444514445
<li><p>Do nothing.</p></li>
14446-
1444714446
</ul>
1444814447

1444914448
<p>In addition, the user agent may, as with anything, inform the user of any and all aspects
1445014449
of its operation, including the state of any timers, the destinations of any timed redirects,
1445114450
and so forth.</p>
14452-
1445314451
</li>
14454-
1445514452
</ol>
1445614453

1445714454
</div>

0 commit comments

Comments
 (0)