Bug 1522940. Bail out of redirect processing immediately if our loadinfo says to not follow redirects. r=mayhemer

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-01-28 14:32:43 +00:00
Родитель fce6da994d
Коммит 5214e58438
2 изменённых файлов: 6 добавлений и 53 удалений

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

@ -5686,6 +5686,12 @@ nsresult nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType) {
if (NS_FAILED(mResponseHead->GetHeader(nsHttp::Location, location)))
return NS_ERROR_FAILURE;
// If we were told to not follow redirects automatically, then again
// carry on as though this were a normal response.
if (mLoadInfo && mLoadInfo->GetDontFollowRedirects()) {
return NS_ERROR_FAILURE;
}
// make sure non-ASCII characters in the location header are escaped.
nsAutoCString locationBuf;
if (NS_EscapeURL(location.get(), -1, esc_OnlyNonASCII | esc_Spaces,

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

@ -1,53 +0,0 @@
[redirect-location.any.worker.html]
[Redirect 301 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 302 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 303 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 307 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 308 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[redirect-location.any.html]
[Redirect 301 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 302 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 303 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 307 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL
[Redirect 308 in "manual" mode with invalid location]
expected:
if os == "android": PASS
FAIL