[AppCache] Ignore fallback entries whose namespace is not prefixed with manifest...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Jul 2017 22:02:46 +0000 (22:02 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Jul 2017 22:02:46 +0000 (22:02 +0000)
commitb909cd239877cfbcb775f3b161a036010a4d0a72
treeddb268e9b7aaef78d87622ec0d091a9b915a140a
parent0d0b2bc4d6dfd29ee62c1688fd211c5735b1774c
[AppCache] Ignore fallback entries whose namespace is not prefixed with manifest path
https://bugs.webkit.org/show_bug.cgi?id=174273
<rdar://problem/33011682>

Reviewed by Brent Fulgham.

Source/WebCore:

As per <https://html.spec.whatwg.org/multipage/offline.html#parsing-cache-manifests> (07/06/2017)
we should ignore fallback entires whose fallback namespace URL is not prefixed with
the manifest path. For now we only apply this policy when the manifest is served with
a non-standard Content-Type to minimize web compatibility risk.

Test: http/tests/appcache/fallback-namespace-outside-manifest-path.html

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest): Pass the MIME type of the manifest.
* loader/appcache/ManifestParser.cpp:
(WebCore::manifestPath): Computes the manifest path from a manifest URL.
(WebCore::parseManifest): Modified to take the MIME type of the manifest. If the MIME type is
non-standard (i.e. not text/cached-manifest) then skip fallback entries whose namespace is not
prefixed with the manifest path. Otherwise, process fallback entries as we do now. Also cleaned
up the code a bit while I was here, including renaming a local variable to be more descriptive
and using a const character array for the manifest signature to avoid the need to document the
length of the manifest signature in a comment.
* loader/appcache/ManifestParser.h:

LayoutTests:

* http/tests/appcache/fallback-namespace-outside-manifest-path-expected.txt: Added.
* http/tests/appcache/fallback-namespace-outside-manifest-path.html: Added.
* http/tests/appcache/resources/fallback-namespace-outside-manifest-path.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@219272 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/appcache/fallback-namespace-outside-manifest-path-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/appcache/fallback-namespace-outside-manifest-path.html [new file with mode: 0644]
LayoutTests/http/tests/appcache/resources/fallback-namespace-outside-manifest-path.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/appcache/ManifestParser.cpp
Source/WebCore/loader/appcache/ManifestParser.h