Changeset 211946 in webkit
- Timestamp:
- Feb 9, 2017 3:09:28 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 51 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r211945 r211946 1 2017-02-09 Antti Koivisto <antti@apple.com> 2 3 Remove most cases of #if ENABLE(CACHE_PARTITIONING) 4 https://bugs.webkit.org/show_bug.cgi?id=167990 5 6 Reviewed by Sam Weinig. 7 8 We'll just return empty string for the partition if partitioning is not enabled. 9 10 * html/DOMURL.cpp: 11 (WebCore::DOMURL::revokeObjectURL): 12 * inspector/InspectorPageAgent.cpp: 13 (WebCore::InspectorPageAgent::cachedResource): 14 * loader/FrameLoader.cpp: 15 (WebCore::FrameLoader::loadURL): 16 * loader/archive/cf/LegacyWebArchive.cpp: 17 (WebCore::LegacyWebArchive::create): 18 * loader/cache/CachedResource.h: 19 (WebCore::CachedResource::url): 20 (WebCore::CachedResource::cachePartition): 21 * loader/cache/CachedResourceLoader.cpp: 22 (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): 23 (WebCore::CachedResourceLoader::requestResource): 24 * loader/cache/CachedResourceRequest.cpp: 25 (WebCore::CachedResourceRequest::setDomainForCachePartition): 26 * loader/cache/CachedResourceRequest.h: 27 * loader/cache/MemoryCache.cpp: 28 (WebCore::MemoryCache::add): 29 (WebCore::MemoryCache::revalidationSucceeded): 30 (WebCore::MemoryCache::resourceForRequestImpl): 31 (WebCore::MemoryCache::addImageToCache): 32 (WebCore::MemoryCache::removeImageFromCache): 33 (WebCore::MemoryCache::remove): 34 (WebCore::MemoryCache::removeResourcesWithOrigin): 35 (WebCore::MemoryCache::removeResourcesWithOrigins): 36 (WebCore::MemoryCache::getOriginsWithCache): 37 (WebCore::MemoryCache::originsWithCache): 38 * loader/cache/MemoryCache.h: 39 * page/SecurityOrigin.cpp: 40 (WebCore::SecurityOrigin::domainForCachePartition): 41 * page/SecurityOrigin.h: 42 * platform/SchemeRegistry.cpp: 43 (WebCore::cachePartitioningSchemes): 44 (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme): 45 * platform/SchemeRegistry.h: 46 * platform/ios/WebCoreSystemInterfaceIOS.mm: 47 * platform/mac/WebCoreSystemInterface.h: 48 * platform/mac/WebCoreSystemInterface.mm: 49 * platform/network/ResourceRequestBase.cpp: 50 (WebCore::ResourceRequestBase::setAsIsolatedCopy): 51 (WebCore::ResourceRequestBase::setCachePartition): 52 (WebCore::ResourceRequestBase::partitionName): 53 * platform/network/ResourceRequestBase.h: 54 (WebCore::ResourceRequestBase::cachePartition): 55 (WebCore::ResourceRequestBase::setDomainForCachePartition): 56 * platform/network/cf/ResourceRequest.h: 57 (WebCore::ResourceRequest::cachePartition): Deleted. 58 (WebCore::ResourceRequest::setCachePartition): Deleted. 59 (WebCore::ResourceRequest::setDomainForCachePartition): Deleted. 60 * platform/network/cf/ResourceRequestCFNet.cpp: 61 (WebCore::ResourceRequest::doUpdatePlatformRequest): 62 (WebCore::ResourceRequest::doUpdateResourceRequest): 63 (WebCore::ResourceRequest::partitionName): Deleted. 64 (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy): Deleted. 65 * platform/network/cf/ResourceResponse.h: 66 * platform/network/cocoa/ResourceRequestCocoa.mm: 67 (WebCore::ResourceRequest::doUpdateResourceRequest): 68 (WebCore::ResourceRequest::doUpdatePlatformRequest): 69 * testing/Internals.cpp: 70 (WebCore::Internals::isLoadingFromMemoryCache): 71 1 72 2017-02-09 Ryosuke Niwa <rniwa@webkit.org> 2 73 -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp
r211751 r211946 125 125 Page* page = frame->page(); 126 126 SessionID sessionID = page ? page->sessionID() : SessionID::defaultSessionID(); 127 #if ENABLE(CACHE_PARTITIONING)128 127 String partition = m_document->topDocument().securityOrigin().domainForCachePartition(); 129 #else130 String partition = emptyString();131 #endif132 128 m_handle = m_socketProvider->createSocketStreamHandle(m_handshake->url(), *this, sessionID, partition); 133 129 } -
trunk/Source/WebCore/html/DOMURL.cpp
r210923 r211946 121 121 URL url(URL(), urlString); 122 122 ResourceRequest request(url); 123 #if ENABLE(CACHE_PARTITIONING)124 123 request.setDomainForCachePartition(scriptExecutionContext.topOrigin().domainForCachePartition()); 125 #endif 124 126 125 MemoryCache::removeRequestFromSessionCaches(scriptExecutionContext, request); 127 126 -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r210923 r211946 261 261 if (!cachedResource) { 262 262 ResourceRequest request(url); 263 #if ENABLE(CACHE_PARTITIONING)264 263 request.setDomainForCachePartition(frame->document()->topOrigin().domainForCachePartition()); 265 #endif266 264 cachedResource = MemoryCache::singleton().resourceForRequest(request, frame->page()->sessionID()); 267 265 } -
trunk/Source/WebCore/loader/FrameLoader.cpp
r211870 r211946 1202 1202 addHTTPOriginIfNeeded(request, referrerOrigin->toString()); 1203 1203 } 1204 #if ENABLE(CACHE_PARTITIONING)1205 1204 if (&m_frame.tree().top() != &m_frame) 1206 1205 request.setDomainForCachePartition(m_frame.tree().top().document()->securityOrigin().domainForCachePartition()); 1207 #endif 1206 1208 1207 addExtraFieldsToRequest(request, newLoadType, true); 1209 1208 if (newLoadType == FrameLoadType::Reload || newLoadType == FrameLoadType::ReloadFromOrigin) -
trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
r210923 r211946 515 515 516 516 ResourceRequest request(subresourceURL); 517 #if ENABLE(CACHE_PARTITIONING)518 517 request.setDomainForCachePartition(frame.document()->topOrigin().domainForCachePartition()); 519 #endif 518 520 519 if (auto* cachedResource = MemoryCache::singleton().resourceForRequest(request, frame.page()->sessionID())) { 521 520 if (auto resource = ArchiveResource::create(cachedResource->resourceBuffer(), subresourceURL, cachedResource->response())) { -
trunk/Source/WebCore/loader/cache/CachedResource.h
r211649 r211946 115 115 ResourceRequest& resourceRequest() { return m_resourceRequest; } 116 116 const URL& url() const { return m_resourceRequest.url();} 117 #if ENABLE(CACHE_PARTITIONING)118 117 const String& cachePartition() const { return m_resourceRequest.cachePartition(); } 119 #endif120 118 SessionID sessionID() const { return m_sessionID; } 121 119 Type type() const { return m_type; } -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r211673 r211946 218 218 CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest&& request) 219 219 { 220 #if ENABLE(CACHE_PARTITIONING)221 220 ASSERT(document()); 222 221 request.setDomainForCachePartition(*document()); 223 #endif224 222 225 223 auto& memoryCache = MemoryCache::singleton(); … … 734 732 // See if we can use an existing resource from the cache. 735 733 CachedResourceHandle<CachedResource> resource; 736 #if ENABLE(CACHE_PARTITIONING)737 734 if (document()) 738 735 request.setDomainForCachePartition(*document()); 739 #endif740 736 741 737 if (request.allowsCaching()) -
trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp
r210923 r211946 130 130 } 131 131 132 #if ENABLE(CACHE_PARTITIONING)133 132 void CachedResourceRequest::setDomainForCachePartition(Document& document) 134 133 { 135 134 m_resourceRequest.setDomainForCachePartition(document.topOrigin().domainForCachePartition()); 136 135 } 137 #endif138 136 139 137 static inline String acceptHeaderValueFromType(CachedResource::Type type) -
trunk/Source/WebCore/loader/cache/CachedResourceRequest.h
r211649 r211946 76 76 void applyBlockedStatus(const ContentExtensions::BlockedStatus&); 77 77 #endif 78 #if ENABLE(CACHE_PARTITIONING)79 78 void setDomainForCachePartition(Document&); 80 #endif81 79 bool isLinkPreload() const { return m_isLinkPreload; } 82 80 void setIsLinkPreload() { m_isLinkPreload = true; } -
trunk/Source/WebCore/loader/cache/MemoryCache.cpp
r208841 r211946 116 116 ASSERT(WTF::isMainThread()); 117 117 118 #if ENABLE(CACHE_PARTITIONING)119 118 auto key = std::make_pair(resource.url(), resource.cachePartition()); 120 #else 121 auto& key = resource.url(); 122 #endif 119 123 120 ensureSessionResourceMap(resource.sessionID()).set(key, &resource); 124 121 resource.setInCache(true); … … 145 142 146 143 auto& resources = ensureSessionResourceMap(resource.sessionID()); 147 #if ENABLE(CACHE_PARTITIONING)148 144 auto key = std::make_pair(resource.url(), resource.cachePartition()); 149 #else 150 auto& key = resource.url(); 151 #endif 145 152 146 ASSERT(!resources.get(key)); 153 147 resources.set(key, &resource); … … 190 184 URL url = removeFragmentIdentifierIfNeeded(request.url()); 191 185 192 #if ENABLE(CACHE_PARTITIONING)193 186 auto key = std::make_pair(url, request.cachePartition()); 194 #else195 auto& key = url;196 #endif197 187 return resources.get(key); 198 188 } … … 233 223 cachedImage->addClient(dummyCachedImageClient()); 234 224 cachedImage->setDecodedSize(bitmapImage->decodedSize()); 235 #if ENABLE(CACHE_PARTITIONING)236 225 cachedImage->resourceRequest().setDomainForCachePartition(domainForCachePartition); 237 #endif 226 238 227 return add(*cachedImage.release()); 239 228 } … … 245 234 return; 246 235 247 #if ENABLE(CACHE_PARTITIONING)248 236 auto key = std::make_pair(url, ResourceRequest::partitionName(domainForCachePartition)); 249 #else 250 UNUSED_PARAM(domainForCachePartition); 251 auto& key = url; 252 #endif 237 253 238 CachedResource* resource = resources->get(key); 254 239 if (!resource) … … 440 425 // who needed a fresh copy for a reload. See <http://bugs.webkit.org/show_bug.cgi?id=12479#c6>. 441 426 if (auto* resources = sessionResourceMap(resource.sessionID())) { 442 #if ENABLE(CACHE_PARTITIONING)443 427 auto key = std::make_pair(resource.url(), resource.cachePartition()); 444 #else 445 auto& key = resource.url(); 446 #endif 428 447 429 if (resource.inCache()) { 448 430 // Remove resource from the resource map. … … 528 510 void MemoryCache::removeResourcesWithOrigin(SecurityOrigin& origin) 529 511 { 530 #if ENABLE(CACHE_PARTITIONING)531 512 String originPartition = ResourceRequest::partitionName(origin.host()); 532 #endif533 513 534 514 Vector<CachedResource*> resourcesWithOrigin; … … 536 516 for (auto& keyValue : *resources) { 537 517 auto& resource = *keyValue.value; 538 #if ENABLE(CACHE_PARTITIONING)539 518 auto& partitionName = keyValue.key.second; 540 519 if (partitionName == originPartition) { … … 542 521 continue; 543 522 } 544 #endif545 523 RefPtr<SecurityOrigin> resourceOrigin = SecurityOrigin::create(resource.url()); 546 524 if (resourceOrigin->equal(&origin)) … … 559 537 return; 560 538 561 #if ENABLE(CACHE_PARTITIONING)562 539 HashSet<String> originPartitions; 563 540 564 541 for (auto& origin : origins) 565 542 originPartitions.add(ResourceRequest::partitionName(origin->host())); 566 #endif567 543 568 544 Vector<CachedResource*> resourcesToRemove; 569 545 for (auto& keyValuePair : *resourceMap) { 570 546 auto& resource = *keyValuePair.value; 571 572 #if ENABLE(CACHE_PARTITIONING)573 547 auto& partitionName = keyValuePair.key.second; 574 548 if (originPartitions.contains(partitionName)) { … … 576 550 continue; 577 551 } 578 #endif579 580 552 if (origins.contains(SecurityOrigin::create(resource.url()).ptr())) 581 553 resourcesToRemove.append(&resource); … … 588 560 void MemoryCache::getOriginsWithCache(SecurityOriginSet& origins) 589 561 { 590 #if ENABLE(CACHE_PARTITIONING)591 static NeverDestroyed<String> httpString("http");592 #endif593 562 for (auto& resources : m_sessionResources.values()) { 594 563 for (auto& keyValue : *resources) { 595 564 auto& resource = *keyValue.value; 596 #if ENABLE(CACHE_PARTITIONING)597 565 auto& partitionName = keyValue.key.second; 598 566 if (!partitionName.isEmpty()) 599 origins.add(SecurityOrigin::create( httpString, partitionName, 0));567 origins.add(SecurityOrigin::create(ASCIILiteral("http"), partitionName, 0)); 600 568 else 601 #endif 602 origins.add(SecurityOrigin::create(resource.url())); 569 origins.add(SecurityOrigin::create(resource.url())); 603 570 } 604 571 } … … 613 580 for (auto& keyValue : *it->value) { 614 581 auto& resource = *keyValue.value; 615 #if ENABLE(CACHE_PARTITIONING)616 582 auto& partitionName = keyValue.key.second; 617 583 if (!partitionName.isEmpty()) 618 584 origins.add(SecurityOrigin::create("http", partitionName, 0)); 619 585 else 620 #endif 621 origins.add(SecurityOrigin::create(resource.url())); 586 origins.add(SecurityOrigin::create(resource.url())); 622 587 } 623 588 } -
trunk/Source/WebCore/loader/cache/MemoryCache.h
r208646 r211946 169 169 170 170 private: 171 #if ENABLE(CACHE_PARTITIONING)172 171 typedef HashMap<std::pair<URL, String /* partitionName */>, CachedResource*> CachedResourceMap; 173 #else174 typedef HashMap<URL, CachedResource*> CachedResourceMap;175 #endif176 172 typedef ListHashSet<CachedResource*> LRUList; 177 173 -
trunk/Source/WebCore/page/SecurityOrigin.cpp
r211763 r211946 396 396 } 397 397 398 #if ENABLE(CACHE_PARTITIONING)399 398 String SecurityOrigin::domainForCachePartition() const 400 399 { … … 410 409 return emptyString(); 411 410 } 412 #endif413 411 414 412 void SecurityOrigin::enforceFilePathSeparation() -
trunk/Source/WebCore/page/SecurityOrigin.h
r210923 r211946 139 139 bool needsStorageAccessFromFileURLsQuirk() const { return m_needsStorageAccessFromFileURLsQuirk; } 140 140 141 #if ENABLE(CACHE_PARTITIONING)142 141 WEBCORE_EXPORT String domainForCachePartition() const; 143 #endif144 142 145 143 bool canAccessDatabase(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin); }; -
trunk/Source/WebCore/platform/SchemeRegistry.cpp
r211758 r211946 168 168 } 169 169 170 #if ENABLE(CACHE_PARTITIONING)171 170 static URLSchemesMap& cachePartitioningSchemes() 172 171 { … … 174 173 return schemes; 175 174 } 176 #endif177 175 178 176 static URLSchemesMap& alwaysRevalidatedSchemes() … … 344 342 } 345 343 346 #if ENABLE(CACHE_PARTITIONING)347 344 void SchemeRegistry::registerURLSchemeAsCachePartitioned(const String& scheme) 348 345 { … … 356 353 return cachePartitioningSchemes().contains(scheme); 357 354 } 358 #endif359 355 360 356 bool SchemeRegistry::isUserExtensionScheme(const String& scheme) -
trunk/Source/WebCore/platform/SchemeRegistry.h
r211758 r211946 95 95 static bool shouldAlwaysRevalidateURLScheme(const String&); 96 96 97 #if ENABLE(CACHE_PARTITIONING)98 97 // Schemes whose requests should be partitioned in the cache 99 98 WEBCORE_EXPORT static void registerURLSchemeAsCachePartitioned(const String& scheme); 100 99 static bool shouldPartitionCacheForURLScheme(const String& scheme); 101 #endif102 100 103 101 static bool isUserExtensionScheme(const String& scheme); -
trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm
r202279 r211946 67 67 #endif 68 68 69 #if ENABLE(CACHE_PARTITIONING)70 69 WEBCORE_EXPORT CFStringRef (*wkCachePartitionKey)(void); 71 #endif72 70 73 71 WEBCORE_EXPORT int (*wkExernalDeviceTypeForPlayer)(AVPlayer *); -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h
r207585 r211946 236 236 #endif 237 237 238 #if ENABLE(CACHE_PARTITIONING)239 238 extern CFStringRef (*wkCachePartitionKey)(void); 240 #endif241 239 242 240 typedef enum { -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
r204568 r211946 114 114 #endif 115 115 116 #if ENABLE(CACHE_PARTITIONING)117 116 CFStringRef (*wkCachePartitionKey)(void); 118 #endif119 117 120 118 int (*wkExernalDeviceTypeForPlayer)(AVPlayer *); -
trunk/Source/WebCore/platform/network/ResourceHandleInternal.h
r211751 r211946 80 80 , m_firstRequest(request) 81 81 , m_lastHTTPMethod(request.httpMethod()) 82 #if ENABLE(CACHE_PARTITIONING)83 82 , m_partition(request.cachePartition()) 84 #else85 , m_partition(emptyString())86 #endif87 83 , m_defersLoading(defersLoading) 88 84 , m_shouldContentSniff(shouldContentSniff) -
trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp
r209776 r211946 28 28 29 29 #include "HTTPHeaderNames.h" 30 #include "PublicSuffix.h" 30 31 #include "ResourceRequest.h" 31 32 #include <wtf/PointerComparison.h> … … 67 68 setRequester(other.requester()); 68 69 setInitiatorIdentifier(other.initiatorIdentifier().isolatedCopy()); 70 setCachePartition(other.cachePartition()); 69 71 70 72 updateResourceRequest(); … … 87 89 setHTTPBody(other.m_httpBody->isolatedCopy()); 88 90 setAllowCookies(other.m_allowCookies); 89 90 const_cast<ResourceRequest&>(asResourceRequest()).doPlatformSetAsIsolatedCopy(other);91 91 } 92 92 … … 641 641 #endif 642 642 643 } 643 void ResourceRequestBase::setCachePartition(const String& cachePartition) 644 { 645 #if ENABLE(CACHE_PARTITIONING) 646 ASSERT(!cachePartition.isNull()); 647 ASSERT(cachePartition == partitionName(cachePartition)); 648 m_cachePartition = cachePartition; 649 #else 650 UNUSED_PARAM(cachePartition); 651 #endif 652 } 653 654 String ResourceRequestBase::partitionName(const String& domain) 655 { 656 #if ENABLE(PUBLIC_SUFFIX_LIST) 657 if (domain.isNull()) 658 return emptyString(); 659 String highLevel = topPrivatelyControlledDomain(domain); 660 if (highLevel.isNull()) 661 return emptyString(); 662 return highLevel; 663 #else 664 #if ENABLE(CACHE_PARTITIONING) 665 #error Cache partitioning requires PUBLIC_SUFFIX_LIST 666 #endif 667 return emptyString(); 668 #endif 669 } 670 671 } -
trunk/Source/WebCore/platform/network/ResourceRequestBase.h
r209629 r211946 137 137 WEBCORE_EXPORT void setPriority(ResourceLoadPriority); 138 138 139 WEBCORE_EXPORT static String partitionName(const String& domain); 140 const String& cachePartition() const { return m_cachePartition; } 141 WEBCORE_EXPORT void setCachePartition(const String&); 142 void setDomainForCachePartition(const String& domain) { setCachePartition(partitionName(domain)); } 143 139 144 WEBCORE_EXPORT bool isConditional() const; 140 145 WEBCORE_EXPORT void makeUnconditional(); … … 238 243 Requester m_requester { Requester::Unspecified }; 239 244 String m_initiatorIdentifier; 245 String m_cachePartition { emptyString() }; 240 246 241 247 private: -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
r211753 r211946 138 138 } 139 139 140 #if ENABLE(CACHE_PARTITIONING)141 140 String partition = firstRequest().cachePartition(); 142 #else143 String partition = emptyString();144 #endif145 141 146 142 // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, … … 307 303 request.removeCredentials(); 308 304 309 #if ENABLE(CACHE_PARTITIONING)310 305 String partition = firstRequest().cachePartition(); 311 #else312 String partition = emptyString();313 #endif314 306 315 307 if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) { … … 396 388 return false; 397 389 398 #if ENABLE(CACHE_PARTITIONING)399 390 String partition = firstRequest().cachePartition(); 400 #else401 String partition = emptyString();402 #endif403 391 404 392 if (!d->m_user.isNull() && !d->m_pass.isNull()) { … … 491 479 urlToStore = challenge.failureResponse().url(); 492 480 493 #if ENABLE(CACHE_PARTITIONING) 494 String partition = firstRequest().cachePartition(); 495 #else 496 String partition = emptyString(); 497 #endif 498 499 d->m_context->storageSession().credentialStorage().set(partition, webCredential, challenge.protectionSpace(), urlToStore); 481 d->m_context->storageSession().credentialStorage().set(firstRequest().cachePartition(), webCredential, challenge.protectionSpace(), urlToStore); 500 482 501 483 if (d->m_connection) { -
trunk/Source/WebCore/platform/network/cf/ResourceRequest.h
r207585 r211946 95 95 #endif 96 96 97 #if ENABLE(CACHE_PARTITIONING)98 WEBCORE_EXPORT static String partitionName(const String& domain);99 const String& cachePartition() const { return m_cachePartition.isNull() ? emptyString() : m_cachePartition; }100 void setCachePartition(const String& cachePartition)101 {102 ASSERT(cachePartition == partitionName(cachePartition));103 m_cachePartition = cachePartition;104 }105 void setDomainForCachePartition(const String& domain) { m_cachePartition = partitionName(domain); }106 #endif107 108 97 #if PLATFORM(COCOA) || USE(CFURLCONNECTION) 109 98 WEBCORE_EXPORT CFURLRequestRef cfURLRequest(HTTPBodyUpdatePolicy) const; … … 132 121 RetainPtr<NSURLRequest> m_nsRequest; 133 122 #endif 134 #if ENABLE(CACHE_PARTITIONING)135 String m_cachePartition;136 #endif137 123 138 124 static bool s_httpPipeliningEnabled; -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
r210236 r211946 362 362 } 363 363 364 #if ENABLE(CACHE_PARTITIONING)365 String ResourceRequest::partitionName(const String& domain)366 {367 if (domain.isNull())368 return emptyString();369 #if ENABLE(PUBLIC_SUFFIX_LIST)370 String highLevel = topPrivatelyControlledDomain(domain);371 if (highLevel.isNull())372 return emptyString();373 return highLevel;374 #else375 return domain;376 #endif377 }378 #endif379 380 void ResourceRequest::doPlatformSetAsIsolatedCopy(const ResourceRequest& other)381 {382 #if ENABLE(CACHE_PARTITIONING)383 m_cachePartition = other.m_cachePartition.isolatedCopy();384 #else385 UNUSED_PARAM(other);386 #endif387 }388 389 390 364 // FIXME: It is confusing that this function both sets connection count and determines maximum request count at network layer. This can and should be done separately. 391 365 unsigned initializeMaximumHTTPConnectionCountPerHost() -
trunk/Source/WebCore/platform/network/cf/ResourceResponse.h
r207585 r211946 104 104 CertificateInfo platformCertificateInfo() const; 105 105 106 void doPlatformSetAsIsolatedCopy(const ResourceResponse&) const;107 108 106 #if PLATFORM(COCOA) 109 107 void initNSURLResponse() const; -
trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm
r210890 r211946 149 149 } 150 150 151 #if ENABLE(CACHE_PARTITIONING)152 151 if (m_nsRequest) { 153 152 NSString* cachePartition = [NSURLProtocol propertyForKey:(NSString *)wkCachePartitionKey() inRequest:m_nsRequest.get()]; … … 155 154 m_cachePartition = cachePartition; 156 155 } 157 #endif158 156 } 159 157 … … 219 217 [nsRequest setContentDispositionEncodingFallbackArray:encodingFallbacks]; 220 218 221 #if ENABLE(CACHE_PARTITIONING)222 219 String partition = cachePartition(); 223 220 if (!partition.isNull() && !partition.isEmpty()) { … … 225 222 [NSURLProtocol setProperty:partitionValue forKey:(NSString *)wkCachePartitionKey() inRequest:nsRequest]; 226 223 } 227 #endif228 224 229 225 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
r211753 r211946 180 180 void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge) 181 181 { 182 #if ENABLE(CACHE_PARTITIONING)183 182 String partition = firstRequest().cachePartition(); 184 #else185 String partition = emptyString();186 #endif187 183 188 184 if (!d->m_user.isNull() && !d->m_pass.isNull()) { … … 242 238 } 243 239 244 #if ENABLE(CACHE_PARTITIONING)245 240 String partition = firstRequest().cachePartition(); 246 #else247 String partition = emptyString();248 #endif249 241 250 242 if (shouldUseCredentialStorage()) { -
trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp
r211753 r211946 1042 1042 ResourceHandleInternal* d = handle->getInternal(); 1043 1043 1044 #if ENABLE(CACHE_PARTITIONING)1045 1044 String partition = handle->firstRequest().cachePartition(); 1046 #else1047 String partition = emptyString();1048 #endif1049 1045 1050 1046 if (handle->shouldUseCredentialStorage()) { -
trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
r211895 r211946 152 152 // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 153 153 // try and reuse the credential preemptively, as allowed by RFC 2617. 154 #if ENABLE(CACHE_PARTITIONING) 155 String partition = firstRequest().cachePartition(); 156 #else 157 String partition = emptyString(); 158 #endif 159 d->m_initialCredential = d->m_context->storageSession().credentialStorage().get(partition, firstRequest().url()); 154 d->m_initialCredential = d->m_context->storageSession().credentialStorage().get(firstRequest().cachePartition(), firstRequest().url()); 160 155 } else { 161 156 // If there is already a protection space known for the URL, update stored credentials before sending a request. -
trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r211754 r211946 202 202 ResourceHandleInternal* d = handle->getInternal(); 203 203 204 #if ENABLE(CACHE_PARTITIONING) 205 String partition = firstRequest().cachePartition(); 206 #else 207 String partition = emptyString(); 208 #endif 204 String partition = request.cachePartition(); 209 205 210 206 if (handle->shouldUseCredentialStorage()) { … … 830 826 ASSERT(d->m_currentWebChallenge.isNull()); 831 827 832 #if ENABLE(CACHE_PARTITIONING)833 828 String partition = firstRequest().cachePartition(); 834 #else835 String partition = emptyString();836 #endif837 829 838 830 // FIXME: Per the specification, the user shouldn't be asked for credentials if there were incorrect ones provided explicitly. … … 900 892 } 901 893 902 #if ENABLE(CACHE_PARTITIONING)903 894 String partition = firstRequest().cachePartition(); 904 #else905 String partition = emptyString();906 #endif907 895 908 896 if (shouldUseCredentialStorage()) { -
trunk/Source/WebCore/testing/Internals.cpp
r211910 r211946 564 564 565 565 ResourceRequest request(contextDocument()->completeURL(url)); 566 #if ENABLE(CACHE_PARTITIONING)567 566 request.setDomainForCachePartition(contextDocument()->topOrigin().domainForCachePartition()); 568 #endif 567 569 568 CachedResource* resource = MemoryCache::singleton().resourceForRequest(request, contextDocument()->page()->sessionID()); 570 569 return resource && resource->status() == CachedResource::Cached; -
trunk/Source/WebKit/mac/ChangeLog
r211931 r211946 1 2017-02-09 Antti Koivisto <antti@apple.com> 2 3 Remove most cases of #if ENABLE(CACHE_PARTITIONING) 4 https://bugs.webkit.org/show_bug.cgi?id=167990 5 6 Reviewed by Sam Weinig. 7 8 * Misc/WebCache.mm: 9 (+[WebCache addImageToCache:forURL:forFrame:]): 10 (+[WebCache removeImageFromCacheForURL:forFrame:]): 11 * WebCoreSupport/WebSystemInterface.mm: 12 (InitWebCoreSystemInterface): 13 1 14 2017-02-07 Alexey Proskuryakov <ap@apple.com> 2 15 -
trunk/Source/WebKit/mac/Misc/WebCache.mm
r210923 r211946 35 35 #import <WebCore/CredentialStorage.h> 36 36 #import <WebCore/CrossOriginPreflightResultCache.h> 37 #import <WebCore/Document.h> 37 38 #import <WebCore/MemoryCache.h> 38 39 #import <runtime/InitializeThreading.h> … … 49 50 #endif 50 51 51 #if ENABLE(CACHE_PARTITIONING)52 #import <WebCore/Document.h>53 #endif54 55 52 @implementation WebCache 56 53 … … 169 166 return false; 170 167 WebCore::SecurityOrigin* topOrigin = nullptr; 171 #if ENABLE(CACHE_PARTITIONING)172 168 if (frame) 173 169 topOrigin = &core(frame)->document()->topOrigin(); 174 #endif175 170 return WebCore::MemoryCache::singleton().addImageToCache(RetainPtr<CGImageRef>(image), url, topOrigin ? topOrigin->domainForCachePartition() : emptyString()); 176 171 } … … 186 181 return; 187 182 WebCore::SecurityOrigin* topOrigin = nullptr; 188 #if ENABLE(CACHE_PARTITIONING)189 183 if (frame) 190 184 topOrigin = &core(frame)->document()->topOrigin(); 191 #endif192 185 WebCore::MemoryCache::singleton().removeImageFromCache(url, topOrigin ? topOrigin->domainForCachePartition() : emptyString()); 193 186 } -
trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
r204568 r211946 125 125 #endif 126 126 127 #if ENABLE(CACHE_PARTITIONING)128 127 INIT(CachePartitionKey); 129 #endif130 128 131 129 INIT(ExernalDeviceTypeForPlayer); -
trunk/Source/WebKit2/ChangeLog
r211929 r211946 1 2017-02-09 Antti Koivisto <antti@apple.com> 2 3 Remove most cases of #if ENABLE(CACHE_PARTITIONING) 4 https://bugs.webkit.org/show_bug.cgi?id=167990 5 6 Reviewed by Sam Weinig. 7 8 * NetworkProcess/NetworkResourceLoader.cpp: 9 (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): 10 * NetworkProcess/cache/NetworkCache.cpp: 11 (WebKit::NetworkCache::Cache::makeCacheKey): 12 * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: 13 (WebKit::NetworkCache::constructRevalidationRequest): 14 * Shared/WebCoreArgumentCoders.cpp: 15 (IPC::ArgumentCoder<ResourceRequest>::encode): 16 (IPC::ArgumentCoder<ResourceRequest>::decode): 17 * Shared/WebProcessCreationParameters.cpp: 18 (WebKit::WebProcessCreationParameters::encode): 19 (WebKit::WebProcessCreationParameters::decode): 20 * Shared/WebProcessCreationParameters.h: 21 * UIProcess/API/C/WKContext.cpp: 22 (WKContextRegisterURLSchemeAsCachePartitioned): 23 * UIProcess/WebProcessPool.cpp: 24 (WebKit::m_hiddenPageThrottlingTimer): 25 (WebKit::WebProcessPool::createNewWebProcess): 26 (WebKit::WebProcessPool::registerURLSchemeAsCachePartitioned): 27 * UIProcess/WebProcessPool.h: 28 * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: 29 (InitWebCoreSystemInterface): 30 * WebProcess/WebProcess.cpp: 31 (WebKit::WebProcess::initializeWebProcess): 32 (WebKit::WebProcess::registerURLSchemeAsCachePartitioned): 33 * WebProcess/WebProcess.h: 34 * WebProcess/WebProcess.messages.in: 35 1 36 2017-02-08 Simon Fraser <simon.fraser@apple.com> 2 37 -
trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.cpp
r211751 r211946 64 64 , m_session(session) 65 65 , m_client(&client) 66 #if ENABLE(CACHE_PARTITIONING)67 66 , m_partition(requestWithCredentials.cachePartition()) 68 #else69 , m_partition(emptyString())70 #endif71 67 , m_storedCredentials(storedCredentials) 72 68 , m_lastHTTPMethod(requestWithCredentials.httpMethod()) -
trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
r211894 r211946 573 573 574 574 if (entry->sourceStorageRecord().bodyHash && !m_parameters.derivedCachedDataTypesToRetrieve.isEmpty()) { 575 #if ENABLE(CACHE_PARTITIONING)576 String partition = originalRequest().cachePartition();577 #else578 String partition;579 #endif580 575 auto bodyHash = *entry->sourceStorageRecord().bodyHash; 581 576 auto* entryPtr = entry.release(); … … 583 578 584 579 for (auto& type : m_parameters.derivedCachedDataTypesToRetrieve) { 585 NetworkCache::DataKey key { partition, type, bodyHash };580 NetworkCache::DataKey key { originalRequest().cachePartition(), type, bodyHash }; 586 581 NetworkCache::singleton().retrieveData(key, [loader = makeRef(*this), entryPtr, type, retrieveCount] (const uint8_t* data, size_t size) mutable { 587 582 loader->m_retrievedDerivedDataCount++; -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
r211894 r211946 117 117 Key Cache::makeCacheKey(const WebCore::ResourceRequest& request) 118 118 { 119 #if ENABLE(CACHE_PARTITIONING)120 String partition = request.cachePartition();121 #else122 String partition;123 #endif124 125 119 // FIXME: This implements minimal Range header disk cache support. We don't parse 126 120 // ranges so only the same exact range request will be served from the cache. 127 121 String range = request.httpHeaderField(WebCore::HTTPHeaderName::Range); 128 return { partition, resourceType(), range, request.url().string(), m_storage->salt() };122 return { request.cachePartition(), resourceType(), range, request.url().string(), m_storage->salt() }; 129 123 } 130 124 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
r211894 r211946 90 90 revalidationRequest.setHTTPHeaderFields(subResourceInfo.requestHeaders()); 91 91 revalidationRequest.setFirstPartyForCookies(subResourceInfo.firstPartyForCookies()); 92 #if ENABLE(CACHE_PARTITIONING)93 92 if (!key.partition().isEmpty()) 94 93 revalidationRequest.setCachePartition(key.partition()); 95 #endif96 94 ASSERT_WITH_MESSAGE(key.range().isEmpty(), "range is not supported"); 97 95 98 96 revalidationRequest.makeUnconditional(); 99 97 if (entry) { -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
r211403 r211946 980 980 void ArgumentCoder<ResourceRequest>::encode(Encoder& encoder, const ResourceRequest& resourceRequest) 981 981 { 982 #if ENABLE(CACHE_PARTITIONING)983 982 encoder << resourceRequest.cachePartition(); 984 #endif985 986 983 encoder << resourceRequest.hiddenFromInspector(); 987 984 … … 997 994 bool ArgumentCoder<ResourceRequest>::decode(Decoder& decoder, ResourceRequest& resourceRequest) 998 995 { 999 #if ENABLE(CACHE_PARTITIONING)1000 996 String cachePartition; 1001 997 if (!decoder.decode(cachePartition)) 1002 998 return false; 1003 999 resourceRequest.setCachePartition(cachePartition); 1004 #endif1005 1000 1006 1001 bool isHiddenFromInspector; -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
r211470 r211946 92 92 encoder << urlSchemesRegisteredAsCORSEnabled; 93 93 encoder << urlSchemesRegisteredAsAlwaysRevalidated; 94 #if ENABLE(CACHE_PARTITIONING)95 94 encoder << urlSchemesRegisteredAsCachePartitioned; 96 #endif97 95 encoder.encodeEnum(cacheModel); 98 96 encoder << shouldAlwaysUseComplexTextCodePath; … … 222 220 if (!decoder.decode(parameters.urlSchemesRegisteredAsAlwaysRevalidated)) 223 221 return false; 224 #if ENABLE(CACHE_PARTITIONING)225 222 if (!decoder.decode(parameters.urlSchemesRegisteredAsCachePartitioned)) 226 223 return false; 227 #endif228 224 if (!decoder.decodeEnum(parameters.cacheModel)) 229 225 return false; -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h
r211470 r211946 101 101 Vector<String> urlSchemesRegisteredAsCORSEnabled; 102 102 Vector<String> urlSchemesRegisteredAsAlwaysRevalidated; 103 #if ENABLE(CACHE_PARTITIONING)104 103 Vector<String> urlSchemesRegisteredAsCachePartitioned; 105 #endif106 104 107 105 CacheModel cacheModel; -
trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp
r209840 r211946 380 380 void WKContextRegisterURLSchemeAsCachePartitioned(WKContextRef contextRef, WKStringRef urlScheme) 381 381 { 382 #if ENABLE(CACHE_PARTITIONING)383 382 toImpl(contextRef)->registerURLSchemeAsCachePartitioned(toImpl(urlScheme)->string()); 384 #else385 UNUSED_PARAM(contextRef);386 UNUSED_PARAM(urlScheme);387 #endif388 383 } 389 384 -
trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp
r211470 r211946 188 188 m_schemesToRegisterAsAlwaysRevalidated.add(scheme); 189 189 190 #if ENABLE(CACHE_PARTITIONING)191 190 for (const auto& urlScheme : m_configuration->cachePartitionedURLSchemes()) 192 191 m_schemesToRegisterAsCachePartitioned.add(urlScheme); 193 #endif194 192 195 193 platformInitialize(); … … 597 595 copyToVector(m_schemesToRegisterAsCORSEnabled, parameters.urlSchemesRegisteredAsCORSEnabled); 598 596 copyToVector(m_schemesToRegisterAsAlwaysRevalidated, parameters.urlSchemesRegisteredAsAlwaysRevalidated); 599 #if ENABLE(CACHE_PARTITIONING)600 597 copyToVector(m_schemesToRegisterAsCachePartitioned, parameters.urlSchemesRegisteredAsCachePartitioned); 601 #endif602 598 603 599 parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath; … … 1005 1001 } 1006 1002 1007 #if ENABLE(CACHE_PARTITIONING)1008 1003 void WebProcessPool::registerURLSchemeAsCachePartitioned(const String& urlScheme) 1009 1004 { … … 1011 1006 sendToAllProcesses(Messages::WebProcess::RegisterURLSchemeAsCachePartitioned(urlScheme)); 1012 1007 } 1013 #endif1014 1008 1015 1009 void WebProcessPool::setCacheModel(CacheModel cacheModel) -
trunk/Source/WebKit2/UIProcess/WebProcessPool.h
r210936 r211946 211 211 void registerURLSchemeAsDisplayIsolated(const String&); 212 212 void registerURLSchemeAsCORSEnabled(const String&); 213 #if ENABLE(CACHE_PARTITIONING)214 213 void registerURLSchemeAsCachePartitioned(const String&); 215 #endif216 214 217 215 VisitedLinkStore& visitedLinkStore() { return m_visitedLinkStore.get(); } … … 500 498 HashSet<String> m_schemesToRegisterAsCORSEnabled; 501 499 HashSet<String> m_schemesToRegisterAsAlwaysRevalidated; 502 #if ENABLE(CACHE_PARTITIONING)503 500 HashSet<String> m_schemesToRegisterAsCachePartitioned; 504 #endif505 501 506 502 bool m_alwaysUsesComplexTextCodePath; -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
r211751 r211946 1590 1590 bool PluginView::getAuthenticationInfo(const ProtectionSpace& protectionSpace, String& username, String& password) 1591 1591 { 1592 #if ENABLE(CACHE_PARTITIONING)1593 1592 String partitionName = m_pluginElement->contentDocument()->topDocument().securityOrigin().domainForCachePartition(); 1594 #else1595 String partitionName = emptyString();1596 #endif1597 1593 Credential credential = CredentialStorage::defaultCredentialStorage().get(partitionName, protectionSpace); 1598 1594 if (credential.isEmpty()) -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
r204568 r211946 112 112 #endif 113 113 114 #if ENABLE(CACHE_PARTITIONING)115 114 INIT(CachePartitionKey); 116 #endif117 115 118 116 INIT(ExernalDeviceTypeForPlayer); -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r211747 r211946 338 338 registerURLSchemeAsAlwaysRevalidated(scheme); 339 339 340 #if ENABLE(CACHE_PARTITIONING)341 340 for (auto& scheme : parameters.urlSchemesRegisteredAsCachePartitioned) 342 341 registerURLSchemeAsCachePartitioned(scheme); 343 #endif344 342 345 343 setDefaultRequestTimeoutInterval(parameters.defaultRequestTimeoutInterval); … … 463 461 } 464 462 465 #if ENABLE(CACHE_PARTITIONING)466 463 void WebProcess::registerURLSchemeAsCachePartitioned(const String& urlScheme) const 467 464 { 468 465 SchemeRegistry::registerURLSchemeAsCachePartitioned(urlScheme); 469 466 } 470 #endif471 467 472 468 void WebProcess::setDefaultRequestTimeoutInterval(double timeoutInterval) -
trunk/Source/WebKit2/WebProcess/WebProcess.h
r211747 r211946 258 258 void registerURLSchemeAsCORSEnabled(const String&) const; 259 259 void registerURLSchemeAsAlwaysRevalidated(const String&) const; 260 #if ENABLE(CACHE_PARTITIONING)261 260 void registerURLSchemeAsCachePartitioned(const String&) const; 262 #endif263 261 void setDefaultRequestTimeoutInterval(double); 264 262 void setAlwaysUsesComplexTextCodePath(bool); -
trunk/Source/WebKit2/WebProcess/WebProcess.messages.in
r210921 r211946 37 37 RegisterURLSchemeAsDisplayIsolated(String scheme) 38 38 RegisterURLSchemeAsCORSEnabled(String scheme) 39 #if ENABLE(CACHE_PARTITIONING)40 39 RegisterURLSchemeAsCachePartitioned(String scheme) 41 #endif42 40 SetDefaultRequestTimeoutInterval(double timeoutInterval) 43 41 SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
Note: See TracChangeset
for help on using the changeset viewer.