Bug 981758 - Fix GCLI appcache validate for * in network section
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Fri, 02 May 2014 14:39:44 +0100
changeset 206022 ede61596f87281d1a912769c851af428abbe698f
parent 206021 d0eff5655df235cc00dfcdd8520ccd6562c691b1
child 206023 365fc5eb11697b1f6cbbfcd2f2f867b43c2d0556
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs981758
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 981758 - Fix GCLI appcache validate for * in network section
browser/devtools/commandline/test/browser_cmd_appcache_invalid.js
browser/devtools/shared/AppCacheUtils.jsm
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js
+++ b/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js
@@ -46,17 +46,16 @@ function spawnTest() {
       },
       exec: {
         output: [
           /Manifest has a character encoding of ISO-8859-1\. Manifests must have the utf-8 character encoding\./,
           /The first line of the manifest must be "CACHE MANIFEST" at line 1\./,
           /"CACHE MANIFEST" is only valid on the first line but was found at line 3\./,
           /images\/sound-icon\.png points to a resource that is not available at line 9\./,
           /images\/background\.png points to a resource that is not available at line 10\./,
-          /NETWORK section line 13 \(\/checking\.cgi\) prevents caching of line 13 \(\/checking\.cgi\) in the NETWORK section\./,
           /\/checking\.cgi points to a resource that is not available at line 13\./,
           /Asterisk \(\*\) incorrectly used in the NETWORK section at line 14\. If a line in the NETWORK section contains only a single asterisk character, then any URI not listed in the manifest will be treated as if the URI was listed in the NETWORK section\. Otherwise such URIs will be treated as unavailable\. Other uses of the \* character are prohibited/,
           /\.\.\/rel\.html points to a resource that is not available at line 17\./,
           /\.\.\/\.\.\/rel\.html points to a resource that is not available at line 18\./,
           /\.\.\/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 19\./,
           /\.\.\/\.\.\/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 20\./,
           /\.\.\/\.\.\/\.\.\/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 21\./,
           /\/\.\.\/ is not a valid URI prefix at line 22\./,
--- a/browser/devtools/shared/AppCacheUtils.jsm
+++ b/browser/devtools/shared/AppCacheUtils.jsm
@@ -113,17 +113,18 @@ AppCacheUtils.prototype = {
       }
     }
 
     // Loop through network entries making sure that fallback and cache don't
     // contain uris starting with the network uri.
     for (let neturi of parsed.uris) {
       if (neturi.section == "NETWORK") {
         for (let parsedUri of parsed.uris) {
-          if (parsedUri.uri.startsWith(neturi.uri)) {
+          if (parsedUri.section !== "NETWORK" &&
+              parsedUri.uri.startsWith(neturi.uri)) {
             this._addError(neturi.line, "networkBlocksURI", neturi.line,
                            neturi.original, parsedUri.line, parsedUri.original,
                            parsedUri.section);
           }
         }
       }
     }
 
@@ -159,17 +160,17 @@ AppCacheUtils.prototype = {
           }
 
           // If cache-control: no-store the file will not be added to the
           // appCache.
           if (uriInfo.nocache) {
             this._addError(parsedUri.line, "cacheControlNoStore",
                            parsedUri.original, parsedUri.line);
           }
-        } else {
+        } else if (parsedUri.original !== "*") {
           this._addError(parsedUri.line, "notAvailable",
                          parsedUri.original, parsedUri.line);
         }
 
         if (current == len - 1) {
           deferred.resolve();
         }
       });