Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Don't reuse memory cache entries with different charset
https://bugs.webkit.org/show_bug.cgi?id=110031 Source/WebCore: 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: LayoutTests: Reviewed by Andreas Kling. * fast/loader/cache-encoding-expected.txt: Added. * fast/loader/cache-encoding.html: Added. * fast/loader/resources/success.js: Added. Canonical link: https://commits.webkit.org/171102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194898 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
81 additions
and 5 deletions.
- +11 −0 LayoutTests/ChangeLog
- +11 −0 LayoutTests/fast/loader/cache-encoding-expected.txt
- +28 −0 LayoutTests/fast/loader/cache-encoding.html
- +1 −0 LayoutTests/fast/loader/resources/success.js
- +20 −0 Source/WebCore/ChangeLog
- +9 −4 Source/WebCore/loader/cache/CachedResourceLoader.cpp
- +1 −1 Source/WebCore/loader/cache/CachedResourceLoader.h
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,28 @@ | ||
<script src="../../resources/js-test-pre.js"></script> | ||
<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 = "resources/success.js"; | ||
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="../../resources/js-test-post.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1 @@ | ||
scriptSuccess = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters