Diff
Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (195253 => 195254)
--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog 2016-01-19 08:01:14 UTC (rev 195253)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog 2016-01-19 08:09:03 UTC (rev 195254)
@@ -1,3 +1,14 @@
+2016-01-12 Antti Koivisto <[email protected]>
+
+ Don't reuse memory cache entries with different charset
+ https://bugs.webkit.org/show_bug.cgi?id=110031
+
+ Reviewed by Andreas Kling.
+
+ * fast/loader/cache-encoding-expected.txt: Added.
+ * fast/loader/cache-encoding.html: Added.
+ * fast/loader/resources/success.js: Added.
+
2016-01-11 Carlos Garcia Campos <[email protected]>
Inconsistencies in main resource load delegates when loading from history
Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/cache-encoding-expected.txt (0 => 195254)
--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/cache-encoding-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/cache-encoding-expected.txt 2016-01-19 08:09:03 UTC (rev 195254)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: line 1: SyntaxError: Invalid character '\u8307'
+First load a script with a wrong charset then again with the right one. Second attempt should work and 'scriptSuccess' should be set to true. 'successfullyParsed' will be undefined.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS scriptSuccess is true
+FAIL successfullyParsed should be true (of type boolean). Was undefined (of type undefined).
+
+TEST COMPLETE
+
Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/cache-encoding.html (0 => 195254)
--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/cache-encoding.html (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/cache-encoding.html 2016-01-19 08:09:03 UTC (rev 195254)
@@ -0,0 +1,28 @@
+<script src=""
+<script>
+jsTestIsAsync = true;
+
+description("First load a script with a wrong charset then again with the right one. Second attempt should work and 'scriptSuccess' should be set to true. 'successfullyParsed' will be undefined.");
+
+function appendScriptWithCharset(charset, onload)
+{
+ var script = document.createElement("script");
+ script.src = ""
+ script.setAttribute("charset", charset);
+ script._onload_ = onload;
+ script._onerror_ = onload;
+ document.body.appendChild(script);
+}
+
+function test()
+{
+ appendScriptWithCharset("utf-16", () => {
+ appendScriptWithCharset("utf-8", () => {
+ shouldBeTrue("scriptSuccess");
+ finishJSTest();
+ });
+ });
+}
+</script>
+<body _onload_="test()">
+<script src=""
Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/resources/success.js (0 => 195254)
--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/resources/success.js (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/loader/resources/success.js 2016-01-19 08:09:03 UTC (rev 195254)
@@ -0,0 +1 @@
+scriptSuccess = true;
Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (195253 => 195254)
--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog 2016-01-19 08:01:14 UTC (rev 195253)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog 2016-01-19 08:09:03 UTC (rev 195254)
@@ -1,3 +1,23 @@
+2016-01-12 Antti Koivisto <[email protected]>
+
+ Don't reuse memory cache entries with different charset
+ https://bugs.webkit.org/show_bug.cgi?id=110031
+ rdar://problem/13666418
+
+ Reviewed by Andreas Kling.
+
+ Test: fast/loader/cache-encoding.html
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource):
+ (WebCore::logResourceRevalidationDecision):
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+
+ Pass full CachedResourceRequest to the function.
+ If charset differs don't reuse the cache entry.
+
+ * loader/cache/CachedResourceLoader.h:
+
2016-01-11 Carlos Garcia Campos <[email protected]>
Inconsistencies in main resource load delegates when loading from history
Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/cache/CachedResourceLoader.cpp (195253 => 195254)
--- releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2016-01-19 08:01:14 UTC (rev 195253)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2016-01-19 08:09:03 UTC (rev 195254)
@@ -541,7 +541,7 @@
logMemoryCacheResourceRequest(frame(), resource ? DiagnosticLoggingKeys::inMemoryCacheKey() : DiagnosticLoggingKeys::notInMemoryCacheKey());
- const RevalidationPolicy policy = determineRevalidationPolicy(type, request.mutableResourceRequest(), request.forPreload(), resource.get(), request.defer());
+ const RevalidationPolicy policy = determineRevalidationPolicy(type, request, resource.get());
switch (policy) {
case Reload:
memoryCache.remove(*resource);
@@ -680,13 +680,15 @@
}
}
-CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) const
+CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, CachedResourceRequest& cachedResourceRequest, CachedResource* existingResource) const
{
+ auto& request = cachedResourceRequest.resourceRequest();
+
if (!existingResource)
return Load;
// We already have a preload going for this URL.
- if (forPreload && existingResource->isPreloaded())
+ if (cachedResourceRequest.forPreload() && existingResource->isPreloaded())
return Use;
// If the same URL has been loaded as a different type, we need to reload.
@@ -696,6 +698,9 @@
return Reload;
}
+ if (existingResource->encoding() != TextEncoding(cachedResourceRequest.charset()))
+ return Reload;
+
if (!existingResource->canReuse(request))
return Reload;
@@ -704,7 +709,7 @@
// Do not load from cache if images are not enabled. The load for this image will be blocked
// in CachedImage::load.
- if (CachedResourceRequest::DeferredByClient == defer)
+ if (cachedResourceRequest.defer() == CachedResourceRequest::DeferredByClient)
return Reload;
// Don't reload resources while pasting.
Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/cache/CachedResourceLoader.h (195253 => 195254)
--- releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/cache/CachedResourceLoader.h 2016-01-19 08:01:14 UTC (rev 195253)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/cache/CachedResourceLoader.h 2016-01-19 08:09:03 UTC (rev 195254)
@@ -148,7 +148,7 @@
void requestPreload(CachedResource::Type, CachedResourceRequest&, const String& charset);
enum RevalidationPolicy { Use, Revalidate, Reload, Load };
- RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, ResourceRequest&, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption) const;
+ RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, CachedResourceRequest&, CachedResource* existingResource) const;
bool shouldContinueAfterNotifyingLoadedFromMemoryCache(const CachedResourceRequest&, CachedResource*);
bool checkInsecureContent(CachedResource::Type, const URL&) const;