Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement origin concept and browsing contextless documents. #8658

Merged
merged 3 commits into from Apr 13, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Use origin when manipulating cookies.

  • Loading branch information
jdm authored and Ms2ger committed Apr 13, 2016
commit 90454c279d3ff3226f5758709d72f0a7d47f63f6
@@ -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();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.