Title: [202985] trunk
- Revision
- 202985
- Author
- [email protected]
- Date
- 2016-07-08 10:11:20 -0700 (Fri, 08 Jul 2016)
Log Message
Regression(r201805): Crash with <use> resource that has Vary header
https://bugs.webkit.org/show_bug.cgi?id=159560
<rdar://problem/27034208>
Reviewed by Chris Dumez.
Source/WebCore:
In some situations (SVG <use> element for example) we may try to load resources from frameless documents.
Such loads always fail. The new vary header verification code path tried to access the frame earlier without
null check.
Test: http/tests/cache/vary-frameless-document.html
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::failBeforeStarting):
(WebCore::addAdditionalRequestHeadersToRequest):
Null check frame.
Also move the resource type check here so all callers get the same behavior.
(WebCore::CachedResource::addAdditionalRequestHeaders):
(WebCore::CachedResource::load):
(WebCore::CachedResource::varyHeaderValuesMatch):
LayoutTests:
* http/tests/cache/resources/svg-defs-vary.php: Added.
* http/tests/cache/vary-frameless-document-expected.txt: Added.
* http/tests/cache/vary-frameless-document.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (202984 => 202985)
--- trunk/LayoutTests/ChangeLog 2016-07-08 17:03:12 UTC (rev 202984)
+++ trunk/LayoutTests/ChangeLog 2016-07-08 17:11:20 UTC (rev 202985)
@@ -1,3 +1,15 @@
+2016-07-08 Antti Koivisto <[email protected]>
+
+ Regression(r201805): Crash with <use> resource that has Vary header
+ https://bugs.webkit.org/show_bug.cgi?id=159560
+ <rdar://problem/27034208>
+
+ Reviewed by Chris Dumez.
+
+ * http/tests/cache/resources/svg-defs-vary.php: Added.
+ * http/tests/cache/vary-frameless-document-expected.txt: Added.
+ * http/tests/cache/vary-frameless-document.html: Added.
+
2016-07-08 Commit Queue <[email protected]>
Unreviewed, rolling out r202945.
Added: trunk/LayoutTests/http/tests/cache/resources/svg-defs-vary.php (0 => 202985)
--- trunk/LayoutTests/http/tests/cache/resources/svg-defs-vary.php (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/svg-defs-vary.php 2016-07-08 17:11:20 UTC (rev 202985)
@@ -0,0 +1,12 @@
+<?php
+header("Content-Type: image/svg+xml");
+header("Vary: Cookie");
+header("Cache-Control: max-age=31536000");
+?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+<g id="circle">
+<circle style="fill:green" r="10"/>
+</g>
+</defs>
+</svg>
Added: trunk/LayoutTests/http/tests/cache/vary-frameless-document-expected.txt (0 => 202985)
--- trunk/LayoutTests/http/tests/cache/vary-frameless-document-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/cache/vary-frameless-document-expected.txt 2016-07-08 17:11:20 UTC (rev 202985)
@@ -0,0 +1 @@
+This test passes if it doesn't crash.
Added: trunk/LayoutTests/http/tests/cache/vary-frameless-document.html (0 => 202985)
--- trunk/LayoutTests/http/tests/cache/vary-frameless-document.html (rev 0)
+++ trunk/LayoutTests/http/tests/cache/vary-frameless-document.html 2016-07-08 17:11:20 UTC (rev 202985)
@@ -0,0 +1,19 @@
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+var svgDocumentString = '<svg><use x="50" y="10" xlink:href="" /></svg>';
+function makeDocument() {
+ var doc = document.implementation.createHTMLDocument('');
+ doc.open();
+ doc.write(svgDocumentString);
+ doc.close();
+}
+</script>
+</head>
+<body _onload_="makeDocument()">
+This test passes if it doesn't crash.
+<script>
+document.write(svgDocumentString);
+</script>
Modified: trunk/Source/WebCore/ChangeLog (202984 => 202985)
--- trunk/Source/WebCore/ChangeLog 2016-07-08 17:03:12 UTC (rev 202984)
+++ trunk/Source/WebCore/ChangeLog 2016-07-08 17:11:20 UTC (rev 202985)
@@ -1,3 +1,28 @@
+2016-07-08 Antti Koivisto <[email protected]>
+
+ Regression(r201805): Crash with <use> resource that has Vary header
+ https://bugs.webkit.org/show_bug.cgi?id=159560
+ <rdar://problem/27034208>
+
+ Reviewed by Chris Dumez.
+
+ In some situations (SVG <use> element for example) we may try to load resources from frameless documents.
+ Such loads always fail. The new vary header verification code path tried to access the frame earlier without
+ null check.
+
+ Test: http/tests/cache/vary-frameless-document.html
+
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::failBeforeStarting):
+ (WebCore::addAdditionalRequestHeadersToRequest):
+
+ Null check frame.
+ Also move the resource type check here so all callers get the same behavior.
+
+ (WebCore::CachedResource::addAdditionalRequestHeaders):
+ (WebCore::CachedResource::load):
+ (WebCore::CachedResource::varyHeaderValuesMatch):
+
2016-07-08 Brady Eidson <[email protected]>
Clearing LocalStorage doesn't also delete -wal and -shm files.
Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (202984 => 202985)
--- trunk/Source/WebCore/loader/cache/CachedResource.cpp 2016-07-08 17:03:12 UTC (rev 202984)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp 2016-07-08 17:11:20 UTC (rev 202985)
@@ -183,12 +183,18 @@
error(CachedResource::LoadError);
}
-static void addAdditionalRequestHeadersToRequest(ResourceRequest& request, const CachedResourceLoader& cachedResourceLoader)
+static void addAdditionalRequestHeadersToRequest(ResourceRequest& request, const CachedResourceLoader& cachedResourceLoader, CachedResource::Type type)
{
+ if (type == CachedResource::MainResource)
+ return;
+ // In some cases we may try to load resources in frameless documents. Such loads always fail.
+ // FIXME: We shouldn't get this far.
+ if (!cachedResourceLoader.frame())
+ return;
+
// Note: We skip the Content-Security-Policy check here because we check
// the Content-Security-Policy at the CachedResourceLoader layer so we can
// handle different resource types differently.
-
FrameLoader& frameLoader = cachedResourceLoader.frame()->loader();
String outgoingReferrer;
String outgoingOrigin;
@@ -213,7 +219,7 @@
void CachedResource::addAdditionalRequestHeaders(CachedResourceLoader& cachedResourceLoader)
{
- addAdditionalRequestHeadersToRequest(m_resourceRequest, cachedResourceLoader);
+ addAdditionalRequestHeadersToRequest(m_resourceRequest, cachedResourceLoader, type());
}
void CachedResource::load(CachedResourceLoader& cachedResourceLoader, const ResourceLoaderOptions& options)
@@ -275,8 +281,7 @@
#endif
m_resourceRequest.setPriority(loadPriority());
- if (type() != MainResource)
- addAdditionalRequestHeaders(cachedResourceLoader);
+ addAdditionalRequestHeaders(cachedResourceLoader);
// FIXME: It's unfortunate that the cache layer and below get to know anything about fragment identifiers.
// We should look into removing the expectation of that knowledge from the platform network stacks.
@@ -780,7 +785,7 @@
return true;
ResourceRequest requestWithFullHeaders(request);
- addAdditionalRequestHeadersToRequest(requestWithFullHeaders, cachedResourceLoader);
+ addAdditionalRequestHeadersToRequest(requestWithFullHeaders, cachedResourceLoader, type());
return verifyVaryingRequestHeaders(m_varyingHeaderValues, requestWithFullHeaders, m_sessionID);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes