Changeset 250899 in webkit
- Timestamp:
- Oct 9, 2019 12:42:05 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r250898 r250899 1 2019-10-09 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 REGRESSION(r250597): [GTK][WPE] 2.27.1 shows HTML content as text/plain in custom protocols when passing a charset in content type 4 https://bugs.webkit.org/show_bug.cgi?id=202633 5 6 Reviewed by Žan Doberšek. 7 8 This is a regression of the switch to use the new custom protocols implementation. Before r250597, we extracted 9 the mime type and charset from content type in the network process, but we are now sending the response directly 10 from the UI process, so we need to do that when building our response. Rename the mime_type parameter as 11 content_type to avoid confusion, since it's documented as the content type. 12 13 * UIProcess/API/glib/WebKitURISchemeRequest.cpp: 14 (webkitURISchemeRequestReadCallback): 15 (webkit_uri_scheme_request_finish): 16 * UIProcess/API/gtk/WebKitURISchemeRequest.h: 17 * UIProcess/API/wpe/WebKitURISchemeRequest.h: 18 1 19 2019-10-09 Carlos Garcia Campos <cgarcia@igalia.com> 2 20 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp
r250597 r250899 28 28 #include "WebPageProxy.h" 29 29 #include <WebCore/GUniquePtrSoup.h> 30 #include <WebCore/HTTPParsers.h> 30 31 #include <WebCore/ResourceError.h> 31 32 #include <WebCore/URLSoup.h> … … 70 71 char readBuffer[gReadBufferSize]; 71 72 uint64_t bytesRead; 72 CString mimeType;73 CString contentType; 73 74 }; 74 75 … … 179 180 180 181 if (!priv->bytesRead) { 181 ResourceResponse response(priv->task->request().url(), String::fromUTF8(priv->mimeType.data()), priv->streamLength, emptyString()); 182 ResourceResponse response(priv->task->request().url(), extractMIMETypeFromMediaType(priv->contentType.data()), priv->streamLength, emptyString()); 183 response.setTextEncodingName(extractCharsetFromMediaType(priv->contentType.data())); 182 184 priv->task->didReceiveResponse(response); 183 185 } … … 199 201 * @stream: a #GInputStream to read the contents of the request 200 202 * @stream_length: the length of the stream or -1 if not known 201 * @ mime_type: (allow-none): the content type of the stream or %NULL if not known203 * @content_type: (allow-none): the content type of the stream or %NULL if not known 202 204 * 203 205 * Finish a #WebKitURISchemeRequest by setting the contents of the request and its mime type. 204 206 */ 205 void webkit_uri_scheme_request_finish(WebKitURISchemeRequest* request, GInputStream* inputStream, gint64 streamLength, const gchar* mimeType)207 void webkit_uri_scheme_request_finish(WebKitURISchemeRequest* request, GInputStream* inputStream, gint64 streamLength, const gchar* contentType) 206 208 { 207 209 g_return_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request)); … … 214 216 request->priv->cancellable = adoptGRef(g_cancellable_new()); 215 217 request->priv->bytesRead = 0; 216 request->priv-> mimeType = mimeType;218 request->priv->contentType = contentType; 217 219 g_input_stream_read_async(inputStream, request->priv->readBuffer, gReadBufferSize, RunLoopSourcePriority::AsyncIONetwork, request->priv->cancellable.get(), 218 220 reinterpret_cast<GAsyncReadyCallback>(webkitURISchemeRequestReadCallback), g_object_ref(request)); -
trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeRequest.h
r150130 r250899 76 76 GInputStream *stream, 77 77 gint64 stream_length, 78 const gchar * mime_type);78 const gchar *content_type); 79 79 80 80 WEBKIT_API void -
trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeRequest.h
r218553 r250899 77 77 GInputStream *stream, 78 78 gint64 stream_length, 79 const gchar * mime_type);79 const gchar *content_type); 80 80 81 81 WEBKIT_API void -
trunk/Tools/ChangeLog
r250887 r250899 1 2019-10-09 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 REGRESSION(r250597): [GTK][WPE] 2.27.1 shows HTML content as text/plain in custom protocols when passing a charset in content type 4 https://bugs.webkit.org/show_bug.cgi?id=202633 5 6 Reviewed by Žan Doberšek. 7 8 Add a test case. 9 10 * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp: 11 (testWebContextURIScheme): 12 1 13 2019-10-08 Jiewen Tan <jiewen_tan@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp
r250597 r250899 305 305 test->waitUntilLoadFinished(); 306 306 g_assert_true(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed)); 307 308 static const char* charsetHTML = "<html><body><p id='emoji'>🙂</p></body></html>"; 309 test->registerURISchemeHandler("charset", charsetHTML, -1, "text/html; charset=\"UTF-8\""); 310 test->loadURI("charset:test"); 311 test->waitUntilLoadFinished(); 312 mainResourceDataSize = 0; 313 mainResourceData = test->mainResourceData(mainResourceDataSize); 314 g_assert_cmpint(mainResourceDataSize, ==, strlen(charsetHTML)); 315 g_assert_cmpint(strncmp(mainResourceData, charsetHTML, mainResourceDataSize), ==, 0); 316 GUniqueOutPtr<GError> error; 317 auto* javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.getElementById('emoji').innerText", &error.outPtr()); 318 g_assert_nonnull(javascriptResult); 319 g_assert_no_error(error.get()); 320 GUniquePtr<char> emoji(WebViewTest::javascriptResultToCString(javascriptResult)); 321 g_assert_cmpstr(emoji.get(), ==, "🙂"); 307 322 308 323 test->registerURISchemeHandler("empty", nullptr, 0, "text/html");
Note: See TracChangeset
for help on using the changeset viewer.