Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / webkit / browser / appcache / manifest_parser.cc
index 5735fe4..f43d889 100644 (file)
@@ -70,12 +70,15 @@ enum InterceptVerb {
   UNKNOWN_VERB,
 };
 
-Manifest::Manifest() : online_whitelist_all(false) {}
+Manifest::Manifest()
+    : online_whitelist_all(false),
+      did_ignore_intercept_namespaces(false) {
+}
 
 Manifest::~Manifest() {}
 
 bool ParseManifest(const GURL& manifest_url, const char* data, int length,
-                   Manifest& manifest) {
+                   ParseMode parse_mode, Manifest& manifest) {
   // This is an implementation of the parsing algorithm specified in
   // the HTML5 offline web application docs:
   //   http://www.w3.org/TR/html5/offline.html
@@ -92,6 +95,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length,
   DCHECK(manifest.fallback_namespaces.empty());
   DCHECK(manifest.online_whitelist_namespaces.empty());
   DCHECK(!manifest.online_whitelist_all);
+  DCHECK(!manifest.did_ignore_intercept_namespaces);
 
   Mode mode = EXPLICIT;
 
@@ -215,9 +219,14 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length,
       } else {
         bool is_pattern = HasPatternMatchingAnnotation(line_p, line_end);
         manifest.online_whitelist_namespaces.push_back(
-            Namespace(NETWORK_NAMESPACE, url, GURL(), is_pattern));
+            Namespace(APPCACHE_NETWORK_NAMESPACE, url, GURL(), is_pattern));
       }
     } else if (mode == INTERCEPT) {
+      if (parse_mode != PARSE_MANIFEST_ALLOWING_INTERCEPTS) {
+        manifest.did_ignore_intercept_namespaces = true;
+        continue;
+      }
+
       // Lines of the form,
       // <urlnamespace> <intercept_type> <targeturl>
       const wchar_t* line_p = line.c_str();
@@ -295,7 +304,7 @@ bool ParseManifest(const GURL& manifest_url, const char* data, int length,
 
       bool is_pattern = HasPatternMatchingAnnotation(line_p, line_end);
       manifest.intercept_namespaces.push_back(
-          Namespace(INTERCEPT_NAMESPACE, namespace_url,
+          Namespace(APPCACHE_INTERCEPT_NAMESPACE, namespace_url,
                     target_url, is_pattern, verb == EXECUTE));
     } else if (mode == FALLBACK) {
       const wchar_t* line_p = line.c_str();
@@ -359,7 +368,7 @@ 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_namespaces.push_back(
-          Namespace(FALLBACK_NAMESPACE, namespace_url,
+          Namespace(APPCACHE_FALLBACK_NAMESPACE, namespace_url,
                     fallback_url, is_pattern));
     } else {
       NOTREACHED();