Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: Source/WebCore/page/SecurityOrigin.cpp

Issue 14089003: Remove storageBlockingPolicy (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/WebCore/page/SecurityOrigin.h ('k') | Source/WebCore/page/Settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return false; 110 return false;
111 } 111 }
112 112
113 SecurityOrigin::SecurityOrigin(const KURL& url) 113 SecurityOrigin::SecurityOrigin(const KURL& url)
114 : m_protocol(url.protocol().isNull() ? "" : url.protocol().lower()) 114 : m_protocol(url.protocol().isNull() ? "" : url.protocol().lower())
115 , m_host(url.host().isNull() ? "" : url.host().lower()) 115 , m_host(url.host().isNull() ? "" : url.host().lower())
116 , m_port(url.port()) 116 , m_port(url.port())
117 , m_isUnique(false) 117 , m_isUnique(false)
118 , m_universalAccess(false) 118 , m_universalAccess(false)
119 , m_domainWasSetInDOM(false) 119 , m_domainWasSetInDOM(false)
120 , m_storageBlockingPolicy(AllowAllStorage)
121 , m_enforceFilePathSeparation(false) 120 , m_enforceFilePathSeparation(false)
122 , m_needsDatabaseIdentifierQuirkForFiles(false) 121 , m_needsDatabaseIdentifierQuirkForFiles(false)
123 { 122 {
124 // document.domain starts as m_host, but can be set by the DOM. 123 // document.domain starts as m_host, but can be set by the DOM.
125 m_domain = m_host; 124 m_domain = m_host;
126 125
127 if (isDefaultPortForProtocol(m_port, m_protocol)) 126 if (isDefaultPortForProtocol(m_port, m_protocol))
128 m_port = InvalidPort; 127 m_port = InvalidPort;
129 128
130 // By default, only local SecurityOrigins can load local resources. 129 // By default, only local SecurityOrigins can load local resources.
131 m_canLoadLocalResources = isLocal(); 130 m_canLoadLocalResources = isLocal();
132 131
133 if (m_canLoadLocalResources) 132 if (m_canLoadLocalResources)
134 m_filePath = url.path(); // In case enforceFilePathSeparation() is calle d. 133 m_filePath = url.path(); // In case enforceFilePathSeparation() is calle d.
135 } 134 }
136 135
137 SecurityOrigin::SecurityOrigin() 136 SecurityOrigin::SecurityOrigin()
138 : m_protocol("") 137 : m_protocol("")
139 , m_host("") 138 , m_host("")
140 , m_domain("") 139 , m_domain("")
141 , m_port(InvalidPort) 140 , m_port(InvalidPort)
142 , m_isUnique(true) 141 , m_isUnique(true)
143 , m_universalAccess(false) 142 , m_universalAccess(false)
144 , m_domainWasSetInDOM(false) 143 , m_domainWasSetInDOM(false)
145 , m_canLoadLocalResources(false) 144 , m_canLoadLocalResources(false)
146 , m_storageBlockingPolicy(AllowAllStorage)
147 , m_enforceFilePathSeparation(false) 145 , m_enforceFilePathSeparation(false)
148 , m_needsDatabaseIdentifierQuirkForFiles(false) 146 , m_needsDatabaseIdentifierQuirkForFiles(false)
149 { 147 {
150 } 148 }
151 149
152 SecurityOrigin::SecurityOrigin(const SecurityOrigin* other) 150 SecurityOrigin::SecurityOrigin(const SecurityOrigin* other)
153 : m_protocol(other->m_protocol.isolatedCopy()) 151 : m_protocol(other->m_protocol.isolatedCopy())
154 , m_host(other->m_host.isolatedCopy()) 152 , m_host(other->m_host.isolatedCopy())
155 , m_encodedHost(other->m_encodedHost.isolatedCopy()) 153 , m_encodedHost(other->m_encodedHost.isolatedCopy())
156 , m_domain(other->m_domain.isolatedCopy()) 154 , m_domain(other->m_domain.isolatedCopy())
157 , m_filePath(other->m_filePath.isolatedCopy()) 155 , m_filePath(other->m_filePath.isolatedCopy())
158 , m_port(other->m_port) 156 , m_port(other->m_port)
159 , m_isUnique(other->m_isUnique) 157 , m_isUnique(other->m_isUnique)
160 , m_universalAccess(other->m_universalAccess) 158 , m_universalAccess(other->m_universalAccess)
161 , m_domainWasSetInDOM(other->m_domainWasSetInDOM) 159 , m_domainWasSetInDOM(other->m_domainWasSetInDOM)
162 , m_canLoadLocalResources(other->m_canLoadLocalResources) 160 , m_canLoadLocalResources(other->m_canLoadLocalResources)
163 , m_storageBlockingPolicy(other->m_storageBlockingPolicy)
164 , m_enforceFilePathSeparation(other->m_enforceFilePathSeparation) 161 , m_enforceFilePathSeparation(other->m_enforceFilePathSeparation)
165 , m_needsDatabaseIdentifierQuirkForFiles(other->m_needsDatabaseIdentifierQui rkForFiles) 162 , m_needsDatabaseIdentifierQuirkForFiles(other->m_needsDatabaseIdentifierQui rkForFiles)
166 { 163 {
167 } 164 }
168 165
169 PassRefPtr<SecurityOrigin> SecurityOrigin::create(const KURL& url) 166 PassRefPtr<SecurityOrigin> SecurityOrigin::create(const KURL& url)
170 { 167 {
171 RefPtr<SecurityOrigin> cachedOrigin = getCachedOrigin(url); 168 RefPtr<SecurityOrigin> cachedOrigin = getCachedOrigin(url);
172 if (cachedOrigin.get()) 169 if (cachedOrigin.get())
173 return cachedOrigin; 170 return cachedOrigin;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 365
369 if (SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(protocol)) 366 if (SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(protocol))
370 return m_protocol == protocol || SecurityPolicy::isAccessToURLWhiteListe d(this, url); 367 return m_protocol == protocol || SecurityPolicy::isAccessToURLWhiteListe d(this, url);
371 368
372 if (SecurityPolicy::restrictAccessToLocal() && SchemeRegistry::shouldTreatUR LSchemeAsLocal(protocol)) 369 if (SecurityPolicy::restrictAccessToLocal() && SchemeRegistry::shouldTreatUR LSchemeAsLocal(protocol))
373 return canLoadLocalResources() || SecurityPolicy::isAccessToURLWhiteList ed(this, url); 370 return canLoadLocalResources() || SecurityPolicy::isAccessToURLWhiteList ed(this, url);
374 371
375 return true; 372 return true;
376 } 373 }
377 374
378 bool SecurityOrigin::canAccessStorage(const SecurityOrigin* topOrigin) const 375 bool SecurityOrigin::canAccessStorage(const SecurityOrigin* topOrigin) const
abarth-chromium 2013/04/11 21:47:52 In the next patch, we can remove the topOrigin par
379 { 376 {
380 if (isUnique()) 377 return !isUnique();
381 return false;
382
383 // FIXME: This check should be replaced with an ASSERT once we can guarantee that topOrigin is not null.
384 if (!topOrigin)
385 return true;
386
387 if (m_storageBlockingPolicy == BlockAllStorage || topOrigin->m_storageBlocki ngPolicy == BlockAllStorage)
388 return false;
389
390 if ((m_storageBlockingPolicy == BlockThirdPartyStorage || topOrigin->m_stora geBlockingPolicy == BlockThirdPartyStorage) && topOrigin->isThirdParty(this))
391 return false;
392
393 return true;
394 } 378 }
395 379
396 SecurityOrigin::Policy SecurityOrigin::canShowNotifications() const 380 SecurityOrigin::Policy SecurityOrigin::canShowNotifications() const
397 { 381 {
398 if (m_universalAccess) 382 if (m_universalAccess)
399 return AlwaysAllow; 383 return AlwaysAllow;
400 if (isUnique()) 384 if (isUnique())
401 return AlwaysDeny; 385 return AlwaysDeny;
402 return Ask; 386 return Ask;
403 } 387 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 556 }
573 557
574 const String& SecurityOrigin::urlWithUniqueSecurityOrigin() 558 const String& SecurityOrigin::urlWithUniqueSecurityOrigin()
575 { 559 {
576 ASSERT(isMainThread()); 560 ASSERT(isMainThread());
577 DEFINE_STATIC_LOCAL(const String, uniqueSecurityOriginURL, (ASCIILiteral("da ta:,"))); 561 DEFINE_STATIC_LOCAL(const String, uniqueSecurityOriginURL, (ASCIILiteral("da ta:,")));
578 return uniqueSecurityOriginURL; 562 return uniqueSecurityOriginURL;
579 } 563 }
580 564
581 } // namespace WebCore 565 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/page/SecurityOrigin.h ('k') | Source/WebCore/page/Settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698