diff options
author | Rahul Sharma <rsconceptx@gmail.com> | 2016-10-04 23:57:36 +0530 |
---|---|---|
committer | Rahul Sharma <rsconceptx@gmail.com> | 2016-11-22 01:29:37 +0530 |
commit | 114c49111138325f7cf1dacbe9d25fdd035ede86 (patch) | |
tree | b535e703eb5f5f26785082efda94cf7be871bafd /components/script/dom/urlhelper.rs | |
parent | 6cc1976cca808cac2069b241885a9c102ee7424d (diff) | |
download | servo-114c49111138325f7cf1dacbe9d25fdd035ede86.tar.gz servo-114c49111138325f7cf1dacbe9d25fdd035ede86.zip |
Initial work on job queues for service workers
Diffstat (limited to 'components/script/dom/urlhelper.rs')
-rw-r--r-- | components/script/dom/urlhelper.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs index dd22e16f551..ec50b4edb71 100644 --- a/components/script/dom/urlhelper.rs +++ b/components/script/dom/urlhelper.rs @@ -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" + } + } } |