Initial work on job queues for service workers

This commit is contained in:
Rahul Sharma 2016-10-04 23:57:36 +05:30
parent 6cc1976cca
commit 114c491111
11 changed files with 462 additions and 68 deletions

View file

@ -92,4 +92,18 @@ impl UrlHelper {
let _ = quirks::set_username(url, &value.0);
}
}
// https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy
pub fn is_origin_trustworthy(url: &ServoUrl) -> bool {
// Step 3
if url.scheme() == "http" || url.scheme() == "wss" {
true
// Step 4
} else if url.host().is_some() {
let host = url.host_str().unwrap();
host == "127.0.0.0/8" || host == "::1/128"
// Step 5
} else {
url.scheme() == "file"
}
}
}