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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // Returns true if a given URL is secure, based either directly on its | 96 // Returns true if a given URL is secure, based either directly on its |
97 // own protocol, or, when relevant, on the protocol of its "inner URL" | 97 // own protocol, or, when relevant, on the protocol of its "inner URL" |
98 // Protocols like blob: and filesystem: fall into this latter category. | 98 // Protocols like blob: and filesystem: fall into this latter category. |
99 static bool isSecure(const KURL&); | 99 static bool isSecure(const KURL&); |
100 | 100 |
101 // Returns true if this SecurityOrigin can script objects in the given | 101 // Returns true if this SecurityOrigin can script objects in the given |
102 // SecurityOrigin. For example, call this function before allowing | 102 // SecurityOrigin. For example, call this function before allowing |
103 // script from one security origin to read or write objects from | 103 // script from one security origin to read or write objects from |
104 // another SecurityOrigin. | 104 // another SecurityOrigin. |
| 105 // |
| 106 // This takes suborigins into account. |
105 bool canAccess(const SecurityOrigin*) const; | 107 bool canAccess(const SecurityOrigin*) const; |
106 | 108 |
107 // Same as canAccess, except that it adds an additional check to make sure | |
108 // that the SecurityOrigins have the same suborigin name. If you're not | |
109 // familiar with Suborigins, you probably want canAccess() for now. | |
110 // Suborigins is a spec in progress, and where it should be enforced is | |
111 // still in flux. See https://crbug.com/336894 for more details. | |
112 // | |
113 // TODO(jww): Once the Suborigin spec has become more settled, and we are | |
114 // confident in the correctness of our implementation, canAccess should be | |
115 // made to check the suborigin and this should be turned into | |
116 // canAccessBypassSuborigin check, which should be the exceptional case. | |
117 bool canAccessCheckSuborigins(const SecurityOrigin*) const; | |
118 | |
119 // Returns true if this SecurityOrigin can read content retrieved from | 109 // Returns true if this SecurityOrigin can read content retrieved from |
120 // the given URL. For example, call this function before issuing | 110 // the given URL. For example, call this function before issuing |
121 // XMLHttpRequests. | 111 // XMLHttpRequests. |
122 bool canRequest(const KURL&) const; | 112 bool canRequest(const KURL&) const; |
123 | 113 |
124 // Same as canRequest, except that it adds an additional check to make sure | 114 // Same as canRequest, except that it adds an additional check to make sure |
125 // that the SecurityOrigin does not have a suborigin name. Like with | 115 // that the SecurityOrigin does not have a suborigin name. If you're not |
126 // canAccessCheckSuborigins() above, if you're not familiar with | 116 // familiar with Suborigins, you probably want canRequest() for now. |
127 // Suborigins, you probably want canRequest() for now. Suborigins is a spec | 117 // Suborigins is a spec in progress, and where it should be enforced is still |
128 // in progress, and where it should be enforced is still in flux. See | 118 // in flux. See https://crbug.com/336894 for more details. |
129 // https://crbug.com/336894 for more details. | |
130 // | 119 // |
131 // TODO(jww): Once the Suborigin spec has become more settled, and we are | 120 // TODO(jww): Once the Suborigin spec has become more settled, and we are |
132 // confident in the correctness of our implementation, canRequest should be | 121 // confident in the correctness of our implementation, canRequest should be |
133 // made to check the suborigin and this should be turned into | 122 // made to check the suborigin and this should be turned into |
134 // canRequestBypassSuborigin check, which should be the exceptional case. | 123 // canRequestBypassSuborigin check, which should be the exceptional case. |
135 bool canRequestNoSuborigin(const KURL&) const; | 124 bool canRequestNoSuborigin(const KURL&) const; |
136 | 125 |
137 // Returns true if drawing an image from this URL taints a canvas from | 126 // Returns true if drawing an image from this URL taints a canvas from |
138 // this security origin. For example, call this function before | 127 // this security origin. For example, call this function before |
139 // drawing an image onto an HTML canvas element with the drawImage API. | 128 // drawing an image onto an HTML canvas element with the drawImage API. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 bool m_universalAccess; | 296 bool m_universalAccess; |
308 bool m_domainWasSetInDOM; | 297 bool m_domainWasSetInDOM; |
309 bool m_canLoadLocalResources; | 298 bool m_canLoadLocalResources; |
310 bool m_blockLocalAccessFromLocalOrigin; | 299 bool m_blockLocalAccessFromLocalOrigin; |
311 bool m_isUniqueOriginPotentiallyTrustworthy; | 300 bool m_isUniqueOriginPotentiallyTrustworthy; |
312 }; | 301 }; |
313 | 302 |
314 } // namespace blink | 303 } // namespace blink |
315 | 304 |
316 #endif // SecurityOrigin_h | 305 #endif // SecurityOrigin_h |
OLD | NEW |