Title: [264642] trunk
Revision
264642
Author
[email protected]
Date
2020-07-20 17:53:46 -0700 (Mon, 20 Jul 2020)

Log Message

Revert r262776 for existing apps using UIWebView/WebView
https://bugs.webkit.org/show_bug.cgi?id=214528
<rdar://problem/65468982>

Patch by Alex Christensen <[email protected]> on 2020-07-20
Reviewed by Tim Horton.

Source/WebCore:

r262776 removed Content-Type: application/x-www-form-urlencoded from POST requests with unspecified content type.
This matches the behavior of Chrome, Firefox, and WKWebView and is a change we want to make.
This doesn't match behavior of iOS 13 UIWebView, though, and given its state of being supported for compatibility until removed,
we are going to keep it behaving as it always has.

Updated WK1 test expectations.

* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):

LayoutTests:

* platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-async-expected.txt: Added.
* platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-sync-expected.txt: Added.
* platform/mac-wk1/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264641 => 264642)


--- trunk/LayoutTests/ChangeLog	2020-07-21 00:33:59 UTC (rev 264641)
+++ trunk/LayoutTests/ChangeLog	2020-07-21 00:53:46 UTC (rev 264642)
@@ -1,3 +1,15 @@
+2020-07-20  Alex Christensen  <[email protected]>
+
+        Revert r262776 for existing apps using UIWebView/WebView
+        https://bugs.webkit.org/show_bug.cgi?id=214528
+        <rdar://problem/65468982>
+
+        Reviewed by Tim Horton.
+
+        * platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-async-expected.txt: Added.
+        * platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-sync-expected.txt: Added.
+        * platform/mac-wk1/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt: Added.
+
 2020-07-20  Keith Miller  <[email protected]>
 
         Reduce number of iterations for weakref tests

Added: trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-async-expected.txt (0 => 264642)


--- trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-async-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-async-expected.txt	2020-07-21 00:53:46 UTC (rev 264642)
@@ -0,0 +1,24 @@
+CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/access-control-allow-lists.php due to access control checks.
+Test verifies that content MIME type is set correctly when Blob is sent using XMLHttpRequest asynchronously.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS expectedMimeType is "text/plain;charset=utf-8"
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+PASS expectedMimeType is "multipart/mixed;boundary=\"--blob-boundary"
+PASS expectedMimeType is "multipart/mixed;boundary=\"--blob-boundary\""
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+PASS Cross-origin request without CORS headers should fail.
+PASS expectedMimeType is "text/plain;charset=utf-8"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-sync-expected.txt (0 => 264642)


--- trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-sync-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/post-blob-content-type-sync-expected.txt	2020-07-21 00:53:46 UTC (rev 264642)
@@ -0,0 +1,24 @@
+CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/access-control-allow-lists.php due to access control checks.
+Test verifies that content MIME type is set correctly when Blob is sent using XMLHttpRequest synchronously.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS expectedMimeType is "text/plain;charset=utf-8"
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+PASS expectedMimeType is "multipart/mixed;boundary=\"--blob-boundary"
+PASS expectedMimeType is "multipart/mixed;boundary=\"--blob-boundary\""
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+FAIL expectedMimeType should be . Was application/x-www-form-urlencoded.
+PASS Exception should be thrown.
+PASS expectedMimeType is "text/plain;charset=utf-8"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt (0 => 264642)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type-expected.txt	2020-07-21 00:53:46 UTC (rev 264642)
@@ -0,0 +1,10 @@
+
+FAIL Synchronous blob loading with no mime type [POST] assert_equals: expected "NO" but got "application/x-www-form-urlencoded"
+FAIL Asynchronous blob loading with no mime type [POST] assert_equals: expected "NO" but got "application/x-www-form-urlencoded"
+PASS Synchronous blob loading with no mime type [PUT] 
+PASS Asynchronous blob loading with no mime type [PUT] 
+FAIL Synchronous blob loading with invalid mime type [POST] assert_equals: expected "NO" but got "application/x-www-form-urlencoded"
+FAIL Asynchronous blob loading with invalid mime type [POST] assert_equals: expected "NO" but got "application/x-www-form-urlencoded"
+PASS Synchronous blob loading with invalid mime type [PUT] 
+PASS Asynchronous blob loading with invalid mime type [PUT] 
+

Modified: trunk/Source/WebCore/ChangeLog (264641 => 264642)


--- trunk/Source/WebCore/ChangeLog	2020-07-21 00:33:59 UTC (rev 264641)
+++ trunk/Source/WebCore/ChangeLog	2020-07-21 00:53:46 UTC (rev 264642)
@@ -1,3 +1,21 @@
+2020-07-20  Alex Christensen  <[email protected]>
+
+        Revert r262776 for existing apps using UIWebView/WebView
+        https://bugs.webkit.org/show_bug.cgi?id=214528
+        <rdar://problem/65468982>
+
+        Reviewed by Tim Horton.
+
+        r262776 removed Content-Type: application/x-www-form-urlencoded from POST requests with unspecified content type.
+        This matches the behavior of Chrome, Firefox, and WKWebView and is a change we want to make.
+        This doesn't match behavior of iOS 13 UIWebView, though, and given its state of being supported for compatibility until removed,
+        we are going to keep it behaving as it always has.
+
+        Updated WK1 test expectations.
+
+        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
+        (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
+
 2020-07-20  Peng Liu  <[email protected]>
 
         An airplaying video can enter picture-in-picture

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (264641 => 264642)


--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm	2020-07-21 00:33:59 UTC (rev 264641)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm	2020-07-21 00:53:46 UTC (rev 264642)
@@ -121,15 +121,8 @@
     redirectResponse = synthesizeRedirectResponseIfNecessary([connection currentRequest], newRequest, redirectResponse);
 
     // See <rdar://problem/5380697>. This is a workaround for a behavior change in CFNetwork where willSendRequest gets called more often.
-    if (!redirectResponse) {
-        // CFNetwork will add "application/x-www-form-urlencoded" content-type for POST, even if no Content-Type was specified, remove it in that case.
-        if (m_handle && equalLettersIgnoringASCIICase(m_handle->firstRequest().httpMethod(), "post") && !m_handle->firstRequest().hasHTTPHeaderField(HTTPHeaderName::ContentType)) {
-            auto mutableModifiedRequest = adoptNS([newRequest mutableCopy]);
-            [mutableModifiedRequest setValue:nil forHTTPHeaderField:@"Content-Type"];
-            return mutableModifiedRequest.autorelease();
-        }
+    if (!redirectResponse)
         return newRequest;
-    }
 
 #if !LOG_DISABLED
     if ([redirectResponse isKindOfClass:[NSHTTPURLResponse class]])
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to