mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use origin when manipulating cookies.
This commit is contained in:
parent
fa42b452a0
commit
90454c279d
1 changed files with 6 additions and 8 deletions
|
@ -2519,10 +2519,11 @@ impl DocumentMethods for Document {
|
|||
return Ok(DOMString::new());
|
||||
}
|
||||
|
||||
let url = self.url();
|
||||
if !is_scheme_host_port_tuple(&url) {
|
||||
if !self.origin.is_scheme_host_port_tuple() {
|
||||
return Err(Error::Security);
|
||||
}
|
||||
|
||||
let url = self.url();
|
||||
let (tx, rx) = ipc::channel().unwrap();
|
||||
let _ = self.window.resource_thread().send(GetCookiesForUrl((*url).clone(), tx, NonHTTP));
|
||||
let cookies = rx.recv().unwrap();
|
||||
|
@ -2535,10 +2536,11 @@ impl DocumentMethods for Document {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let url = self.url();
|
||||
if !is_scheme_host_port_tuple(url) {
|
||||
if !self.origin.is_scheme_host_port_tuple() {
|
||||
return Err(Error::Security);
|
||||
}
|
||||
|
||||
let url = self.url();
|
||||
let _ = self.window
|
||||
.resource_thread()
|
||||
.send(SetCookiesForUrl((*url).clone(), String::from(cookie), NonHTTP));
|
||||
|
@ -2742,10 +2744,6 @@ impl DocumentMethods for Document {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_scheme_host_port_tuple(url: &Url) -> bool {
|
||||
url.host().is_some() && url.port_or_default().is_some()
|
||||
}
|
||||
|
||||
fn update_with_current_time_ms(marker: &Cell<u64>) {
|
||||
if marker.get() == Default::default() {
|
||||
let time = time::get_time();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue