mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
Make script origins sendable and immutable.
This commit is contained in:
parent
922aef9dd6
commit
555661ef1c
2 changed files with 12 additions and 64 deletions
|
@ -47,48 +47,6 @@ fn alias_cross_origin() {
|
|||
assert!(c.same_origin(&c));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_update_same_origin() {
|
||||
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
|
||||
let b = Origin::new(&Url::parse("http://example.org/b.html").unwrap());
|
||||
let c = b.alias();
|
||||
b.set(Url::parse("http://example.com/c.html").unwrap().origin());
|
||||
assert!(a.same_origin(&c));
|
||||
assert!(b.same_origin(&c));
|
||||
assert!(c.same_origin(&c));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_update_cross_origin() {
|
||||
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
|
||||
let b = Origin::new(&Url::parse("http://example.com/b.html").unwrap());
|
||||
let c = b.alias();
|
||||
b.set(Url::parse("http://example.org/c.html").unwrap().origin());
|
||||
assert!(!a.same_origin(&c));
|
||||
assert!(b.same_origin(&c));
|
||||
assert!(c.same_origin(&c));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_chain() {
|
||||
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
|
||||
let b = Origin::new(&Url::parse("http://example.com/b.html").unwrap());
|
||||
let c = b.copy();
|
||||
let d = c.alias();
|
||||
let e = d.alias();
|
||||
assert!(a.same_origin(&e));
|
||||
assert!(b.same_origin(&e));
|
||||
assert!(c.same_origin(&e));
|
||||
assert!(d.same_origin(&e));
|
||||
assert!(e.same_origin(&e));
|
||||
c.set(Url::parse("http://example.org/c.html").unwrap().origin());
|
||||
assert!(a.same_origin(&b));
|
||||
assert!(!b.same_origin(&c));
|
||||
assert!(c.same_origin(&d));
|
||||
assert!(d.same_origin(&e));
|
||||
assert!(!e.same_origin(&a));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opaque() {
|
||||
let a = Origin::opaque_identifier();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue