Use RequestInit instead of LoadData. Make code look like the spec.

This commit is contained in:
Manish Goregaokar 2016-06-01 18:19:20 +05:30
parent 5e49873af7
commit 8bcf54deb5
4 changed files with 94 additions and 69 deletions

View file

@ -196,18 +196,22 @@ pub trait FetchResponseListener {
impl FetchTaskTarget for IpcSender<FetchResponseMsg> {
fn process_request_body(&mut self, _: &request::Request) {
println!("PRqB");
let _ = self.send(FetchResponseMsg::ProcessRequestBody);
}
fn process_request_eof(&mut self, _: &request::Request) {
println!("PRqE");
let _ = self.send(FetchResponseMsg::ProcessRequestEOF);
}
fn process_response(&mut self, response: &response::Response) {
println!("PR");
let _ = self.send(FetchResponseMsg::ProcessResponse(response.metadata()));
}
fn process_response_eof(&mut self, response: &response::Response) {
println!("PRE");
if response.is_network_error() {
// todo: finer grained errors
let _ = self.send(FetchResponseMsg::ProcessResponse(Err(NetworkError::Internal("Network error".into()))));
@ -412,7 +416,7 @@ pub struct WebSocketConnectData {
pub enum CoreResourceMsg {
/// Request the data associated with a particular URL
Load(LoadData, LoadConsumer, Option<IpcSender<ResourceId>>),
Fetch(LoadData, IpcSender<FetchResponseMsg>),
Fetch(request::RequestInit, IpcSender<FetchResponseMsg>),
/// Try to make a websocket connection to a URL.
WebsocketConnect(WebSocketCommunicate, WebSocketConnectData),
/// Store a set of cookies for a given originating URL