Skip to content

Commit

Permalink
[giow] (0) Add a feature to appcache to make it possible to mark a ca…
Browse files Browse the repository at this point in the history
…che as preferring online resources than cached resources.

Affected topics: HTML, Offline Web Applications

git-svn-id: http://svn.whatwg.org/webapps@7136 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 14, 2012
1 parent 4fd61bb commit cfa0e09
Show file tree
Hide file tree
Showing 3 changed files with 402 additions and 30 deletions.
135 changes: 125 additions & 10 deletions complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,7 @@ <h6 class=no-toc id=how-do-the-whatwg-and-w3c-specifications-differ?><span class
<li>Some predefined <a href=#mdvocabs>Microdata vocabularies</a>.</li>
<li>The <code><a href=#the-data-element>data</a></code> element for marking up machine-readable data.</li><!--DATA--><!--FORK-->
<li>The <code title=scheme-http+aes><a href=#http+aes-scheme>http+aes:</a></code> and <code title=scheme-http+aes><a href=#http+aes-scheme>https+aes:</a></code> schemes.</li><!--FORK-->
<li>The <a href=#application-cache>application cache</a> feature's <a href=#concept-appcache-mode-prefer-online title=concept-appcache-mode-prefer-online>prefer-online</a> mode.</li><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
</ul><!--
<p>Features that are part of the WHATWG HTML Living Standard
specification but that are currently published as separate
Expand Down Expand Up @@ -36507,7 +36508,7 @@ <h6 id=text-styles><span class=secno>4.8.11.1.4 </span>Text styles</h6>

<!-- this is filler to make sure the TCP packet boundary doesn't fall in the middle of one of the NCRs below -->
<!-- (because otherwise the parser in anolis screws it up) -->
<p><img alt="The top of the em square is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like &#2310; are anchored, the middle is half-way between the top of the em square and the bottom of the em square, the alphabetic baseline is where characters like " height=300 src=http://images.whatwg.org/baselines.png width=738>x00C1;, &yuml;, f, and &Omega; are anchored, the ideographic baseline is where glyphs like &#31169; and &#36948; are anchored, and the bottom of the em square is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside the em square."&gt;</p>
<p><img alt="The top of the em square is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like &#2310; are anchored, the middle is half-way between the top of the em square and the bottom of the em square, the alphabetic baseline is where characters like &Aacute;, &yuml;, f, and &Omega; are anchored, the ideographic baseline is where glyphs like &#31169; and &#36948; are anchored, and the bottom of the em square is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside the em square." height=300 src=http://images.whatwg.org/baselines.png width=738></p>

<p>The keywords map to these alignment points as follows:</p>

Expand Down Expand Up @@ -67795,9 +67796,10 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr
application caches</a> that are identified by a URL with the
<a href=#same-origin>same origin</a> as the URL in question, and that have
this URL as one of their entries, excluding entries marked as
<a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then get
the resource from the <a href=#concept-appcache-selection title=concept-appcache-selection>most appropriate application
cache</a> of those that match.</p>
<a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, and whose
<a href=#concept-appcache-mode title=concept-appcache-mode>mode</a> is <a href=#concept-appcache-mode-fast title=concept-appcache-mode-fast>fast</a>, then get the
resource from the <a href=#concept-appcache-selection title=concept-appcache-selection>most
appropriate application cache</a> of those that match.</p>

<p class=example>For example, imagine an HTML page with an
associated application cache displaying an image and a form, where
Expand Down Expand Up @@ -67921,6 +67923,41 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr

</li>

<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
<li>

<p>If the resource was not fetched from an <a href=#application-cache>application
cache</a>, and was to be fetched using HTTP GET <a href=#concept-http-equivalent-get title=concept-http-equivalent-get>or equivalent</a>, and

there are <a href=#relevant-application-cache title="relevant application cache">relevant
application caches</a> that are identified by a URL with the
<a href=#same-origin>same origin</a> as the URL in question, and that have
this URL as one of their entries, excluding entries marked as
<a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, and whose
<a href=#concept-appcache-mode title=concept-appcache-mode>mode</a> is <a href=#concept-appcache-mode-prefer-online title=concept-appcache-mode-prefer-online>prefer-online</a>,
and the user didn't cancel the navigation attempt during the
earlier step, and the navigation attempt failed (e.g. the server
returned a 4xx or 5xx status code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>, or
there was a DNS error), then:</p>

<p>Let <var title="">candidate</var> be the resource identified by
the URL in question from the <a href=#concept-appcache-selection title=concept-appcache-selection>most appropriate application
cache</a> of those that match.</p> <!-- note that a redirect
can never reach this point as it is handled earlier, meaning that
a captive portal captures URLs in "prefer-online" caches and you
can't ever get to the cached resource of a prefer-online cache if
you have a captive portal -->

<p>If <var title="">candidate</var> is not marked as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then the user
agent must discard the failed load and instead continue along
these steps using <var title="">candidate</var> as the resource.
The user agent may indicate to the user that the original page
load failed, and that the page used was a previously cached
resource.</p>

</li>
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->

<li>

<p><i>Resource handling</i>: If the resource's out-of-band
Expand Down Expand Up @@ -69392,7 +69429,7 @@ <h5 id=appcacheevents><span class=secno>6.7.1.1 </span>Event summary</h5>
<td> The user agent will try fetching the files again momentarily.
</table><div class=impl>

<h4 id=appcache><span class=secno>6.7.2 </span>Application caches</h4>
<h4 id=appcache><span class=secno>6.7.2 </span>Application caches</h4> <!--APPCACHE-->

<p>An <dfn id=application-cache>application cache</dfn> is a set of cached resources
consisting of:</p>
Expand Down Expand Up @@ -69486,6 +69523,21 @@ <h4 id=appcache><span class=secno>6.7.2 </span>Application caches</h4>

</li>

<li>

<p>A <dfn id=concept-appcache-mode title=concept-appcache-mode>cache mode flag</dfn>,
which is
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
either
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
in the <dfn id=concept-appcache-mode-fast title=concept-appcache-mode-fast><i>fast</i></dfn>
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
state or the <dfn id=concept-appcache-mode-prefer-online title=concept-appcache-mode-prefer-online><i>prefer-online</i></dfn>
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
state.</p>

</li>

</ul><p>Each <a href=#application-cache>application cache</a> has a <dfn id=concept-appcache-completeness title=concept-appcache-completeness>completeness flag</dfn>, which is
either <i>complete</i> or <i>incomplete</i>.</p>

Expand Down Expand Up @@ -69734,7 +69786,8 @@ <h5 id=writing-cache-manifests><span class=secno>6.7.3.2 </span>Writing cache ma

<dt>A section header
<dd>
<p>Section headers change the current section. There are three

<p>Section headers change the current section. There are four
possible section headers:

<dl><dt><code>CACHE:</code>
Expand All @@ -69746,6 +69799,11 @@ <h5 id=writing-cache-manifests><span class=secno>6.7.3.2 </span>Writing cache ma
<dt><code>NETWORK:</code>
<dd>Switches to the <dfn id=concept-appcache-manifest-network title=concept-appcache-manifest-network>online whitelist section</dfn>.

<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
<dt><code>SETTINGS:</code>
<dd>Switches to the <dfn id=concept-appcache-manifest-settings title=concept-appcache-manifest-settings>settings section</dfn>.
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->

</dl><p>Section header lines must consist of zero or more U+0020 SPACE
and U+0009 CHARACTER TABULATION (tab) characters, followed by one
of the names above (including the U+003A COLON character (:))
Expand Down Expand Up @@ -69786,6 +69844,27 @@ <h5 id=writing-cache-manifests><span class=secno>6.7.3.2 </span>Writing cache ma
and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION
(tab) characters.</p>

<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
<p>When the current section is the <a href=#concept-appcache-manifest-settings title=concept-appcache-manifest-settings>settings
section</a>, data lines must consist of zero or more U+0020
SPACE and U+0009 CHARACTER TABULATION (tab) characters, a <a href=#concept-appcache-manifest-setting title=concept-appcache-manifest-setting>setting</a>, and then
zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
characters.</p>

<p>Currently only one <dfn id=concept-appcache-manifest-setting title=concept-appcache-manifest-setting>setting</dfn> is
defined:</p>

<dl><dt>The cache mode setting</dt>

<dd>This consists of the string "<code title="">prefer-online</code>". It sets the <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode</a> to <a href=#concept-appcache-mode-prefer-online title=concept-appcache-mode-prefer-online>prefer-online</a>.
(The <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode</a>
defaults to <a href=#concept-appcache-mode-fast title=concept-appcache-mode-fast>fast</a>.)</dd>

</dl><p>Within a <a href=#concept-appcache-manifest-settings title=concept-appcache-manifest-settings>settings
section</a>, each <a href=#concept-appcache-manifest-setting title=concept-appcache-manifest-setting>setting</a> must
occur no more than once.</p>
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->

<!--
<p class="note">The URLs in data lines can't be empty strings,
since those would be relative URLs to the manifest itself. Such
Expand Down Expand Up @@ -69870,6 +69949,8 @@ <h5 id=parsing-cache-manifests><span class=secno>6.7.3.3 </span>Parsing cache ma
<li><p>Let <var title="">online whitelist wildcard flag</var> be <i title="">blocking</i>. <!--
concept-appcache-onlinewhitelist-wildcard --></li>

<li><p>Let <var title="">cache mode flag</var> be <i title="">fast</i>. <!-- concept-appcache-mode-fast --></li>

<li><p>Let <var title="">input</var> be the decoded text of the
manifest's byte stream.</li>

Expand Down Expand Up @@ -69936,6 +70017,12 @@ <h5 id=parsing-cache-manifests><span class=secno>6.7.3.3 </span>Parsing cache ma
"NETWORK" followed by a U+003A COLON character (:)), then set <var title="">mode</var> to "online whitelist" and jump back to the step
labeled "start of line".</li>

<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
<li><p>If <var title="">line</var> equals "SETTINGS:" (the word
"SETTINGS" followed by a U+003A COLON character (:)), then set <var title="">mode</var> to "settings" and jump back to the step labeled
"start of line".</li>
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->

<li><p>If <var title="">line</var> ends with a U+003A COLON
character (:), then set <var title="">mode</var> to "unknown" and
jump back to the step labeled "start of line".</li>
Expand Down Expand Up @@ -70062,6 +70149,22 @@ <h5 id=parsing-cache-manifests><span class=secno>6.7.3.3 </span>Parsing cache ma

</dd>

<!--FORK--><!--APPCACHE-PREFER-ONLINE-->
<dt>If <var title="">mode</var> is "settings"</dt>

<dd>

<p>If <var title="">tokens</var> contains a single token, and
that token is a <a href=#case-sensitive>case-sensitive</a> match for the string
"<code title="">prefer-online</code>", then set <var title="">cache mode flag</var> to <i title="">prefer-online</i>
and jump back to the step labeled "start of line".</p>

<p>Otherwise, the line is an unsupported setting: do nothing;
the line is ignored.</p>

</dd>
<!--FORK--><!--APPCACHE-PREFER-ONLINE-->

<dt>If <var title="">mode</var> is "unknown"</dt>

<dd>
Expand All @@ -70077,8 +70180,9 @@ <h5 id=parsing-cache-manifests><span class=secno>6.7.3.3 </span>Parsing cache ma
reached.)</li>

<li><p>Return the <var title="">explicit URLs</var> list, the <var title="">fallback URLs</var> mapping, the <var title="">online
whitelist namespaces</var>, and the <var title="">online whitelist
wildcard flag</var>.</li>
whitelist namespaces</var>, the <var title="">online whitelist
wildcard flag</var>, and the <var title="">cache mode
flag</var>.</li>

</ol><div class=note>

Expand Down Expand Up @@ -70273,8 +70377,8 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.7.4 </sp
obtaining a list of <a href=#concept-appcache-explicit title=concept-appcache-explicit>explicit entries</a>, <a href=#concept-appcache-fallback title=concept-appcache-fallback>fallback entries</a> and the
<a href=#concept-appcache-fallback-ns title=concept-appcache-fallback-ns>fallback
namespaces</a> that map to them, entries for the <a href=#concept-appcache-onlinewhitelist title=concept-appcache-onlinewhitelist>online whitelist</a>,
and a value for the <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
wildcard flag</a>.</p>
and values for the <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
wildcard flag</a> and the <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode flag</a>.</p>

<p class=note>The <a href=#mime-type>MIME type</a> of the resource is
ignored &mdash; it is assumed to be
Expand Down Expand Up @@ -70666,6 +70770,8 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.7.4 </sp
<li><p>Store the value of the new <a href=#concept-appcache-onlinewhitelist-wildcard title=concept-appcache-onlinewhitelist-wildcard>online whitelist
wildcard flag</a> in <var title="">new cache</var>.</li>

<li><p>Store the value of the new <a href=#concept-appcache-mode title=concept-appcache-mode>cache mode flag</a> in <var title="">new cache</var>.</li>

<li>

<p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
Expand Down Expand Up @@ -70968,6 +71074,15 @@ <h4 id=the-application-cache-selection-algorithm><span class=secno>6.7.5 </span>
the <a href=#concept-appcache-master title=concept-appcache-master>master</a>
resource.</p>

<p>If there are <a href=#relevant-application-cache title="relevant application cache">relevant
application caches</a> that are identified by a URL with the
<a href=#same-origin>same origin</a> as the URL of <var title="">document</var>, and that have this URL as one of their
entries, excluding entries marked as <a href=#concept-appcache-foreign title=concept-appcache-foreign>foreign</a>, then the user
agent should use the <a href=#concept-appcache-selection title=concept-appcache-selection>most
appropriate application cache</a> of those that match as an
HTTP cache for any subresource loads. User agents may also have
other caches in place that are also honored.</p>

</dd>


Expand Down
Loading

0 comments on commit cfa0e09

Please sign in to comment.