From 9c7405a58dfedb47c7e43ac93ffcda93b2efffe2 Mon Sep 17 00:00:00 2001 From: Michael Ratcliffe Date: Fri, 2 May 2014 14:39:44 +0100 Subject: [PATCH] Bug 981758 - Fix GCLI appcache validate for * in network section --- .../commandline/test/browser_cmd_appcache_invalid.js | 1 - browser/devtools/shared/AppCacheUtils.jsm | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js b/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js index 432a57f022ed..481e0e0e959f 100644 --- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js +++ b/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js @@ -51,7 +51,6 @@ function spawnTest() { /"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\./, diff --git a/browser/devtools/shared/AppCacheUtils.jsm b/browser/devtools/shared/AppCacheUtils.jsm index 5b36338c6213..2b6d066dc64c 100644 --- a/browser/devtools/shared/AppCacheUtils.jsm +++ b/browser/devtools/shared/AppCacheUtils.jsm @@ -118,7 +118,8 @@ AppCacheUtils.prototype = { 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); @@ -164,7 +165,7 @@ AppCacheUtils.prototype = { this._addError(parsedUri.line, "cacheControlNoStore", parsedUri.original, parsedUri.line); } - } else { + } else if (parsedUri.original !== "*") { this._addError(parsedUri.line, "notAvailable", parsedUri.original, parsedUri.line); }