Title: [235397] trunk
Revision
235397
Author
[email protected]
Date
2018-08-27 13:58:07 -0700 (Mon, 27 Aug 2018)

Log Message

REGRESSION(r234985/r234989) WKPageLoadHTMLString with a 16-bit String has the wrong encoding
https://bugs.webkit.org/show_bug.cgi?id=189002

Reviewed by Tim Horton.

Source/WebKit:

* UIProcess/API/C/WKPage.cpp:
(encodingOf):

Tools:

* TestWebKitAPI/Tests/WebKit/WillLoad.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235396 => 235397)


--- trunk/Source/WebKit/ChangeLog	2018-08-27 20:57:29 UTC (rev 235396)
+++ trunk/Source/WebKit/ChangeLog	2018-08-27 20:58:07 UTC (rev 235397)
@@ -1,3 +1,13 @@
+2018-08-27  Alex Christensen  <[email protected]>
+
+        REGRESSION(r234985/r234989) WKPageLoadHTMLString with a 16-bit String has the wrong encoding
+        https://bugs.webkit.org/show_bug.cgi?id=189002
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (encodingOf):
+
 2018-08-27  Wenson Hsieh  <[email protected]>
 
         [Cocoa] Exception (fileType 'dyn.agq8u' is not a valid UTI) raised when dragging an attachment whose file wrapper is a directory

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (235396 => 235397)


--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-08-27 20:57:29 UTC (rev 235396)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-08-27 20:58:07 UTC (rev 235397)
@@ -202,7 +202,7 @@
 static String encodingOf(const String& string)
 {
     if (string.isNull() || !string.is8Bit())
-        "utf-16"_s;
+        return "utf-16"_s;
     return "latin1"_s;
 }
 

Modified: trunk/Tools/ChangeLog (235396 => 235397)


--- trunk/Tools/ChangeLog	2018-08-27 20:57:29 UTC (rev 235396)
+++ trunk/Tools/ChangeLog	2018-08-27 20:58:07 UTC (rev 235397)
@@ -1,3 +1,13 @@
+2018-08-27  Alex Christensen  <[email protected]>
+
+        REGRESSION(r234985/r234989) WKPageLoadHTMLString with a 16-bit String has the wrong encoding
+        https://bugs.webkit.org/show_bug.cgi?id=189002
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebKit/WillLoad.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2018-08-27  Wenson Hsieh  <[email protected]>
 
         [Cocoa] Exception (fileType 'dyn.agq8u' is not a valid UTI) raised when dragging an attachment whose file wrapper is a directory

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/WillLoad.cpp (235396 => 235397)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/WillLoad.cpp	2018-08-27 20:57:29 UTC (rev 235396)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/WillLoad.cpp	2018-08-27 20:58:07 UTC (rev 235397)
@@ -218,6 +218,18 @@
     testWillLoadDataRequestReturnValues(baseURL.get(), Util::toWK("text/html").get(), Util::toWK("latin1").get(), unreachableURL.get(), 0);
 }
 
+TEST_F(WebKit2WillLoadTest, WKPageLoadAlternateHTMLStringUTF16)
+{
+    auto htmlString = Util::toWK("<body>Hello, World 😊</body>");
+
+    auto baseURL = adoptWK(WKURLCreateWithUTF8CString("about:blank"));
+    auto unreachableURL = adoptWK(WKURLCreateWithUTF8CString("about:other"));
+
+    WKPageLoadAlternateHTMLString(webView->page(), htmlString.get(), baseURL.get(), unreachableURL.get());
+
+    testWillLoadDataRequestReturnValues(baseURL.get(), Util::toWK("text/html").get(), Util::toWK("utf-16").get(), unreachableURL.get(), 0);
+}
+
 TEST_F(WebKit2WillLoadTest, WKPageLoadPlainTextStringWithUserData)
 {
     WKRetainPtr<WKStringRef> plaintTextString = Util::toWK("Hello, World");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to