Refactor Servo HSTS file loading, hard-fail if can't load.

Use constructor pattern instead of separate utility function.

Instead of allowing the Servo HSTS file loading to silently fail, we
should expect that file to always exist and be formatted correctly.
This commit is contained in:
Corey Farwell 2016-04-17 12:25:17 -04:00
parent d3b8b6472b
commit faa3d8724b
3 changed files with 11 additions and 14 deletions

View file

@ -10,7 +10,7 @@ use cookie_storage::CookieStorage;
use data_loader;
use devtools_traits::{DevtoolsControlMsg};
use file_loader;
use hsts::{HSTSList, preload_hsts_domains};
use hsts::HSTSList;
use http_loader::{self, Connector, create_http_connector, HttpState};
use hyper::client::pool::Pool;
use hyper::header::{ContentType, Header, SetCookie};
@ -148,11 +148,7 @@ fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result<Pro
/// Create a ResourceThread
pub fn new_resource_thread(user_agent: String,
devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> ResourceThread {
let hsts_preload = match preload_hsts_domains() {
Some(list) => list,
None => HSTSList::new()
};
let hsts_preload = HSTSList::from_servo_preload();
let (setup_chan, setup_port) = ipc::channel().unwrap();
let setup_chan_clone = setup_chan.clone();
spawn_named("ResourceManager".to_owned(), move || {