From b160d6dc73b9ce92827f81517d9b155006a4e422 Mon Sep 17 00:00:00 2001 From: "jennb@chromium.org" Date: Mon, 10 Aug 2009 23:58:18 +0000 Subject: Update manifest parser code to match current HTML5 spec by adding support for whitelisting all URLs using a wildcard and using namespace in place of URL for fallback and network sections. BUG=none TEST=added checks for wildcard character in all sections Review URL: http://codereview.chromium.org/165151 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22972 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/appcache/manifest_parser.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'webkit/appcache/manifest_parser.cc') diff --git a/webkit/appcache/manifest_parser.cc b/webkit/appcache/manifest_parser.cc index b5e8cb8..4930dd6 100644 --- a/webkit/appcache/manifest_parser.cc +++ b/webkit/appcache/manifest_parser.cc @@ -49,8 +49,9 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, static const std::wstring kSignature(L"CACHE MANIFEST"); DCHECK(manifest.explicit_urls.empty()); - DCHECK(manifest.online_whitelisted_urls.empty()); - DCHECK(manifest.fallback_urls.empty()); + DCHECK(manifest.fallback_namespaces.empty()); + DCHECK(manifest.online_whitelist_namespaces.empty()); + DCHECK(!manifest.online_whitelist_all); Mode mode = kExplicit; @@ -125,6 +126,9 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, mode = kUnknown; } else if (mode == kUnknown) { continue; + } else if (line == L"*" && mode == kOnlineWhitelist) { + manifest.online_whitelist_all = true; + continue; } else if (mode == kExplicit || mode == kOnlineWhitelist) { const wchar_t *line_p = line.c_str(); const wchar_t *line_end = line_p + line.length(); @@ -152,7 +156,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, if (mode == kExplicit) { manifest.explicit_urls.insert(url.spec()); } else { - manifest.online_whitelisted_urls.push_back(url); + manifest.online_whitelist_namespaces.push_back(url); } } else if (mode == kFallback) { const wchar_t* line_p = line.c_str(); @@ -212,8 +216,8 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length, // Store regardless of duplicate namespace URL. Only first match // will ever be used. - manifest.fallback_urls.push_back( - std::make_pair(namespace_url, fallback_url)); + manifest.fallback_namespaces.push_back( + FallbackNamespace(namespace_url, fallback_url)); } else { NOTREACHED(); } -- cgit v1.1