| Index: url/origin.h
|
| diff --git a/url/origin.h b/url/origin.h
|
| index 89d81da5820823c94b42ef2ac26fc061bc95c0fb..b4bee817a4acec5606cd62ae513b58991c57d1a2 100644
|
| --- a/url/origin.h
|
| +++ b/url/origin.h
|
| @@ -116,19 +116,34 @@ class URL_EXPORT Origin {
|
| const std::string& host() const { return tuple_.host(); }
|
| uint16_t port() const { return tuple_.port(); }
|
|
|
| + // Note that an origin without a suborgin will return the empty string.
|
| + const std::string& suborigin() const { return suborigin_; }
|
| +
|
| bool unique() const { return unique_; }
|
|
|
| // An ASCII serialization of the Origin as per Section 6.2 of RFC 6454, with
|
| // the addition that all Origins with a 'file' scheme serialize to "file://".
|
| + // If the Origin has a suborigin, it will be serialized per
|
| + // https://w3c.github.io/webappsec-suborigins/#serializing.
|
| std::string Serialize() const;
|
|
|
| + // Returns the physical origin for Origin. If the suborigin is empty, this
|
| + // will just return a copy of the Origin. If it has a suborigin, will return
|
| + // the Origin of just the scheme/host/port tuple, without the suborigin. See
|
| + // https://w3c.github.io/webappsec-suborigins/.
|
| + Origin GetPhysicalOrigin() const;
|
| +
|
| // Two Origins are "same-origin" if their schemes, hosts, and ports are exact
|
| - // matches; and neither is unique.
|
| + // matches; and neither is unique. If either of the origins have suborigins,
|
| + // the suborigins also must be exact matches.
|
| bool IsSameOriginWith(const Origin& other) const;
|
| bool operator==(const Origin& other) const {
|
| return IsSameOriginWith(other);
|
| }
|
|
|
| + // Same as above, but ignores suborigins if they exist.
|
| + bool IsSamePhysicalOriginWith(const Origin& other) const;
|
| +
|
| // Efficiently returns what GURL(Serialize()) would without re-parsing the
|
| // URL. This can be used for the (rare) times a GURL representation is needed
|
| // for an Origin.
|
| @@ -152,11 +167,13 @@ class URL_EXPORT Origin {
|
|
|
| SchemeHostPort tuple_;
|
| bool unique_;
|
| + std::string suborigin_;
|
| };
|
|
|
| URL_EXPORT std::ostream& operator<<(std::ostream& out, const Origin& origin);
|
|
|
| URL_EXPORT bool IsSameOriginWith(const GURL& a, const GURL& b);
|
| +URL_EXPORT bool IsSamePhysicalOriginWith(const GURL& a, const GURL& b);
|
|
|
| } // namespace url
|
|
|
|
|