Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight.js

Issue 1762893002: Reland of Set the request mode and the credentials mode of FetchEvent in the service worker correct… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated tyoshino's comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight.js
index fea9e4d5cda996a624cc58af3cd95ea1732d1539..c2b1389db8f7f68fcbbf2e666d6cdc6fbebae40c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/cors-preflight.js
@@ -12,94 +12,110 @@ var TEST_TARGETS = [];
var checkMethod = checkJsonpMethod.bind(this, method);
TEST_TARGETS.push(
// Tests for Access-Control-Allow-Headers header.
- [OTHER_BASE_URL + 'mode=cors&method=' + method + '&headers=CUSTOM',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM',
[fetchRejected]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
'&headers=CUSTOM&ACAOrigin=*',
[fetchRejected]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
'&headers=CUSTOM&ACAOrigin=' + BASE_ORIGIN,
[fetchRejected]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
'&headers=CUSTOM&ACAOrigin=*&ACAHeaders=x-serviceworker-test',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
'&headers=CUSTOM&ACAOrigin=' + BASE_ORIGIN +
'&ACAHeaders=x-serviceworker-test',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&ACAHeaders=x-serviceworker-test&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&ACAHeaders=x-serviceworker-test' +
+ '&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
'&headers=CUSTOM&ACAOrigin=' + BASE_ORIGIN +
- '&ACAHeaders=x-serviceworker-test&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader',
+ '&ACAHeaders=x-serviceworker-test' +
+ '&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
// Test that Access-Control-Allow-Headers is checked in
// CORS preflight fetch.
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PreflightTest=200',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-serviceworker-test&PreflightTest=200',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&ACAHeaders=x-serviceworker-test&PreflightTest=200',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&ACAHeaders=x-serviceworker-test&PreflightTest=200',
[fetchRejected]],
// Test that CORS check is done in both preflight and main fetch.
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAHeaders=x-serviceworker-test&PreflightTest=200',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAHeaders=x-serviceworker-test' +
+ '&PreflightTest=200',
[fetchRejected]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PreflightTest=200',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&PACAOrigin=*&PACAHeaders=x-serviceworker-test' +
+ '&PreflightTest=200',
[fetchRejected]],
// Test that Access-Control-Expose-Headers of CORS preflight is ignored.
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PACEHeaders=Content-Length, X-ServiceWorker-ServerHeader&PreflightTest=200',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-serviceworker-test&PACEHeaders=Content-Length, X-ServiceWorker-ServerHeader&PreflightTest=200',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
// Test that CORS preflight with Status 2XX succeeds.
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PreflightTest=201',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-serviceworker-test&PreflightTest=201',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
// Test that CORS preflight with Status other than 2XX fails.
// https://crbug.com/452394
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PreflightTest=301',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-serviceworker-test&PreflightTest=301',
[fetchRejected]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PreflightTest=401',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-serviceworker-test&PreflightTest=401',
[fetchRejected]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PreflightTest=500',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-serviceworker-test&PreflightTest=500',
[fetchRejected]],
// Test CORS preflight with multiple request headers.
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM2&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM2&ACAOrigin=*' +
+ '&PACAOrigin=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-sErviceworker-s, x-sErviceworker-v&PreflightTest=200',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader2]],
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM2&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-servicewOrker-test&PreflightTest=200',
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM2&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-servicewOrker-test&PreflightTest=200',
[fetchRejected]],
// Test request headers sent in CORS preflight requests.
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-serviceworker-test&PACRMethod=' + method +
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-serviceworker-test&PACRMethod=' + method +
'&PACRHeaders=x-serviceworker-test&PreflightTest=200',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader]],
// Test Access-Control-Request-Headers is sorted https://crbug.com/452391
- [OTHER_BASE_URL + 'mode=cors&method=' + method +
- '&headers=CUSTOM2&ACAOrigin=*&PACAOrigin=*&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-sErviceworker-s, x-sErviceworker-v&PACRMethod=' + method +
+ [OTHER_BASE_URL + 'mode=cors&credentials=same-origin&method=' + method +
+ '&headers=CUSTOM2&ACAOrigin=*&PACAOrigin=*' +
+ '&PACAHeaders=x-servicEworker-u, x-servicEworker-ua, x-servicewOrker-test, x-sErviceworker-s, x-sErviceworker-v&PACRMethod=' + method +
'&PACRHeaders=x-serviceworker-s, x-serviceworker-test, x-serviceworker-u, x-serviceworker-ua, x-serviceworker-v&PreflightTest=200',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors],
[checkMethod, hasCustomHeader2]]);

Powered by Google App Engine
This is Rietveld 408576698