| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class KURL; | 40 class KURL; |
| 41 class SecurityOriginCache; | 41 class SecurityOriginCache; |
| 42 | 42 |
| 43 class PLATFORM_EXPORT SecurityOrigin : public RefCounted<SecurityOrigin> { | 43 class PLATFORM_EXPORT SecurityOrigin : public RefCounted<SecurityOrigin> { |
| 44 WTF_MAKE_NONCOPYABLE(SecurityOrigin); | 44 WTF_MAKE_NONCOPYABLE(SecurityOrigin); |
| 45 public: | 45 public: |
| 46 static PassRefPtr<SecurityOrigin> create(const KURL&); | 46 static PassRefPtr<SecurityOrigin> create(const KURL&); |
| 47 static PassRefPtr<SecurityOrigin> createUnique(bool isPotentiallyTrustworthy
, bool shouldBypassSecureContextCheck); |
| 47 static PassRefPtr<SecurityOrigin> createUnique(); | 48 static PassRefPtr<SecurityOrigin> createUnique(); |
| 48 | 49 |
| 49 static PassRefPtr<SecurityOrigin> createFromString(const String&); | 50 static PassRefPtr<SecurityOrigin> createFromString(const String&); |
| 50 static PassRefPtr<SecurityOrigin> create(const String& protocol, const Strin
g& host, int port); | 51 static PassRefPtr<SecurityOrigin> create(const String& protocol, const Strin
g& host, int port); |
| 51 | 52 |
| 52 static void setCache(SecurityOriginCache*); | 53 static void setCache(SecurityOriginCache*); |
| 53 | 54 |
| 54 // Some URL schemes use nested URLs for their security context. For example, | 55 // Some URL schemes use nested URLs for their security context. For example, |
| 55 // filesystem URLs look like the following: | 56 // filesystem URLs look like the following: |
| 56 // | 57 // |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 138 |
| 138 // Returns true if the origin loads resources either from the local | 139 // Returns true if the origin loads resources either from the local |
| 139 // machine or over the network from a | 140 // machine or over the network from a |
| 140 // cryptographically-authenticated origin, as described in | 141 // cryptographically-authenticated origin, as described in |
| 141 // https://w3c.github.io/webappsec/specs/powerfulfeatures/#is-origin-trustwo
rthy. | 142 // https://w3c.github.io/webappsec/specs/powerfulfeatures/#is-origin-trustwo
rthy. |
| 142 bool isPotentiallyTrustworthy() const; | 143 bool isPotentiallyTrustworthy() const; |
| 143 | 144 |
| 144 // Returns a human-readable error message describing that a non-secure origi
n's access to a feature is denied. | 145 // Returns a human-readable error message describing that a non-secure origi
n's access to a feature is denied. |
| 145 static String isPotentiallyTrustworthyErrorMessage(); | 146 static String isPotentiallyTrustworthyErrorMessage(); |
| 146 | 147 |
| 148 void setIsPotentiallyTrustworthySandboxedOrigin(); |
| 149 |
| 150 // Returns true if the origin should bypass the secure context check. |
| 151 bool bypassSecureContextCheck() const; |
| 152 |
| 147 // Returns true if this SecurityOrigin can load local resources, such | 153 // Returns true if this SecurityOrigin can load local resources, such |
| 148 // as images, iframes, and style sheets, and can link to local URLs. | 154 // as images, iframes, and style sheets, and can link to local URLs. |
| 149 // For example, call this function before creating an iframe to a | 155 // For example, call this function before creating an iframe to a |
| 150 // file:// URL. | 156 // file:// URL. |
| 151 // | 157 // |
| 152 // Note: A SecurityOrigin might be allowed to load local resources | 158 // Note: A SecurityOrigin might be allowed to load local resources |
| 153 // without being able to issue an XMLHttpRequest for a local URL. | 159 // without being able to issue an XMLHttpRequest for a local URL. |
| 154 // To determine whether the SecurityOrigin can issue an | 160 // To determine whether the SecurityOrigin can issue an |
| 155 // XMLHttpRequest for a URL, call canRequest(url). | 161 // XMLHttpRequest for a URL, call canRequest(url). |
| 156 bool canLoadLocalResources() const { return m_canLoadLocalResources; } | 162 bool canLoadLocalResources() const { return m_canLoadLocalResources; } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 String m_host; | 276 String m_host; |
| 271 String m_domain; | 277 String m_domain; |
| 272 String m_suboriginName; | 278 String m_suboriginName; |
| 273 unsigned short m_port; | 279 unsigned short m_port; |
| 274 unsigned short m_effectivePort; | 280 unsigned short m_effectivePort; |
| 275 bool m_isUnique; | 281 bool m_isUnique; |
| 276 bool m_universalAccess; | 282 bool m_universalAccess; |
| 277 bool m_domainWasSetInDOM; | 283 bool m_domainWasSetInDOM; |
| 278 bool m_canLoadLocalResources; | 284 bool m_canLoadLocalResources; |
| 279 bool m_blockLocalAccessFromLocalOrigin; | 285 bool m_blockLocalAccessFromLocalOrigin; |
| 286 |
| 287 // True if the origin is unique and should be considered potentially trustwo
rthy. |
| 288 bool m_isUniqueOriginPotentiallyTrustworthy; |
| 289 |
| 290 // True if the origin is unique and should bypass the secure context check. |
| 291 bool m_uniqueOriginShouldBypassSecureContextCheck; |
| 280 }; | 292 }; |
| 281 | 293 |
| 282 } // namespace blink | 294 } // namespace blink |
| 283 | 295 |
| 284 #endif // SecurityOrigin_h | 296 #endif // SecurityOrigin_h |
| OLD | NEW |