public bool IsSameOriginDomain(UrlOrigin other) {/* Docs: https://html.spec.whatwg.org/multipage/origin.html#same-origin-domain */ if (other == null) { return(false); } if (Type == EOriginType.Opaque && other.Type == EOriginType.Opaque) { return(true); } if (Type == EOriginType.Tuple && other.Type == EOriginType.Tuple) { if (Scheme == other.Scheme && !ReferenceEquals(null, Domain) && !ReferenceEquals(null, other.Domain) && Domain.AsSpan().Equals(other.Domain.AsSpan(), StringComparison.Ordinal)) { return(true); } else if (IsSameOrigin(other) && !ReferenceEquals(null, Domain) && !ReferenceEquals(null, other.Domain) && Domain.AsSpan().Equals(other.Domain.AsSpan(), StringComparison.Ordinal)) { return(true); } } return(false); }
public bool IsSameOrigin(UrlOrigin other) {/* Docs: https://html.spec.whatwg.org/multipage/origin.html#same-origin */ if (other == null) { return(false); } if (Type == EOriginType.Opaque && other.Type == EOriginType.Opaque) { return(true); } if (Type == EOriginType.Tuple && other.Type == EOriginType.Tuple) { return(Scheme == other.Scheme && Host == other.Host && Port == other.Port && Domain.AsSpan().Equals(other.Domain.AsSpan(), StringComparison.Ordinal)); } return(false); }