Chromium Code Reviews| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 // Explicitly grant the ability to load local resources to this | 143 // Explicitly grant the ability to load local resources to this |
| 144 // SecurityOrigin. | 144 // SecurityOrigin. |
| 145 // | 145 // |
| 146 // Note: This method exists only to support backwards compatibility | 146 // Note: This method exists only to support backwards compatibility |
| 147 // with older versions of WebKit. | 147 // with older versions of WebKit. |
| 148 void grantLoadLocalResources(); | 148 void grantLoadLocalResources(); |
| 149 | 149 |
| 150 // Explicitly grant the ability to access every other SecurityOrigin. | 150 // Explicitly grant the ability to access every other SecurityOrigin. |
| 151 // | 151 // |
| 152 // WARNING: This is an extremely powerful ability. Use with caution! | 152 // WARNING: This is an extremely powerful ability. Use with caution! |
| 153 // | |
| 154 // TODO(mkwst): Remove this API as soon as is fesiable. That will likely | |
| 155 // require creating a more limited replacement. | |
| 153 void grantUniversalAccess(); | 156 void grantUniversalAccess(); |
| 154 | 157 |
| 158 // Grant `file:` origins universal access. | |
| 159 // | |
| 160 // TODO(mkwst): As soon as we can reasonably get WebView to stop offering | |
| 161 // the API which requires this method, we should remove it. | |
|
Torne
2015/12/09 12:55:56
You can have this comment if you want, but realist
Mike West
2015/12/09 14:17:49
*sigh*
| |
| 162 void grantUniversalAccessForFileOrigins(); | |
| 163 | |
| 155 bool canAccessDatabase() const { return !isUnique(); } | 164 bool canAccessDatabase() const { return !isUnique(); } |
| 156 bool canAccessLocalStorage() const { return !isUnique(); } | 165 bool canAccessLocalStorage() const { return !isUnique(); } |
| 157 bool canAccessSharedWorkers() const { return !isUnique(); } | 166 bool canAccessSharedWorkers() const { return !isUnique(); } |
| 158 bool canAccessServiceWorkers() const { return !isUnique(); } | 167 bool canAccessServiceWorkers() const { return !isUnique(); } |
| 159 bool canAccessCookies() const { return !isUnique(); } | 168 bool canAccessCookies() const { return !isUnique(); } |
| 160 bool canAccessPasswordManager() const { return !isUnique(); } | 169 bool canAccessPasswordManager() const { return !isUnique(); } |
| 161 bool canAccessFileSystem() const { return !isUnique(); } | 170 bool canAccessFileSystem() const { return !isUnique(); } |
| 162 bool canAccessCacheStorage() const { return !isUnique(); } | 171 bool canAccessCacheStorage() const { return !isUnique(); } |
| 163 | 172 |
| 164 // Technically, we should always allow access to sessionStorage, but we | 173 // Technically, we should always allow access to sessionStorage, but we |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 static const KURL& urlWithUniqueSecurityOrigin(); | 230 static const KURL& urlWithUniqueSecurityOrigin(); |
| 222 | 231 |
| 223 // Transfer origin privileges from another security origin. | 232 // Transfer origin privileges from another security origin. |
| 224 // The following privileges are currently copied over: | 233 // The following privileges are currently copied over: |
| 225 // | 234 // |
| 226 // - Grant universal access. | 235 // - Grant universal access. |
| 227 // - Grant loading of local resources. | 236 // - Grant loading of local resources. |
| 228 // - Use path-based file:// origins. | 237 // - Use path-based file:// origins. |
| 229 struct PrivilegeData { | 238 struct PrivilegeData { |
| 230 bool m_universalAccess; | 239 bool m_universalAccess; |
| 240 bool m_universalAccessForFileOrigins; | |
| 231 bool m_canLoadLocalResources; | 241 bool m_canLoadLocalResources; |
| 232 bool m_blockLocalAccessFromLocalOrigin; | 242 bool m_blockLocalAccessFromLocalOrigin; |
| 233 }; | 243 }; |
| 234 PassOwnPtr<PrivilegeData> createPrivilegeData() const; | 244 PassOwnPtr<PrivilegeData> createPrivilegeData() const; |
| 235 void transferPrivilegesFrom(PassOwnPtr<PrivilegeData>); | 245 void transferPrivilegesFrom(PassOwnPtr<PrivilegeData>); |
| 236 | 246 |
| 237 private: | 247 private: |
| 238 friend class SecurityOriginTest; | 248 friend class SecurityOriginTest; |
| 239 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, Suborigins); | 249 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, Suborigins); |
| 240 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, SuboriginsParsing); | 250 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, SuboriginsParsing); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 251 static bool deserializeSuboriginAndHost(const String&, String&, String&); | 261 static bool deserializeSuboriginAndHost(const String&, String&, String&); |
| 252 | 262 |
| 253 String m_protocol; | 263 String m_protocol; |
| 254 String m_host; | 264 String m_host; |
| 255 String m_domain; | 265 String m_domain; |
| 256 String m_suboriginName; | 266 String m_suboriginName; |
| 257 unsigned short m_port; | 267 unsigned short m_port; |
| 258 unsigned short m_effectivePort; | 268 unsigned short m_effectivePort; |
| 259 bool m_isUnique; | 269 bool m_isUnique; |
| 260 bool m_universalAccess; | 270 bool m_universalAccess; |
| 271 bool m_universalAccessForFileOrigins; | |
| 261 bool m_domainWasSetInDOM; | 272 bool m_domainWasSetInDOM; |
| 262 bool m_canLoadLocalResources; | 273 bool m_canLoadLocalResources; |
| 263 bool m_blockLocalAccessFromLocalOrigin; | 274 bool m_blockLocalAccessFromLocalOrigin; |
| 264 }; | 275 }; |
| 265 | 276 |
| 266 } // namespace blink | 277 } // namespace blink |
| 267 | 278 |
| 268 #endif // SecurityOrigin_h | 279 #endif // SecurityOrigin_h |
| OLD | NEW |