Lines Matching full:origin
14 pub fn url_origin(url: &Url) -> Origin { in url_origin() argument
21 Err(_) => Origin::new_opaque(), in url_origin()
24 "ftp" | "http" | "https" | "ws" | "wss" => Origin::Tuple( in url_origin()
30 "file" => Origin::new_opaque(), in url_origin()
31 _ => Origin::new_opaque(), in url_origin()
35 /// The origin of an URL
37 /// Two URLs with the same origin are considered
41 /// The origin is determined based on the scheme as follows:
43 /// - If the scheme is "blob" the origin is the origin of the
45 /// it is an opaque origin.
47 /// then the origin is a tuple of the scheme, host, and port.
48 /// - If the scheme is anything else, the origin is opaque, meaning
49 /// the URL does not have the same origin as any other URL.
51 /// For more information see <https://url.spec.whatwg.org/#origin>
53 pub enum Origin { enum
61 impl Origin { impl
62 /// Creates a new opaque origin that is only equal to itself.
63 pub fn new_opaque() -> Origin { in new_opaque()
65 Origin::Opaque(OpaqueOrigin(COUNTER.fetch_add(1, Ordering::SeqCst))) in new_opaque()
68 /// Return whether this origin is a (scheme, host, port) tuple
69 /// (as opposed to an opaque origin).
71 matches!(*self, Origin::Tuple(..)) in is_tuple()
74 /// <https://html.spec.whatwg.org/multipage/#ascii-serialisation-of-an-origin>
77 Origin::Opaque(_) => "null".to_owned(), in ascii_serialization()
78 Origin::Tuple(ref scheme, ref host, port) => { in ascii_serialization()
88 /// <https://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin>
91 Origin::Opaque(_) => "null".to_owned(), in unicode_serialization()
92 Origin::Tuple(ref scheme, ref host, port) => { in unicode_serialization()