write cookie_jar, hsts_list, auth_cache, and local_data to file if profile_dir option is present

This commit is contained in:
Daniel 2016-04-16 21:09:43 -04:00
parent f051028ee8
commit d4f63cda5f
6 changed files with 150 additions and 13 deletions

View file

@ -4,10 +4,12 @@
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use net_traits::storage_thread::{StorageThread, StorageThreadMsg, StorageType};
use resource_thread;
use std::borrow::ToOwned;
use std::collections::BTreeMap;
use std::collections::HashMap;
use url::Url;
use util::opts;
use util::thread::spawn_named;
const QUOTA_SIZE_LIMIT: usize = 5 * 1024 * 1024;
@ -69,6 +71,9 @@ impl StorageManager {
self.clear(sender, url, storage_type)
}
StorageThreadMsg::Exit => {
if let Some(ref profile_dir) = opts::get().profile_dir {
resource_thread::write_json_to_file(&self.local_data, profile_dir, "local_data.json");
}
break
}
}