Implement history state

This commit is contained in:
Connor Brewster 2018-04-14 01:53:11 -05:00
parent e4472f7c1f
commit 17bd80a7b1
55 changed files with 316 additions and 359 deletions

View file

@ -131,6 +131,7 @@ fn create_http_states(config_dir: Option<&Path>) -> (Arc<HttpState>, Arc<HttpSta
auth_cache: RwLock::new(auth_cache),
http_cache: RwLock::new(http_cache),
hsts_list: RwLock::new(hsts_list),
history_states: RwLock::new(HashMap::new()),
ssl_client: ssl_client.clone(),
connector: create_http_connector(ssl_client),
};
@ -243,6 +244,14 @@ impl ResourceChannelManager {
let cookies = cookie_jar.cookies_data_for_url(&url, source).map(Serde).collect();
consumer.send(cookies).unwrap();
}
CoreResourceMsg::GetHistoryState(history_state_id, consumer) => {
let history_states = http_state.history_states.read().unwrap();
consumer.send(history_states.get(&history_state_id).cloned()).unwrap();
}
CoreResourceMsg::SetHistoryState(history_state_id, history_state) => {
let mut history_states = http_state.history_states.write().unwrap();
history_states.insert(history_state_id, history_state);
}
CoreResourceMsg::Synchronize(sender) => {
let _ = sender.send(());
}