Changeset 277087 in webkit
- Timestamp:
- May 6, 2021 7:52:13 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r277086 r277087 1 2021-05-06 Chris Dumez <cdumez@apple.com> 2 3 imported/w3c/web-platform-tests/eventsource/format-utf-8.htm is failing on some platforms 4 https://bugs.webkit.org/show_bug.cgi?id=225416 5 <rdar://77529801> 6 7 Reviewed by Youenn Fablet. 8 9 Dump JS Console messages to stderr for this test as it will only get logged on some 10 platforms. 11 12 * TestExpectations: 13 1 14 2021-05-06 Tim Nguyen <ntim@apple.com> 2 15 -
trunk/LayoutTests/TestExpectations
r277086 r277087 388 388 389 389 # Console log lines may appear in a different order so we silence them. 390 imported/w3c/web-platform-tests/eventsource/format-utf-8.htm [ DumpJSConsoleLogInStdErr ] 390 391 imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html [ DumpJSConsoleLogInStdErr Failure Pass ] 391 392 imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ DumpJSConsoleLogInStdErr ] -
trunk/LayoutTests/http/tests/eventsource/eventsource-content-type-charset-expected.txt
r104803 r277087 1 CONSOLE MESSAGE: EventSource's response has a charset ("windows-1251") that is not UTF-8. Aborting the connection.1 CONSOLE MESSAGE: EventSource's response has a charset ("windows-1251") that is not UTF-8. The response will be decoded as UTF-8. 2 2 CONSOLE MESSAGE: EventSource's response has a MIME type ("text/event-stream-foobar") that is not "text/event-stream". Aborting the connection. 3 3 Test for bug 45372: https://bugs.webkit.org/show_bug.cgi?id=45372 -
trunk/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html
r272926 r277087 40 40 41 41 var expectedResultCallback = [ shouldGetMessage, 42 should Fail,42 shouldGetMessage, 43 43 shouldGetMessage, 44 44 shouldGetMessage, -
trunk/Source/WebCore/ChangeLog
r277083 r277087 1 2021-05-06 Chris Dumez <cdumez@apple.com> 2 3 imported/w3c/web-platform-tests/eventsource/format-utf-8.htm is failing on some platforms 4 https://bugs.webkit.org/show_bug.cgi?id=225416 5 <rdar://77529801> 6 7 Reviewed by Youenn Fablet. 8 9 The HTML specification [1] states that EventSource streams should always be decoded as UTF-8. 10 However, we had logic in WebKit that was checking the charset of the response and aborting 11 when the charset is not UTF-8. It looks like we were lucky until now that we would fail to 12 determine the charset of the response and proceed anyway. However, due to underlying system 13 changes, in the context of this test, we are now properly detecting the response charset as 14 "windows-1252" and (incorrectly) aborting. To address the issue, I no longer abort the 15 connection if the charset is not "utf-8". We do still log a console warning but we proceed 16 decoding the stream as UTF-8 no matter the response's charset, as per the specification. 17 18 [1] https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation 19 20 No new tests, covered by existing test that is failing on some platforms. 21 22 * page/EventSource.cpp: 23 (WebCore::EventSource::responseIsValid const): 24 1 25 2021-05-06 Martin Robinson <mrobinson@webkit.org> 2 26 -
trunk/Source/WebCore/page/EventSource.cpp
r251244 r277087 184 184 } 185 185 186 // If we have a charset, the only allowed value is UTF-8 (case-insensitive). 186 // The specification states we should always decode as UTF-8. If there is a provided charset and it is not UTF-8, then log a warning 187 // message but keep going anyway. 187 188 auto& charset = response.textEncodingName(); 188 189 if (!charset.isEmpty() && !equalLettersIgnoringASCIICase(charset, "utf-8")) { 189 auto message = makeString("EventSource's response has a charset (\"", charset, "\") that is not UTF-8. Aborting the connection.");190 auto message = makeString("EventSource's response has a charset (\"", charset, "\") that is not UTF-8. The response will be decoded as UTF-8."); 190 191 // FIXME: Console message would be better with a source code location; where would we get that? 191 192 scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, WTFMove(message)); 192 return false;193 193 } 194 194
Note: See TracChangeset
for help on using the changeset viewer.