Bug 981758 - Fix GCLI appcache validate for * in network section

This commit is contained in:
Michael Ratcliffe 2014-05-02 14:39:44 +01:00
parent 5b28af8b83
commit 2de76f5ecd
2 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,6 @@ function spawnTest() {
/"CACHE MANIFEST" is only valid on the first line but was found at line 3\./, /"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\/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\./, /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\./, /\/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/, /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 17\./,

View File

@ -118,7 +118,8 @@ AppCacheUtils.prototype = {
for (let neturi of parsed.uris) { for (let neturi of parsed.uris) {
if (neturi.section == "NETWORK") { if (neturi.section == "NETWORK") {
for (let parsedUri of parsed.uris) { 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, this._addError(neturi.line, "networkBlocksURI", neturi.line,
neturi.original, parsedUri.line, parsedUri.original, neturi.original, parsedUri.line, parsedUri.original,
parsedUri.section); parsedUri.section);
@ -164,7 +165,7 @@ AppCacheUtils.prototype = {
this._addError(parsedUri.line, "cacheControlNoStore", this._addError(parsedUri.line, "cacheControlNoStore",
parsedUri.original, parsedUri.line); parsedUri.original, parsedUri.line);
} }
} else { } else if (parsedUri.original !== "*") {
this._addError(parsedUri.line, "notAvailable", this._addError(parsedUri.line, "notAvailable",
parsedUri.original, parsedUri.line); parsedUri.original, parsedUri.line);
} }