aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/urlhelper.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/urlhelper.rs')
-rw-r--r--components/script/dom/urlhelper.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs
index f678e273876..251f8283e1e 100644
--- a/components/script/dom/urlhelper.rs
+++ b/components/script/dom/urlhelper.rs
@@ -27,4 +27,18 @@ impl UrlHelper {
Some(ref hash) => format!("#{}", hash)
}
}
+
+ /// https://html.spec.whatwg.org/multipage/browsers.html#same-origin
+ pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool {
+ if urlA.host() != urlB.host() {
+ return false
+ }
+ if urlA.scheme != urlB.scheme {
+ return false
+ }
+ if urlA.port() != urlB.port() {
+ return false
+ }
+ return true
+ }
}