Title: [137639] tags/Safari-537.21/Source/WebCore
- Revision
- 137639
- Author
- [email protected]
- Date
- 2012-12-13 12:50:32 -0800 (Thu, 13 Dec 2012)
Log Message
Merged r137604. <rdar://problem/12815054>
Modified Paths
Diff
Modified: tags/Safari-537.21/Source/WebCore/ChangeLog (137638 => 137639)
--- tags/Safari-537.21/Source/WebCore/ChangeLog 2012-12-13 20:46:32 UTC (rev 137638)
+++ tags/Safari-537.21/Source/WebCore/ChangeLog 2012-12-13 20:50:32 UTC (rev 137639)
@@ -1,3 +1,29 @@
+2012-12-13 Lucas Forschler <[email protected]>
+
+ Merge r137604
+
+ 2012-12-13 Nate Chapin <[email protected]>
+
+ CachedResources should hang on to stripped fragment identifiers
+ https://bugs.webkit.org/show_bug.cgi?id=104721
+
+ Reviewed by Maciej Stachowiak.
+
+ No new tests, this will be unused until bug
+ https://bugs.webkit.org/show_bug.cgi?id=49246 re-lands. Then, it will
+ allow http/tests/inspector/resource-parameters.html to continue passing.
+
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::CachedResource):
+ (WebCore::CachedResource::load):
+ * loader/cache/CachedResource.h:
+ (CachedResource):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource): We override the request's url with the
+ local variable "url" here. The only difference between url and request.url() is that url
+ has had any fragment identifier removed. Do this work later (in the CachedResource constructor)
+ so that the CachedResource can save the fragment for later.
+
2012-12-12 Shinya Kawanaka <[email protected]>
ContainerNodeAlgorithm::notifyInsertedIntoDocument is not used
Modified: tags/Safari-537.21/Source/WebCore/loader/cache/CachedResource.cpp (137638 => 137639)
--- tags/Safari-537.21/Source/WebCore/loader/cache/CachedResource.cpp 2012-12-13 20:46:32 UTC (rev 137638)
+++ tags/Safari-537.21/Source/WebCore/loader/cache/CachedResource.cpp 2012-12-13 20:50:32 UTC (rev 137639)
@@ -188,6 +188,14 @@
#ifndef NDEBUG
cachedResourceLeakCounter.increment();
#endif
+
+ if (!m_resourceRequest.url().hasFragmentIdentifier())
+ return;
+ KURL urlForCache = MemoryCache::removeFragmentIdentifierIfNeeded(m_resourceRequest.url());
+ if (urlForCache.hasFragmentIdentifier())
+ return;
+ m_fragmentIdentifierForRequest = m_resourceRequest.url().fragmentIdentifier();
+ m_resourceRequest.setURL(urlForCache);
}
CachedResource::~CachedResource()
@@ -293,10 +301,20 @@
if (type() != MainResource)
addAdditionalRequestHeaders(cachedResourceLoader);
+ // FIXME: It's unfortunate that the cache layer and below get to know anything about fragment identifiers.
+ // We should look into removing the expectation of that knowledge from the platform network stacks.
+ ResourceRequest request(m_resourceRequest);
+ if (!m_fragmentIdentifierForRequest.isNull()) {
+ KURL url = ""
+ url.setFragmentIdentifier(m_fragmentIdentifierForRequest);
+ request.setURL(url);
+ m_fragmentIdentifierForRequest = String();
+ }
+
#if USE(PLATFORM_STRATEGIES)
- m_loader = platformStrategies()->loaderStrategy()->resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, m_resourceRequest, m_resourceRequest.priority(), options);
+ m_loader = platformStrategies()->loaderStrategy()->resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, request, request.priority(), options);
#else
- m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, m_resourceRequest, m_resourceRequest.priority(), options);
+ m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, request, request.priority(), options);
#endif
if (!m_loader) {
Modified: tags/Safari-537.21/Source/WebCore/loader/cache/CachedResource.h (137638 => 137639)
--- tags/Safari-537.21/Source/WebCore/loader/cache/CachedResource.h 2012-12-13 20:46:32 UTC (rev 137638)
+++ tags/Safari-537.21/Source/WebCore/loader/cache/CachedResource.h 2012-12-13 20:50:32 UTC (rev 137639)
@@ -308,6 +308,8 @@
void addAdditionalRequestHeaders(CachedResourceLoader*);
void failBeforeStarting();
+ String m_fragmentIdentifierForRequest;
+
RefPtr<CachedMetadata> m_cachedMetadata;
ResourceError m_error;
Modified: tags/Safari-537.21/Source/WebCore/loader/cache/CachedResourceLoader.cpp (137638 => 137639)
--- tags/Safari-537.21/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-12-13 20:46:32 UTC (rev 137638)
+++ tags/Safari-537.21/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-12-13 20:50:32 UTC (rev 137639)
@@ -441,9 +441,6 @@
// See if we can use an existing resource from the cache.
CachedResourceHandle<CachedResource> resource = memoryCache()->resourceForURL(url);
- if (request.resourceRequest().url() != url)
- request.mutableResourceRequest().setURL(url);
-
const RevalidationPolicy policy = determineRevalidationPolicy(type, request.mutableResourceRequest(), request.forPreload(), resource.get(), request.defer());
switch (policy) {
case Reload:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes