OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 , m_needsDatabaseIdentifierQuirkForFiles(false) | 127 , m_needsDatabaseIdentifierQuirkForFiles(false) |
128 { | 128 { |
129 // document.domain starts as m_host, but can be set by the DOM. | 129 // document.domain starts as m_host, but can be set by the DOM. |
130 m_domain = m_host; | 130 m_domain = m_host; |
131 | 131 |
132 if (isDefaultPortForProtocol(m_port, m_protocol)) | 132 if (isDefaultPortForProtocol(m_port, m_protocol)) |
133 m_port = InvalidPort; | 133 m_port = InvalidPort; |
134 | 134 |
135 // By default, only local SecurityOrigins can load local resources. | 135 // By default, only local SecurityOrigins can load local resources. |
136 m_canLoadLocalResources = isLocal(); | 136 m_canLoadLocalResources = isLocal(); |
137 | |
138 if (m_canLoadLocalResources) | |
139 m_filePath = url.path(); // In case enforceFilePathSeparation() is calle d. | |
140 } | 137 } |
141 | 138 |
142 SecurityOrigin::SecurityOrigin() | 139 SecurityOrigin::SecurityOrigin() |
143 : m_protocol("") | 140 : m_protocol("") |
144 , m_host("") | 141 , m_host("") |
145 , m_domain("") | 142 , m_domain("") |
146 , m_port(InvalidPort) | 143 , m_port(InvalidPort) |
147 , m_isUnique(true) | 144 , m_isUnique(true) |
148 , m_universalAccess(false) | 145 , m_universalAccess(false) |
149 , m_domainWasSetInDOM(false) | 146 , m_domainWasSetInDOM(false) |
150 , m_canLoadLocalResources(false) | 147 , m_canLoadLocalResources(false) |
151 , m_enforceFilePathSeparation(false) | 148 , m_enforceFilePathSeparation(false) |
152 , m_needsDatabaseIdentifierQuirkForFiles(false) | 149 , m_needsDatabaseIdentifierQuirkForFiles(false) |
153 { | 150 { |
154 } | 151 } |
155 | 152 |
156 SecurityOrigin::SecurityOrigin(const SecurityOrigin* other) | 153 SecurityOrigin::SecurityOrigin(const SecurityOrigin* other) |
157 : m_protocol(other->m_protocol.isolatedCopy()) | 154 : m_protocol(other->m_protocol.isolatedCopy()) |
158 , m_host(other->m_host.isolatedCopy()) | 155 , m_host(other->m_host.isolatedCopy()) |
159 , m_domain(other->m_domain.isolatedCopy()) | 156 , m_domain(other->m_domain.isolatedCopy()) |
160 , m_filePath(other->m_filePath.isolatedCopy()) | |
161 , m_port(other->m_port) | 157 , m_port(other->m_port) |
162 , m_isUnique(other->m_isUnique) | 158 , m_isUnique(other->m_isUnique) |
163 , m_universalAccess(other->m_universalAccess) | 159 , m_universalAccess(other->m_universalAccess) |
164 , m_domainWasSetInDOM(other->m_domainWasSetInDOM) | 160 , m_domainWasSetInDOM(other->m_domainWasSetInDOM) |
165 , m_canLoadLocalResources(other->m_canLoadLocalResources) | 161 , m_canLoadLocalResources(other->m_canLoadLocalResources) |
166 , m_enforceFilePathSeparation(other->m_enforceFilePathSeparation) | 162 , m_enforceFilePathSeparation(other->m_enforceFilePathSeparation) |
167 , m_needsDatabaseIdentifierQuirkForFiles(other->m_needsDatabaseIdentifierQui rkForFiles) | 163 , m_needsDatabaseIdentifierQuirkForFiles(other->m_needsDatabaseIdentifierQui rkForFiles) |
168 { | 164 { |
169 } | 165 } |
170 | 166 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 return canAccess; | 267 return canAccess; |
272 } | 268 } |
273 | 269 |
274 bool SecurityOrigin::passesFileCheck(const SecurityOrigin* other) const | 270 bool SecurityOrigin::passesFileCheck(const SecurityOrigin* other) const |
275 { | 271 { |
276 ASSERT(isLocal() && other->isLocal()); | 272 ASSERT(isLocal() && other->isLocal()); |
277 | 273 |
278 if (!m_enforceFilePathSeparation && !other->m_enforceFilePathSeparation) | 274 if (!m_enforceFilePathSeparation && !other->m_enforceFilePathSeparation) |
279 return true; | 275 return true; |
280 | 276 |
281 return (m_filePath == other->m_filePath); | 277 return false; |
dcheng
2015/05/16 01:55:10
Doesn't this break layout tests, which do set allo
TheJH
2015/05/16 02:20:46
Don't see how it would. This is never reached if m
| |
282 } | 278 } |
283 | 279 |
284 bool SecurityOrigin::canRequest(const KURL& url) const | 280 bool SecurityOrigin::canRequest(const KURL& url) const |
285 { | 281 { |
286 if (m_universalAccess) | 282 if (m_universalAccess) |
287 return true; | 283 return true; |
288 | 284 |
289 if (cachedOrigin(url) == this) | 285 if (cachedOrigin(url) == this) |
290 return true; | 286 return true; |
291 | 287 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 } | 530 } |
535 | 531 |
536 void SecurityOrigin::transferPrivilegesFrom(const SecurityOrigin& origin) | 532 void SecurityOrigin::transferPrivilegesFrom(const SecurityOrigin& origin) |
537 { | 533 { |
538 m_universalAccess = origin.m_universalAccess; | 534 m_universalAccess = origin.m_universalAccess; |
539 m_canLoadLocalResources = origin.m_canLoadLocalResources; | 535 m_canLoadLocalResources = origin.m_canLoadLocalResources; |
540 m_enforceFilePathSeparation = origin.m_enforceFilePathSeparation; | 536 m_enforceFilePathSeparation = origin.m_enforceFilePathSeparation; |
541 } | 537 } |
542 | 538 |
543 } // namespace blink | 539 } // namespace blink |
OLD | NEW |