Bug 1312864 - Allow redirects for requests that require preflight

Reviewers: ckerschb, mrbkap

Reviewed By: ckerschb, mrbkap

Subscribers: ckerschb

Bug #: 1312864

Differential Revision: https://phabricator.services.mozilla.com/D1875

--HG--
extra : rebase_source : 06ae50d91816955ab6bdaa2741ddccb1eb2a3206
This commit is contained in:
vinoth 2018-07-10 15:48:03 +03:00
Родитель b8a74f650b
Коммит 33326b442d
4 изменённых файлов: 34 добавлений и 92 удалений

Просмотреть файл

@ -1122,7 +1122,25 @@ function* runTest() {
},
],
},
{ pass: 0,
{ pass: 1,
method: "POST",
body: "hi there",
headers: { "Content-Type": "text/plain",
"my-header": "myValue",
},
hops: [{ server: "http://example.org",
},
{ server: "http://example.com",
allowOrigin: origin,
allowHeaders: "my-header",
},
{ server: "http://sub1.test1.example.org",
allowOrigin: "*",
allowHeaders: "my-header",
},
],
},
{ pass: 1,
method: "POST",
body: "hi there",
headers: { "Content-Type": "text/plain",
@ -1196,7 +1214,21 @@ function* runTest() {
},
],
},
{ pass: 0,
{ pass: 1,
method: "DELETE",
hops: [{ server: "http://example.org",
},
{ server: "http://example.com",
allowOrigin: origin,
allowMethods: "DELETE",
},
{ server: "http://sub1.test1.example.org",
allowOrigin: "*",
allowMethods: "DELETE",
},
],
},
{ pass: 1,
method: "DELETE",
hops: [{ server: "http://example.org",
},

Просмотреть файл

@ -1076,17 +1076,6 @@ nsCORSListenerProxy::CheckPreflightNeeded(nsIChannel* aChannel, UpdateType aUpda
return NS_OK;
}
// A preflight is needed. But if we've already been cross-site, then
// we already did a preflight when that happened, and so we're not allowed
// to do another preflight again.
if (aUpdateType != UpdateType::InternalOrHSTSRedirect) {
if (mHasBeenCrossSite) {
LogBlockedRequest(aChannel, "CORSPreflightDidNotSucceed", nullptr,
mHttpChannel);
return NS_ERROR_DOM_BAD_URI;
}
}
nsCOMPtr<nsIHttpChannelInternal> internal = do_QueryInterface(http);
if (!internal) {
LogBlockedRequest(aChannel, "CORSDidNotSucceed", nullptr, mHttpChannel);

Просмотреть файл

@ -1,16 +0,0 @@
[redirect-preflight.htm]
[Should allow redirect 301 after succesful (200) preflight]
expected: FAIL
[Should allow redirect 302 after succesful (200) preflight]
expected: FAIL
[Should allow redirect 303 after succesful (200) preflight]
expected: FAIL
[Should allow redirect 307 after succesful (200) preflight]
expected: FAIL
[Should allow redirect 308 after succesful (200) preflight]
expected: FAIL

Просмотреть файл

@ -1,63 +0,0 @@
[cors-redirect-preflight.any.worker.html]
[Redirect 301: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 301: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to another cors (preflight after redirection success case)]
expected: FAIL
[cors-redirect-preflight.any.html]
[Redirect 301: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 301: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to another cors (preflight after redirection success case)]
expected: FAIL