Propagating the load errors from network loader

This commit is contained in:
Ravi Shankar 2016-01-01 00:01:24 +05:30 committed by Josh Matthews
parent 8d988f20c1
commit 5e6f32a59b
15 changed files with 208 additions and 152 deletions

View file

@ -18,7 +18,7 @@ use hyper::header::{HeaderView, Headers};
use hyper::method::Method;
use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper::status::StatusClass::Success;
use net_traits::{AsyncResponseListener, Metadata, ResponseAction};
use net_traits::{AsyncResponseListener, Metadata, NetworkError, ResponseAction};
use network_listener::{NetworkListener, PreInvoke};
use script_runtime::ScriptChan;
use std::ascii::AsciiExt;
@ -124,13 +124,15 @@ impl CORSRequest {
// This is shoe-horning the CORSReponse stuff into the rest of the async network
// framework right now. It would be worth redesigning http_fetch to do this properly.
impl AsyncResponseListener for CORSContext {
fn headers_available(&mut self, _metadata: Metadata) {
fn headers_available(&mut self, _metadata: Result<Metadata, NetworkError>) {
}
fn data_available(&mut self, _payload: Vec<u8>) {
}
fn response_complete(&mut self, _status: Result<(), String>) {
fn response_complete(&mut self, _status: Result<(), NetworkError>) {
let response = self.response.take().unwrap();
self.listener.response_available(response);
}