Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix step 31 of the Request constructor. #12851

Merged
merged 1 commit into from Aug 13, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -32,7 +32,7 @@ use net_traits::request::Request as NetTraitsRequest;
use net_traits::request::RequestMode as NetTraitsRequestMode;
use net_traits::request::Type as NetTraitsRequestType;
use net_traits::request::{Origin, Window};
use std::cell::{Cell, Ref};
use std::cell::Cell;
use url::Url;

#[dom_struct]
@@ -144,7 +144,7 @@ impl Request {
// Step 12
let mut request: NetTraitsRequest;
request = net_request_from_global(global,
get_current_url(&temporary_request).unwrap().clone(),
temporary_request.current_url(),
false);
request.method = temporary_request.method;
request.headers = temporary_request.headers.clone();
@@ -214,8 +214,6 @@ impl Request {
return Err(Error::Type(
"RequestInit's referrer has invalid origin".to_string()));
}
// TODO: Requires Step 7.

// Step 14.7
*request.referer.borrow_mut() = NetTraitsRequestReferer::RefererUrl(parsed_referrer);
}
@@ -339,7 +337,7 @@ impl Request {
}

// Step 31
r.Headers().fill(Some(HeadersOrByteStringSequenceSequence::Headers(headers_copy)));
try!(r.Headers().fill(Some(HeadersOrByteStringSequenceSequence::Headers(headers_copy))));

// Step 32
let input_body = if let RequestInfo::Request(ref input_request) = input {
@@ -433,16 +431,6 @@ fn net_request_from_global(global: GlobalRef,
Some(pipeline_id))
}

// https://fetch.spec.whatwg.org/#concept-request-current-url
fn get_current_url(req: &NetTraitsRequest) -> Option<Ref<Url>> {
let url_list = req.url_list.borrow();
if url_list.len() > 0 {
Some(Ref::map(url_list, |urls| urls.last().unwrap()))
} else {
None
}
}

fn normalized_method_to_typed_method(m: &str) -> hyper::method::Method {
match m {
"DELETE" => hyper::method::Method::Delete,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.