diff --git a/components/net/about_loader.rs b/components/net/about_loader.rs index 6a03aeb041d..cd55dd0b42b 100644 --- a/components/net/about_loader.rs +++ b/components/net/about_loader.rs @@ -19,7 +19,9 @@ pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc, cancel_listener: CancellationListener) { - match load_data.url.non_relative_scheme_data().unwrap() { + let url = load_data.url.clone(); + let non_relative_scheme_data = url.non_relative_scheme_data().unwrap(); + match non_relative_scheme_data { "blank" => { let metadata = Metadata { final_url: load_data.url, @@ -34,9 +36,10 @@ pub fn factory(mut load_data: LoadData, return } "crash" => panic!("Loading the about:crash URL."), - "failure" => { + "failure" | "not-found" => { let mut path = resources_dir_path(); - path.push("failure.html"); + let file_name = non_relative_scheme_data.to_owned() + ".html"; + path.push(&file_name); assert!(path.exists()); load_data.url = Url::from_file_path(&*path).unwrap(); } diff --git a/components/net/file_loader.rs b/components/net/file_loader.rs index a4348049d78..cfffbf0bc80 100644 --- a/components/net/file_loader.rs +++ b/components/net/file_loader.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use about_loader; use mime_classifier::MIMEClassifier; use net_traits::ProgressMsg::{Done, Payload}; use net_traits::{LoadConsumer, LoadData, Metadata}; @@ -13,6 +14,7 @@ use std::fs::File; use std::io::Read; use std::path::PathBuf; use std::sync::Arc; +use url::Url; use util::task::spawn_named; static READ_SIZE: usize = 8192; @@ -96,8 +98,13 @@ pub fn factory(load_data: LoadData, } }; } - Err(e) => { - send_error(url, e.description().to_owned(), senders); + Err(_) => { + // this should be one of the three errors listed in + // http://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.open + // but, we'll go for a "file not found!" + let url = Url::parse("about:not-found").unwrap(); + let load_data_404 = LoadData::new(url, None); + about_loader::factory(load_data_404, senders, classifier, cancel_listener) } } } diff --git a/resources/not-found.html b/resources/not-found.html new file mode 100644 index 00000000000..75e33f7e4d4 --- /dev/null +++ b/resources/not-found.html @@ -0,0 +1,9 @@ + + + about:not-found + + + + + + diff --git a/resources/tumbeast.png b/resources/tumbeast.png new file mode 100644 index 00000000000..a29e5763fdb Binary files /dev/null and b/resources/tumbeast.png differ