Diff
Modified: branches/safari-601-branch/LayoutTests/ChangeLog (199910 => 199911)
--- branches/safari-601-branch/LayoutTests/ChangeLog 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/LayoutTests/ChangeLog 2016-04-22 21:40:39 UTC (rev 199911)
@@ -1,3 +1,19 @@
+2016-04-22 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r199881. rdar://problem/25879498
+
+ 2016-04-22 Antti Koivisto <an...@apple.com>
+
+ REGRESSION (r194898): Multi download of external SVG defs file by <use> xlinks:href (caching)
+ https://bugs.webkit.org/show_bug.cgi?id=156368
+ <rdar://problem/25611746>
+
+ Reviewed by Simon Fraser.
+
+ * http/tests/svg/resources/symbol-defs.svg: Added.
+ * http/tests/svg/svg-use-external-expected.txt: Added.
+ * http/tests/svg/svg-use-external.html: Added.
+
2016-03-31 Matthew Hanson <matthew_han...@apple.com>
Roll out r191180. rdar://problem/25448882
Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/ChangeLog 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog 2016-04-22 21:40:39 UTC (rev 199911)
@@ -1,3 +1,43 @@
+2016-04-22 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r199881. rdar://problem/25879498
+
+ 2016-04-22 Antti Koivisto <an...@apple.com>
+
+ REGRESSION (r194898): Multi download of external SVG defs file by <use> xlinks:href (caching)
+ https://bugs.webkit.org/show_bug.cgi?id=156368
+ <rdar://problem/25611746>
+
+ Reviewed by Simon Fraser.
+
+ We would load svg resources with fragment identifier again because the encoding never matched.
+
+ Test: http/tests/svg/svg-use-external.html
+
+ * loader/TextResourceDecoder.cpp:
+ (WebCore::TextResourceDecoder::setEncoding):
+ (WebCore::TextResourceDecoder::hasEqualEncodingForCharset):
+
+ Encoding can depend on mime type. Add a comparison function that takes this into account.
+
+ (WebCore::findXMLEncoding):
+ * loader/TextResourceDecoder.h:
+ (WebCore::TextResourceDecoder::encoding):
+ * loader/cache/CachedCSSStyleSheet.h:
+ * loader/cache/CachedResource.h:
+ (WebCore::CachedResource::textResourceDecoder):
+
+ Add a way to get the TextResourceDecoder from a cached resource.
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+
+ Use the new comparison function.
+
+ * loader/cache/CachedSVGDocument.h:
+ * loader/cache/CachedScript.h:
+ * loader/cache/CachedXSLStyleSheet.h:
+
2016-03-31 Matthew Hanson <matthew_han...@apple.com>
Roll out r191180. rdar://problem/25448882
Modified: branches/safari-601-branch/Source/WebCore/loader/TextResourceDecoder.cpp (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/TextResourceDecoder.cpp 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/TextResourceDecoder.cpp 2016-04-22 21:40:39 UTC (rev 199911)
@@ -359,6 +359,11 @@
m_source = source;
}
+bool TextResourceDecoder::hasEqualEncodingForCharset(const String& charset) const
+{
+ return defaultEncoding(m_contentType, charset) == m_encoding;
+}
+
// Returns the position of the encoding string.
static int findXMLEncoding(const char* str, int len, int& encodingLength)
{
Modified: branches/safari-601-branch/Source/WebCore/loader/TextResourceDecoder.h (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/TextResourceDecoder.h 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/TextResourceDecoder.h 2016-04-22 21:40:39 UTC (rev 199911)
@@ -52,6 +52,8 @@
void setEncoding(const TextEncoding&, EncodingSource);
const TextEncoding& encoding() const { return m_encoding; }
+ bool hasEqualEncodingForCharset(const String&) const;
+
WEBCORE_EXPORT String decode(const char* data, size_t length);
WEBCORE_EXPORT String flush();
Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedCSSStyleSheet.h (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedCSSStyleSheet.h 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedCSSStyleSheet.h 2016-04-22 21:40:39 UTC (rev 199911)
@@ -55,6 +55,7 @@
virtual void setEncoding(const String&) override;
virtual String encoding() const override;
+ const TextResourceDecoder* textResourceDecoder() const override { return m_decoder.get(); }
virtual void finishLoading(SharedBuffer*) override;
virtual void destroyDecodedData() override;
Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedResource.h (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedResource.h 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedResource.h 2016-04-22 21:40:39 UTC (rev 199911)
@@ -50,6 +50,7 @@
class SecurityOrigin;
class SharedBuffer;
class SubresourceLoader;
+class TextResourceDecoder;
// A resource that is held in the cache. Classes who want to use this object should derive
// from CachedResourceClient, to get the function calls in case the requested data has arrived.
@@ -98,6 +99,7 @@
virtual void setEncoding(const String&) { }
virtual String encoding() const { return String(); }
+ virtual const TextResourceDecoder* textResourceDecoder() const { return nullptr; }
virtual void addDataBuffer(SharedBuffer&);
virtual void addData(const char* data, unsigned length);
virtual void finishLoading(SharedBuffer*);
Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2016-04-22 21:40:39 UTC (rev 199911)
@@ -701,7 +701,9 @@
if (!existingResource->canReuse(request))
return Reload;
- if (existingResource->encoding() != TextEncoding(cachedResourceRequest.charset()))
+
+ auto* textDecoder = existingResource->textResourceDecoder();
+ if (textDecoder && !textDecoder->hasEqualEncodingForCharset(cachedResourceRequest.charset()))
return Reload;
// Conditional requests should have failed canReuse check.
Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGDocument.h (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGDocument.h 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGDocument.h 2016-04-22 21:40:39 UTC (rev 199911)
@@ -41,6 +41,7 @@
virtual bool mayTryReplaceEncodedData() const override { return true; }
virtual void setEncoding(const String&) override;
virtual String encoding() const override;
+ const TextResourceDecoder* textResourceDecoder() const override { return m_decoder.get(); }
virtual void finishLoading(SharedBuffer*) override;
RefPtr<SVGDocument> m_document;
Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedScript.h (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedScript.h 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedScript.h 2016-04-22 21:40:39 UTC (rev 199911)
@@ -52,6 +52,7 @@
virtual void setEncoding(const String&) override;
virtual String encoding() const override;
+ const TextResourceDecoder* textResourceDecoder() const override { return m_decoder.get(); }
virtual void finishLoading(SharedBuffer*) override;
virtual void destroyDecodedData() override;
Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedXSLStyleSheet.h (199910 => 199911)
--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedXSLStyleSheet.h 2016-04-22 21:32:25 UTC (rev 199910)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedXSLStyleSheet.h 2016-04-22 21:40:39 UTC (rev 199911)
@@ -47,6 +47,7 @@
virtual void didAddClient(CachedResourceClient*) override;
virtual void setEncoding(const String&) override;
virtual String encoding() const override;
+ const TextResourceDecoder* textResourceDecoder() const override { return m_decoder.get(); }
virtual void finishLoading(SharedBuffer*) override;
String m_sheet;