Changeset 217289 in webkit
- Timestamp:
- May 23, 2017, 12:39:16 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/fast/loader/cache-encoding-expected.txt (modified) (2 diffs)
-
LayoutTests/fast/loader/cache-encoding.html (modified) (1 diff)
-
LayoutTests/http/tests/preload/preload-encoding-expected.txt (modified) (2 diffs)
-
LayoutTests/http/tests/preload/preload-encoding.php (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-charset-01-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/loader/TextResourceDecoder.cpp (modified) (1 diff)
-
Source/WebCore/loader/TextResourceDecoder.h (modified) (2 diffs)
-
Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp (modified) (1 diff)
-
Source/WebCore/loader/cache/CachedResource.cpp (modified) (1 diff)
-
Source/WebCore/loader/cache/CachedResource.h (modified) (2 diffs)
-
Source/WebCore/loader/cache/CachedResourceLoader.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r217285 r217289 1 2017-05-23 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, roll out r215229 4 5 It caused CachedScripts in MemoryCache to be reused with different encodings 6 even though CachedScript potentially has already decoded data or cached hash 7 with a previous encoding. 8 9 * TestExpectations: 10 * fast/loader/cache-encoding-expected.txt: 11 * fast/loader/cache-encoding.html: 12 * http/tests/preload/preload-encoding-expected.txt: 13 * http/tests/preload/preload-encoding.php: 14 1 15 2017-05-23 Ryan Haddad <ryanhaddad@apple.com> 2 16 -
trunk/LayoutTests/TestExpectations
r217285 r217289 1170 1170 ######################################## 1171 1171 1172 webkit.org/b/170122 http/tests/preload/single_download_preload_headers_charset.php [ Pass Failure ] 1173 1172 1174 ######################################## 1173 1175 ### START OF -disabled tests -
trunk/LayoutTests/fast/loader/cache-encoding-expected.txt
r215229 r217289 1 CONSOLE MESSAGE: line 1: SyntaxError: Invalid character '\u8307' 1 2 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. 2 3 … … 5 6 6 7 PASS scriptSuccess is true 7 PASS scriptSuccess is true 8 PASS successfullyParsed is true 8 FAIL successfullyParsed should be true (of type boolean). Was undefined (of type undefined). 9 9 10 10 TEST COMPLETE -
trunk/LayoutTests/fast/loader/cache-encoding.html
r215229 r217289 17 17 function test() 18 18 { 19 appendScriptWithCharset("utf-8", function () { 20 shouldBeTrue("scriptSuccess"); 21 appendScriptWithCharset("utf-16", function () { 19 appendScriptWithCharset("utf-16", function () { 20 appendScriptWithCharset("utf-8", function () { 22 21 shouldBeTrue("scriptSuccess"); 23 22 finishJSTest(); -
trunk/LayoutTests/http/tests/preload/preload-encoding-expected.txt
r215229 r217289 1 CONSOLE MESSAGE: line 1: SyntaxError: Invalid character '\u8307' 1 2 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. 2 3 … … 5 6 6 7 PASS scriptSuccess is true 7 PASS scriptSuccess is true 8 PASS successfullyParsed is true 8 FAIL successfullyParsed should be true (of type boolean). Was undefined (of type undefined). 9 9 10 10 TEST COMPLETE -
trunk/LayoutTests/http/tests/preload/preload-encoding.php
r215229 r217289 20 20 function test() 21 21 { 22 appendScriptWithCharset("utf-8", function () { 23 shouldBeTrue("scriptSuccess"); 24 scriptSuccess = false; 25 appendScriptWithCharset("utf-16", function () { 22 appendScriptWithCharset("utf-16", function () { 23 appendScriptWithCharset("utf-8", function () { 26 24 shouldBeTrue("scriptSuccess"); 27 25 finishJSTest(); -
trunk/LayoutTests/imported/w3c/ChangeLog
r217280 r217289 1 2017-05-23 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, roll out r215229 4 5 It caused CachedScripts in MemoryCache to be reused with different encodings 6 even though CachedScript potentially has already decoded data or cached hash 7 with a previous encoding. 8 9 * web-platform-tests/html/semantics/scripting-1/the-script-element/script-charset-01-expected.txt: 10 1 11 2017-05-23 Emilio Cobos Álvarez <ecobos@igalia.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-charset-01-expected.txt
r215229 r217289 3 3 PASS Script @type: unknown parameters 1 4 4 PASS Script @type: unknown parameters 2 5 FAIL Script @type: unknown parameters 3 assert_equals: expected "śćążź" but got "\ufffd湿\ufffd" 5 PASS Script @type: unknown parameters 3 6 6 PASS Script @type: unknown parameters 4 7 7 PASS Script @type: unknown parameters 5 -
trunk/Source/WebCore/ChangeLog
r217286 r217289 1 2017-05-23 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, roll out r215229 4 5 It caused CachedScripts in MemoryCache to be reused with different encodings 6 even though CachedScript potentially has already decoded data or cached hash 7 with a previous encoding. 8 9 * loader/TextResourceDecoder.cpp: 10 (WebCore::TextResourceDecoder::setEncoding): 11 * loader/TextResourceDecoder.h: 12 (WebCore::TextResourceDecoder::sawError): 13 (WebCore::TextResourceDecoder::encodingSet): Deleted. 14 * loader/cache/CachedCSSStyleSheet.cpp: 15 (WebCore::CachedCSSStyleSheet::setEncoding): 16 * loader/cache/CachedResource.cpp: 17 (WebCore::CachedResource::CachedResource): 18 * loader/cache/CachedResource.h: 19 (WebCore::CachedResource::hasUnknownEncoding): 20 (WebCore::CachedResource::setHasUnknownEncoding): 21 * loader/cache/CachedResourceLoader.cpp: 22 (WebCore::CachedResourceLoader::determineRevalidationPolicy): 23 1 24 2017-05-23 Zalan Bujtas <zalan@apple.com> 2 25 -
trunk/Source/WebCore/loader/TextResourceDecoder.cpp
r215229 r217289 356 356 m_encoding = encoding; 357 357 358 m_encodingSet = true;359 358 m_codec = nullptr; 360 359 m_source = source; -
trunk/Source/WebCore/loader/TextResourceDecoder.h
r215229 r217289 69 69 void useLenientXMLDecoding() { m_useLenientXMLDecoding = true; } 70 70 bool sawError() const { return m_sawError; } 71 bool encodingSet() const { return m_encodingSet; }72 71 73 72 private: … … 97 96 bool m_sawError; 98 97 bool m_usesEncodingDetector; 99 bool m_encodingSet { false };100 98 101 99 std::unique_ptr<HTMLMetaCharsetParser> m_charsetParser; -
trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
r217256 r217289 65 65 void CachedCSSStyleSheet::setEncoding(const String& chs) 66 66 { 67 ASSERT(m_decodedSheetText.isNull());68 67 m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader); 69 68 } -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r215816 r217289 124 124 , m_initiatorName(request.initiatorName()) 125 125 , m_isLinkPreload(request.isLinkPreload()) 126 , m_hasUnknownEncoding(request.isLinkPreload()) 126 127 , m_type(type) 127 128 { -
trunk/Source/WebCore/loader/cache/CachedResource.h
r215229 r217289 233 233 bool isLinkPreload() { return m_isLinkPreload; } 234 234 void setLinkPreload() { m_isLinkPreload = true; } 235 bool hasUnknownEncoding() { return m_hasUnknownEncoding; } 236 void setHasUnknownEncoding(bool hasUnknownEncoding) { m_hasUnknownEncoding = hasUnknownEncoding; } 235 237 236 238 void registerHandle(CachedResourceHandleBase*); … … 335 337 bool m_loading { false }; 336 338 bool m_isLinkPreload { false }; 339 bool m_hasUnknownEncoding { false }; 337 340 338 341 bool m_switchingClientsToRevalidatedResource { false }; -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r216143 r217289 936 936 937 937 auto* textDecoder = existingResource->textResourceDecoder(); 938 if (textDecoder && !textDecoder->hasEqualEncodingForCharset(cachedResourceRequest.charset()) && !textDecoder->encodingSet()) 938 if (textDecoder && !textDecoder->hasEqualEncodingForCharset(cachedResourceRequest.charset())) { 939 if (!existingResource->hasUnknownEncoding()) 940 return Reload; 941 existingResource->setHasUnknownEncoding(false); 939 942 existingResource->setEncoding(cachedResourceRequest.charset()); 943 } 940 944 941 945 // FIXME: We should use the same cache policy for all resource types. The raw resource policy is overly strict
Note:
See TracChangeset
for help on using the changeset viewer.