Address PR comments

- Remove fn `url_is_local`
- Remove fn `set_local_urls_only`
- Fix `test_fetch_with_local_urls_only`
This commit is contained in:
Stjepan Glavina 2016-03-24 13:36:14 +01:00
parent 6576fde29b
commit 3ec4515a73
3 changed files with 12 additions and 17 deletions

View file

@ -110,8 +110,11 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
let mut response = None;
// Step 2
if request.local_urls_only && !url_is_local(&request.current_url()) {
response = Some(Response::network_error());
if request.local_urls_only {
match &*request.current_url().scheme {
"about" | "blob" | "data" | "filesystem" => (), // Ok, the URL is local.
_ => response = Some(Response::network_error())
}
}
// Step 3
@ -1044,13 +1047,6 @@ fn includes_credentials(url: &Url) -> bool {
false
}
fn url_is_local(url: &Url) -> bool {
match &*url.scheme {
"about" | "blob" | "data" | "filesystem" => true,
_ => false
}
}
fn response_needs_revalidation(_response: &Response) -> bool {
// TODO this function
false