HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/7136

SVNBugCommentTime (UTC)
7136[Gecko] [Internet Explorer] [Opera] [Webkit] Add a feature to appcache to make it possible to mark a cache as preferring online resources than cached resources.2012-06-14 22:48
Index: source
===================================================================
--- source	(revision 7135)
+++ source	(revision 7136)
@@ -272,6 +272,7 @@
    <li>Some predefined <a href="#mdvocabs">Microdata vocabularies</a>.</li>
    <li>The <code>data</code> element for marking up machine-readable data.</li><!--DATA--><!--FORK-->
    <li>The <code title="scheme-http+aes">http+aes:</code> and <code title="scheme-http+aes">https+aes:</code> schemes.</li><!--FORK-->
+   <li>The <span>application cache</span> feature's <span title="concept-appcache-mode-prefer-online">prefer-online</span> mode.</li><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
   </ul>
 
 <!--
@@ -79415,10 +79416,11 @@
     application caches</span> that are identified by a URL with the
     <span>same origin</span> as the URL in question, and that have
     this URL as one of their entries, excluding entries marked as
-    <span title="concept-appcache-foreign">foreign</span>, then get
-    the resource from the <span
-    title="concept-appcache-selection">most appropriate application
-    cache</span> of those that match.</p>
+    <span title="concept-appcache-foreign">foreign</span>, and whose
+    <span title="concept-appcache-mode">mode</span> is <span
+    title="concept-appcache-mode-fast">fast</span>, then get the
+    resource from the <span title="concept-appcache-selection">most
+    appropriate application cache</span> 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
@@ -79551,8 +79553,48 @@
 
    </li>
 
+<!--END w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
    <li>
 
+    <p>If the resource was not fetched from an <span>application
+    cache</span>, and was to be fetched using HTTP GET <span
+    title="concept-http-equivalent-get">or equivalent</span>, and
+
+    there are <span title="relevant application cache">relevant
+    application caches</span> that are identified by a URL with the
+    <span>same origin</span> as the URL in question, and that have
+    this URL as one of their entries, excluding entries marked as
+    <span title="concept-appcache-foreign">foreign</span>, and whose
+    <span title="concept-appcache-mode">mode</span> is <span
+    title="concept-appcache-mode-prefer-online">prefer-online</span>,
+    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 <span
+    title="concept-http-equivalent-codes">or equivalent</span>, 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 <span
+    title="concept-appcache-selection">most appropriate application
+    cache</span> 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 <span
+    title="concept-appcache-foreign">foreign</span>, 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>
+<!--START w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+
+   <li>
+
     <p><i>Resource handling</i>: If the resource's out-of-band
     metadata (e.g. HTTP headers), not counting any <span
     title="Content-Type">type information</span> (such as the
@@ -81232,7 +81274,7 @@
 
   <div class="impl">
 
-  <h4 id="appcache">Application caches</h4>
+  <h4 id="appcache">Application caches</h4> <!--APPCACHE-->
 
   <p>An <dfn>application cache</dfn> is a set of cached resources
   consisting of:</p>
@@ -81348,6 +81390,22 @@
 
    </li>
 
+   <li>
+
+    <p>A <dfn title="concept-appcache-mode">cache mode flag</dfn>,
+    which is 
+<!--END w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+    either
+<!--START w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+    in the <dfn title="concept-appcache-mode-fast"><i>fast</i></dfn>
+<!--END w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+    state or the <dfn
+    title="concept-appcache-mode-prefer-online"><i>prefer-online</i></dfn>
+<!--START w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+    state.</p>
+
+   </li>
+
   </ul>
 
   <p>Each <span>application cache</span> has a <dfn
@@ -81636,7 +81694,8 @@
 
    <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>
@@ -81650,6 +81709,11 @@
      <dt><code>NETWORK:</code>
      <dd>Switches to the <dfn title="concept-appcache-manifest-network">online whitelist section</dfn>.
 
+<!--END w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+     <dt><code>SETTINGS:</code>
+     <dd>Switches to the <dfn title="concept-appcache-manifest-settings">settings section</dfn>.
+<!--START w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+
     </dl>
 
     <p>Section header lines must consist of zero or more U+0020 SPACE
@@ -81695,6 +81759,40 @@
     and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION
     (tab) characters.</p>
 
+<!--END w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+    <p>When the current section is the <span
+    title="concept-appcache-manifest-settings">settings
+    section</span>, data lines must consist of zero or more U+0020
+    SPACE and U+0009 CHARACTER TABULATION (tab) characters, a <span
+    title="concept-appcache-manifest-setting">setting</span>, and then
+    zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
+    characters.</p>
+
+    <p>Currently only one <dfn
+    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 <span
+     title="concept-appcache-mode">cache mode</span> to <span
+     title="concept-appcache-mode-prefer-online">prefer-online</span>.
+     (The <span title="concept-appcache-mode">cache mode</span>
+     defaults to <span
+     title="concept-appcache-mode-fast">fast</span>.)</dd>
+
+    </dl>
+
+    <p>Within a <span
+    title="concept-appcache-manifest-settings">settings
+    section</span>, each <span
+    title="concept-appcache-manifest-setting">setting</span> must
+    occur no more than once.</p>
+<!--START w3c-html--><!--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
@@ -81796,6 +81894,9 @@
    title="">blocking</i>. <!--
    concept-appcache-onlinewhitelist-wildcard --></p></li>
 
+   <li><p>Let <var title="">cache mode flag</var> be <i
+   title="">fast</i>. <!-- concept-appcache-mode-fast --></p></li>
+
    <li><p>Let <var title="">input</var> be the decoded text of the
    manifest's byte stream.</p></li>
 
@@ -81869,6 +81970,13 @@
    title="">mode</var> to "online whitelist" and jump back to the step
    labeled "start of line".</p></li>
 
+<!--END w3c-html--><!--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".</p></li>
+<!--START w3c-html--><!--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".</p></li>
@@ -82019,6 +82127,23 @@
 
      </dd>
 
+<!--END w3c-html--><!--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 <span>case-sensitive</span> 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>
+<!--START w3c-html--><!--FORK--><!--APPCACHE-PREFER-ONLINE-->
+
      <dt>If <var title="">mode</var> is "unknown"</dt>
 
      <dd>
@@ -82037,8 +82162,9 @@
 
    <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>.</p></li>
+   whitelist namespaces</var>, the <var title="">online whitelist
+   wildcard flag</var>, and the <var title="">cache mode
+   flag</var>.</p></li>
 
   </ol>
 
@@ -82281,9 +82407,10 @@
     <span title="concept-appcache-fallback-ns">fallback
     namespaces</span> that map to them, entries for the <span
     title="concept-appcache-onlinewhitelist">online whitelist</span>,
-    and a value for the <span
+    and values for the <span
     title="concept-appcache-onlinewhitelist-wildcard">online whitelist
-    wildcard flag</span>.</p>
+    wildcard flag</span> and the <span
+    title="concept-appcache-mode">cache mode flag</span>.</p>
 
     <p class="note">The <span>MIME type</span> of the resource is
     ignored &mdash; it is assumed to be
@@ -82741,6 +82868,10 @@
    title="concept-appcache-onlinewhitelist-wildcard">online whitelist
    wildcard flag</span> in <var title="">new cache</var>.</p></li>
 
+   <li><p>Store the value of the new <span
+   title="concept-appcache-mode">cache mode flag</span> in <var
+   title="">new cache</var>.</p></li>
+
    <li>
 
     <p>For each entry in <var title="">cache group</var>'s <span
@@ -83106,6 +83237,17 @@
     the <span title="concept-appcache-master">master</span>
     resource.</p>
 
+    <p>If there are <span title="relevant application cache">relevant
+    application caches</span> that are identified by a URL with the
+    <span>same origin</span> as the URL of <var
+    title="">document</var>, and that have this URL as one of their
+    entries, excluding entries marked as <span
+    title="concept-appcache-foreign">foreign</span>, then the user
+    agent should use the <span title="concept-appcache-selection">most
+    appropriate application cache</span> 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>
 
 

|