Title: [279490] trunk
Revision
279490
Author
commit-qu...@webkit.org
Date
2021-07-01 18:03:53 -0700 (Thu, 01 Jul 2021)

Log Message

Align beacon CORS mode with Chrome and Firefox
https://bugs.webkit.org/show_bug.cgi?id=227590

Patch by Alex Christensen <achristen...@webkit.org> on 2021-07-01
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/beacon/beacon-cors.https.window-expected.txt:

Source/WebCore:

This follows https://w3c.github.io/beacon/#sec-processing-model step 6.3.
Now we pass a WPT test that Chrome and Firefox already passed.

* Modules/beacon/NavigatorBeacon.cpp:
(WebCore::NavigatorBeacon::sendBeacon):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279489 => 279490)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-02 00:22:27 UTC (rev 279489)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-02 01:03:53 UTC (rev 279490)
@@ -1,3 +1,12 @@
+2021-07-01  Alex Christensen  <achristen...@webkit.org>
+
+        Align beacon CORS mode with Chrome and Firefox
+        https://bugs.webkit.org/show_bug.cgi?id=227590
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/beacon/beacon-cors.https.window-expected.txt:
+
 2021-07-01  Youenn Fablet  <you...@apple.com>
 
         ReadableStream.getReader do not throw a proper exception when parameter is of wrong type

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.https.window-expected.txt (279489 => 279490)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.https.window-expected.txt	2021-07-02 00:22:27 UTC (rev 279489)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/beacon-cors.https.window-expected.txt	2021-07-02 01:03:53 UTC (rev 279490)
@@ -1,9 +1,9 @@
 
 PASS /common/redirect.py does not support CORS
 PASS cross-origin, CORS-safelisted: type = string
-FAIL cross-origin, CORS-safelisted: type = arraybuffer assert_true: timeout expected true got false
+PASS cross-origin, CORS-safelisted: type = arraybuffer
 PASS cross-origin, CORS-safelisted: type = form
-FAIL cross-origin, CORS-safelisted: type = blob assert_true: timeout expected true got false
+PASS cross-origin, CORS-safelisted: type = blob
 PASS cross-origin, non-CORS-safelisted: failure case (with redirect)
 PASS cross-origin, non-CORS-safelisted: failure case (without redirect)
 PASS cross-origin, non-CORS-safelisted[credentials=false]

Modified: trunk/Source/WebCore/ChangeLog (279489 => 279490)


--- trunk/Source/WebCore/ChangeLog	2021-07-02 00:22:27 UTC (rev 279489)
+++ trunk/Source/WebCore/ChangeLog	2021-07-02 01:03:53 UTC (rev 279490)
@@ -1,3 +1,16 @@
+2021-07-01  Alex Christensen  <achristen...@webkit.org>
+
+        Align beacon CORS mode with Chrome and Firefox
+        https://bugs.webkit.org/show_bug.cgi?id=227590
+
+        Reviewed by Chris Dumez.
+
+        This follows https://w3c.github.io/beacon/#sec-processing-model step 6.3.
+        Now we pass a WPT test that Chrome and Firefox already passed.
+
+        * Modules/beacon/NavigatorBeacon.cpp:
+        (WebCore::NavigatorBeacon::sendBeacon):
+
 2021-07-01  Amir Mark Jr  <amir_m...@apple.com>
 
         Unreviewed, reverting r279481.

Modified: trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp (279489 => 279490)


--- trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp	2021-07-02 00:22:27 UTC (rev 279489)
+++ trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp	2021-07-02 01:03:53 UTC (rev 279490)
@@ -130,7 +130,7 @@
     options.sendLoadCallbacks = SendCallbackPolicy::SendCallbacks;
 
     if (body) {
-        options.mode = FetchOptions::Mode::Cors;
+        options.mode = FetchOptions::Mode::NoCors;
         String mimeType;
         auto result = FetchBody::extract(WTFMove(body.value()), mimeType);
         if (result.hasException())
@@ -142,8 +142,8 @@
         request.setHTTPBody(fetchBody.bodyAsFormData());
         if (!mimeType.isEmpty()) {
             request.setHTTPContentType(mimeType);
-            if (isCrossOriginSafeRequestHeader(HTTPHeaderName::ContentType, mimeType))
-                options.mode = FetchOptions::Mode::NoCors;
+            if (!isCrossOriginSafeRequestHeader(HTTPHeaderName::ContentType, mimeType))
+                options.mode = FetchOptions::Mode::Cors;
         }
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to