Chromium Code Reviews| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 return false; | 77 return false; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // In general, extracting the inner URL varies by scheme. It just so happens | 80 // In general, extracting the inner URL varies by scheme. It just so happens |
| 81 // that all the URL schemes we currently support that use inner URLs for their | 81 // that all the URL schemes we currently support that use inner URLs for their |
| 82 // security origin can be parsed using this algorithm. | 82 // security origin can be parsed using this algorithm. |
| 83 static KURL extractInnerURL(const KURL& url) | 83 static KURL extractInnerURL(const KURL& url) |
| 84 { | 84 { |
| 85 // FIXME: Update this callsite to use the innerURL member function when | 85 // FIXME: Update this callsite to use the innerURL member function when |
| 86 // we finish implementing it. | 86 // we finish implementing it. |
| 87 #if ENABLE(FILE_SYSTEM) | |
| 88 if (url.inner_url()) | |
| 89 return *url.inner_url(); | |
| 90 #endif | |
| 87 return KURL(ParsedURLString, decodeURLEscapeSequences(url.path())); | 91 return KURL(ParsedURLString, decodeURLEscapeSequences(url.path())); |
|
abarth-chromium
2011/12/20 07:03:15
This shouldn't be conditional on ENABLE(FILE_SYSTE
ericu
2011/12/20 23:55:34
Currently innerURL only exists if ENABLE(FILE_SYST
| |
| 88 } | 92 } |
| 89 | 93 |
| 90 static bool shouldTreatAsUniqueOrigin(const KURL& url) | 94 static bool shouldTreatAsUniqueOrigin(const KURL& url) |
| 91 { | 95 { |
| 92 if (!url.isValid()) | 96 if (!url.isValid()) |
| 93 return true; | 97 return true; |
| 94 | 98 |
| 95 // FIXME: Do we need to unwrap the URL further? | 99 // FIXME: Do we need to unwrap the URL further? |
| 96 KURL innerURL = shouldUseInnerURL(url) ? extractInnerURL(url) : url; | 100 KURL innerURL = shouldUseInnerURL(url) ? extractInnerURL(url) : url; |
| 97 | 101 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 117 SecurityOrigin::SecurityOrigin(const KURL& url) | 121 SecurityOrigin::SecurityOrigin(const KURL& url) |
| 118 : m_protocol(url.protocol().isNull() ? "" : url.protocol().lower()) | 122 : m_protocol(url.protocol().isNull() ? "" : url.protocol().lower()) |
| 119 , m_host(url.host().isNull() ? "" : url.host().lower()) | 123 , m_host(url.host().isNull() ? "" : url.host().lower()) |
| 120 , m_port(url.port()) | 124 , m_port(url.port()) |
| 121 , m_isUnique(false) | 125 , m_isUnique(false) |
| 122 , m_universalAccess(false) | 126 , m_universalAccess(false) |
| 123 , m_domainWasSetInDOM(false) | 127 , m_domainWasSetInDOM(false) |
| 124 , m_enforceFilePathSeparation(false) | 128 , m_enforceFilePathSeparation(false) |
| 125 , m_needsDatabaseIdentifierQuirkForFiles(false) | 129 , m_needsDatabaseIdentifierQuirkForFiles(false) |
| 126 { | 130 { |
| 131 // These protocols do not create security origins; the owner frame provides the origin | |
| 132 if (m_protocol == "about" || m_protocol == "javascript") | |
| 133 m_protocol = ""; | |
| 134 | |
| 135 #if ENABLE(BLOB) | |
| 136 if (m_protocol == BlobURL::blobProtocol()) { | |
| 137 KURL originURL(ParsedURLString, decodeURLEscapeSequences(url.path())); | |
| 138 if (originURL.isValid()) { | |
| 139 m_protocol = originURL.protocol().lower(); | |
| 140 m_host = originURL.host().lower(); | |
| 141 m_port = originURL.port(); | |
| 142 } else | |
| 143 m_isUnique = true; | |
| 144 } | |
| 145 #endif | |
| 146 | |
| 147 #if ENABLE(FILE_SYSTEM) | |
| 148 if (m_protocol == "filesystem") { | |
| 149 if (url.inner_url() && url.inner_url()->isValid()) { | |
| 150 m_protocol = url.inner_url()->protocol().lower(); | |
| 151 m_host = url.inner_url()->host().lower(); | |
| 152 m_port = url.inner_url()->port(); | |
| 153 } else | |
| 154 m_isUnique = true; | |
| 155 } | |
| 156 #endif | |
| 157 | |
|
abarth-chromium
2011/12/20 07:03:15
None of this code should be here anymore. It all
ericu
2011/12/20 23:55:34
I took out the non-FILE_SYSTEM code, but left my s
| |
| 127 // document.domain starts as m_host, but can be set by the DOM. | 158 // document.domain starts as m_host, but can be set by the DOM. |
| 128 m_domain = m_host; | 159 m_domain = m_host; |
| 129 | 160 |
| 130 if (isDefaultPortForProtocol(m_port, m_protocol)) | 161 if (isDefaultPortForProtocol(m_port, m_protocol)) |
| 131 m_port = InvalidPort; | 162 m_port = InvalidPort; |
| 132 | 163 |
| 133 // By default, only local SecurityOrigins can load local resources. | 164 // By default, only local SecurityOrigins can load local resources. |
| 134 m_canLoadLocalResources = isLocal(); | 165 m_canLoadLocalResources = isLocal(); |
| 135 | 166 |
| 136 if (m_canLoadLocalResources) | 167 if (m_canLoadLocalResources) |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 if (m_port != other->m_port) | 532 if (m_port != other->m_port) |
| 502 return false; | 533 return false; |
| 503 | 534 |
| 504 if (isLocal() && !passesFileCheck(other)) | 535 if (isLocal() && !passesFileCheck(other)) |
| 505 return false; | 536 return false; |
| 506 | 537 |
| 507 return true; | 538 return true; |
| 508 } | 539 } |
| 509 | 540 |
| 510 } // namespace WebCore | 541 } // namespace WebCore |
| OLD | NEW |