Index: LayoutTests/http/tests/fetch/script-tests/fetch-access-control-cors-preflight.js |
diff --git a/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-cors.js b/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-cors-preflight.js |
similarity index 83% |
copy from LayoutTests/http/tests/fetch/script-tests/fetch-access-control-cors.js |
copy to LayoutTests/http/tests/fetch/script-tests/fetch-access-control-cors-preflight.js |
index 46ae832a30697d1d1221e6c8e321f06fc5720c7c..638d6cfe70fded9948c221747809ab796cb6aee9 100644 |
--- a/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-cors.js |
+++ b/LayoutTests/http/tests/fetch/script-tests/fetch-access-control-cors-preflight.js |
@@ -3,74 +3,12 @@ if (self.importScripts) { |
importScripts('/serviceworker/resources/fetch-access-control-util.js'); |
} |
-var TEST_TARGETS = [ |
- // CORS test |
- [OTHER_BASE_URL + 'method=GET&headers=CUSTOM', |
- [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
- onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], |
- [OTHER_BASE_URL + 'method=POST&headers=CUSTOM', |
- [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
- onlyOnServiceWorkerProxiedTest([methodIsPOST, noCustomHeader])], |
- [OTHER_BASE_URL + 'method=PUT&headers=CUSTOM', |
- [fetchError]], |
- [OTHER_BASE_URL + 'method=XXX&headers=CUSTOM', |
- [fetchError]], |
- |
- [OTHER_BASE_URL + 'mode=same-origin&method=GET', [fetchRejected]], |
- [OTHER_BASE_URL + 'mode=same-origin&method=POST', [fetchRejected]], |
- [OTHER_BASE_URL + 'mode=same-origin&method=PUT', [fetchRejected]], |
- [OTHER_BASE_URL + 'mode=same-origin&method=XXX', [fetchRejected]], |
- |
- [OTHER_BASE_URL + 'mode=no-cors&method=GET&headers=CUSTOM', |
- [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
- onlyOnServiceWorkerProxiedTest([methodIsGET, noCustomHeader, authCheck2])], |
- [OTHER_BASE_URL + 'mode=no-cors&method=POST&headers=CUSTOM', |
- [fetchResolved, noContentLength, noServerHeader, noBody, typeOpaque], |
- onlyOnServiceWorkerProxiedTest([methodIsPOST, noCustomHeader])], |
- [OTHER_BASE_URL + 'mode=no-cors&method=PUT&headers=CUSTOM', |
- [fetchError]], |
- [OTHER_BASE_URL + 'mode=no-cors&method=XXX&headers=CUSTOM', |
- [fetchError]], |
+// Tests for CORS preflight fetch. |
+// Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch |
+var TEST_TARGETS = [ |
// method=GET |
- // CORS check |
- // https://fetch.spec.whatwg.org/#concept-cors-check |
- // Tests for Access-Control-Allow-Origin header. |
- [OTHER_BASE_URL + 'mode=cors&method=GET', |
- [fetchRejected]], |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=*', |
- [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
- [methodIsGET, authCheckNone]], |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=' + BASE_ORIGIN, |
- [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
- [methodIsGET]], |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=' + BASE_ORIGIN + |
- ',http://www.example.com', |
- [fetchRejected]], |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=http://www.example.com', |
- [fetchRejected]], |
- |
- // CORS filtered response |
- // https://fetch.spec.whatwg.org/#concept-filtered-response-cors |
- // Tests for Access-Control-Expose-Headers header. |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=*&ACEHeaders=X-ServiceWorker-ServerHeader', |
- [fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsGET]], |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=' + BASE_ORIGIN + |
- '&ACEHeaders=X-ServiceWorker-ServerHeader', |
- [fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsGET]], |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=*&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader', |
- [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsGET]], |
- [OTHER_BASE_URL + 'mode=cors&method=GET&ACAOrigin=' + BASE_ORIGIN + |
- '&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader', |
- [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsGET]], |
- |
- // CORS preflight fetch |
- // https://fetch.spec.whatwg.org/#cors-preflight-fetch |
// Tests for Access-Control-Allow-Headers header. |
[OTHER_BASE_URL + 'mode=cors&method=GET&headers=CUSTOM', |
[fetchRejected]], |
@@ -145,43 +83,6 @@ var TEST_TARGETS = [ |
// method=POST |
- // CORS check |
- // https://fetch.spec.whatwg.org/#concept-cors-check |
- // Tests for Access-Control-Allow-Origin header. |
- [OTHER_BASE_URL + 'mode=cors&method=POST', |
- [fetchRejected]], |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=*', |
- [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
- [methodIsPOST]], |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=' + BASE_ORIGIN, |
- [fetchResolved, noContentLength, noServerHeader, hasBody, typeCors], |
- [methodIsPOST]], |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=' + BASE_ORIGIN + |
- ',http://www.example.com', |
- [fetchRejected]], |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=http://www.example.com', |
- [fetchRejected]], |
- |
- // CORS filtered response |
- // https://fetch.spec.whatwg.org/#concept-filtered-response-cors |
- // Tests for Access-Control-Expose-Headers header. |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=*&ACEHeaders=X-ServiceWorker-ServerHeader', |
- [fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsPOST]], |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=' + BASE_ORIGIN + |
- '&ACEHeaders=X-ServiceWorker-ServerHeader', |
- [fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsPOST]], |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=*&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader', |
- [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsPOST]], |
- [OTHER_BASE_URL + 'mode=cors&method=POST&ACAOrigin=' + BASE_ORIGIN + |
- '&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader', |
- [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors], |
- [methodIsPOST]], |
- |
- // CORS preflight fetch |
- // https://fetch.spec.whatwg.org/#cors-preflight-fetch |
// Tests for Access-Control-Allow-Headers header. |
[OTHER_BASE_URL + 'mode=cors&method=POST&headers=CUSTOM', |
[fetchRejected]], |