Title: [228363] branches/safari-605-branch

Diff

Modified: branches/safari-605-branch/LayoutTests/ChangeLog (228362 => 228363)


--- branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-10 06:15:46 UTC (rev 228362)
+++ branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-10 06:25:46 UTC (rev 228363)
@@ -1,5 +1,24 @@
 2018-02-09  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r228241. rdar://problem/37408896
+
+    2018-02-07  Youenn Fablet  <you...@apple.com>
+
+            ASSERTION FAILED: m_timeOrigin in Performance::Performance()
+            https://bugs.webkit.org/show_bug.cgi?id=182558
+            <rdar://problem/37297551>
+
+            Reviewed by Chris Dumez.
+
+            Make use of WPT cors-preflight-star.any.js test in service worker.
+            This test should be removed once WPT will run any.js tests in service workers as well as workers and window.
+
+            * http/wpt/service-workers/cors-preflight-star.any.js: Added.
+            * http/wpt/service-workers/cors-preflight-star.any.serviceworker-expected.txt: Added.
+            * http/wpt/service-workers/cors-preflight-star.any.serviceworker.html: Added.
+
+2018-02-09  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r228340. rdar://problem/37408869
 
     2018-02-08  Wenson Hsieh  <wenson_hs...@apple.com>

Added: branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.js (0 => 228363)


--- branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.js	                        (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.js	2018-02-10 06:25:46 UTC (rev 228363)
@@ -0,0 +1,44 @@
+// META: script=/fetch/api/resources/utils.js
+// META: script=/common/get-host-info.sub.js
+
+const url = "" + dirname(location.pathname) + RESOURCES_DIR + "preflight.py",
+      origin = location.origin // assuming an ASCII origin
+
+function preflightTest(succeeds, withCredentials, allowMethod, allowHeader, useMethod, useHeader) {
+  return promise_test(t => {
+    let testURL = url + "?",
+        requestInit = {}
+    if (withCredentials) {
+      testURL += "origin=" + origin + "&"
+      testURL += "credentials&"
+      requestInit.credentials = "include"
+    }
+    if (useMethod) {
+      requestInit.method = useMethod
+    }
+    if (useHeader.length > 0) {
+      requestInit.headers = [useHeader]
+    }
+    testURL += "allow_methods=" + allowMethod + "&"
+    testURL += "allow_headers=" + allowHeader + "&"
+
+    if (succeeds) {
+      return fetch(testURL, requestInit).then(resp => {
+        assert_equals(resp.headers.get("x-origin"), origin)
+      })
+    } else {
+      return promise_rejects(t, new TypeError(), fetch(testURL, requestInit))
+    }
+  }, "CORS that " + (succeeds ? "succeeds" : "fails") + " with credentials: " + withCredentials + "; method: " + useMethod + " (allowed: " + allowMethod + "); header: " + useHeader + " (allowed: " + allowHeader + ")")
+}
+
+preflightTest(true, false, "get", "x-test", "GET", ["X-Test", "1"])
+preflightTest(true, false, "*", "x-test", "SUPER", ["X-Test", "1"])
+preflightTest(true, false, "*", "*", "OK", ["X-Test", "1"])
+preflightTest(false, true, "*", "*", "OK", ["X-Test", "1"])
+preflightTest(false, true, "*", "", "PUT", [])
+preflightTest(true, true, "PUT", "*", "PUT", [])
+preflightTest(false, true, "put", "*", "PUT", [])
+preflightTest(false, true, "get", "*", "GET", ["X-Test", "1"])
+preflightTest(false, true, "*", "*", "GET", ["X-Test", "1"])
+preflightTest(true, true, "*", "*", "*", ["*", "1"])

Added: branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker-expected.txt (0 => 228363)


--- branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker-expected.txt	                        (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker-expected.txt	2018-02-10 06:25:46 UTC (rev 228363)
@@ -0,0 +1,13 @@
+
+PASS Setting up tests 
+FAIL CORS that succeeds with credentials: false; method: GET (allowed: get); header: X-Test,1 (allowed: x-test) promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful"
+FAIL CORS that succeeds with credentials: false; method: SUPER (allowed: *); header: X-Test,1 (allowed: x-test) promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful"
+FAIL CORS that succeeds with credentials: false; method: OK (allowed: *); header: X-Test,1 (allowed: *) promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful"
+PASS CORS that fails with credentials: true; method: OK (allowed: *); header: X-Test,1 (allowed: *) 
+PASS CORS that fails with credentials: true; method: PUT (allowed: *); header:  (allowed: ) 
+FAIL CORS that succeeds with credentials: true; method: PUT (allowed: PUT); header:  (allowed: *) promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful"
+PASS CORS that fails with credentials: true; method: PUT (allowed: put); header:  (allowed: *) 
+PASS CORS that fails with credentials: true; method: GET (allowed: get); header: X-Test,1 (allowed: *) 
+PASS CORS that fails with credentials: true; method: GET (allowed: *); header: X-Test,1 (allowed: *) 
+FAIL CORS that succeeds with credentials: true; method: * (allowed: *); header: *,1 (allowed: *) promise_test: Unhandled rejection with value: object "TypeError: Preflight response is not successful"
+

Added: branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker.html (0 => 228363)


--- branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker.html	                        (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/wpt/service-workers/cors-preflight-star.any.serviceworker.html	2018-02-10 06:25:46 UTC (rev 228363)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Service Worker: Fetch API CORS preflight tests</title>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+'use strict';
+
+// FIXME: Remove this test once https://github.com/w3c/web-platform-tests/issues/4210 is resolved.
+promise_test(async (t) => {
+    var url = '';
+    var scope = 'empty.html';
+    var frame_sw, sw_registration;
+
+    await service_worker_unregister(t, scope);
+    var f = await with_iframe(scope);
+    t.add_cleanup(function() {
+        f.remove();
+    });
+    frame_sw = f.contentWindow.navigator.serviceWorker;
+    var registration = await navigator.serviceWorker.register(url, {scope: scope});
+    sw_registration = registration;
+    await wait_for_state(t, registration.installing, 'activated');
+    fetch_tests_from_worker(sw_registration.active);
+}, 'Setting up tests');
+
+</script>
+</body>
+</html>

Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (228362 => 228363)


--- branches/safari-605-branch/Source/WebCore/ChangeLog	2018-02-10 06:15:46 UTC (rev 228362)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog	2018-02-10 06:25:46 UTC (rev 228363)
@@ -1,5 +1,22 @@
 2018-02-09  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r228241. rdar://problem/37408896
+
+    2018-02-07  Youenn Fablet  <you...@apple.com>
+
+            ASSERTION FAILED: m_timeOrigin in Performance::Performance()
+            https://bugs.webkit.org/show_bug.cgi?id=182558
+            <rdar://problem/37297551>
+
+            Reviewed by Chris Dumez.
+
+            Test: http/wpt/fetch/cors-preflight-star.any.serviceworker.html
+
+            * loader/CrossOriginPreflightChecker.cpp:
+            (WebCore::CrossOriginPreflightChecker::startPreflight):
+
+2018-02-09  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r228340. rdar://problem/37408869
 
     2018-02-09  Wenson Hsieh  <wenson_hs...@apple.com>

Modified: branches/safari-605-branch/Source/WebCore/loader/CrossOriginPreflightChecker.cpp (228362 => 228363)


--- branches/safari-605-branch/Source/WebCore/loader/CrossOriginPreflightChecker.cpp	2018-02-10 06:15:46 UTC (rev 228362)
+++ branches/safari-605-branch/Source/WebCore/loader/CrossOriginPreflightChecker.cpp	2018-02-10 06:25:46 UTC (rev 228363)
@@ -108,6 +108,7 @@
     options.referrerPolicy = m_loader.options().referrerPolicy;
     options.contentSecurityPolicyImposition = ContentSecurityPolicyImposition::SkipPolicyCheck;
     options.serviceWorkersMode = ServiceWorkersMode::None;
+    options.initiatorContext = m_loader.options().initiatorContext;
 
     CachedResourceRequest preflightRequest(createAccessControlPreflightRequest(m_request, m_loader.securityOrigin(), m_loader.referrer()), options);
     if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to