Remove the network.http.redirection-limit preference.

The Fetch standard defines this value as twenty; there is no good reason to
allow changing that at runtime.
This commit is contained in:
Ms2ger 2016-11-14 14:08:15 +01:00
parent b63c85c31b
commit 56dd6417e6
4 changed files with 1 additions and 45 deletions

View file

@ -42,7 +42,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::Receiver;
use std::thread;
use url::Url;
use util::prefs::{self, PREFS};
const DEFAULT_USER_AGENT: &'static str = "Test-agent";
@ -1256,45 +1255,6 @@ fn test_load_succeeds_with_a_redirect_loop() {
ResponseBody::Done(b"Success".to_vec()));
}
#[test]
fn test_load_errors_when_there_is_too_many_redirects() {
struct Factory;
impl HttpRequestFactory for Factory {
type R = MockRequest;
fn create(&self, url: Url, _: Method, _: Headers) -> Result<MockRequest, LoadError> {
if url.domain().unwrap() == "mozilla.com" {
Ok(MockRequest::new(ResponseType::Redirect(format!("{}/1", url))))
} else {
panic!("unexpected host {:?}", url)
}
}
}
let url = Url::parse("http://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), &HttpTest);
let http_state = HttpState::new();
let ui_provider = TestProvider::new();
let redirect_limit = 13.;
PREFS.set("network.http.redirection-limit",
prefs::PrefValue::Number(redirect_limit));
match load(&load_data, &ui_provider, &http_state, None, &Factory,
DEFAULT_USER_AGENT.into(), &CancellationListener::new(None), None) {
Err(LoadError { error: LoadErrorType::MaxRedirects(num_redirects),
url, .. }) => {
assert_eq!(num_redirects, redirect_limit as u32);
assert_eq!(url.domain().unwrap(), "mozilla.com");
}
_ => panic!("expected max redirects to fail")
}
PREFS.reset("network.http.redirection-limit");
}
#[test]
fn test_load_follows_a_redirect() {
struct Factory;