Title: [137604] trunk/Source/WebCore
- Revision
- 137604
- Author
- [email protected]
- Date
- 2012-12-13 09:37:33 -0800 (Thu, 13 Dec 2012)
Log Message
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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (137603 => 137604)
--- trunk/Source/WebCore/ChangeLog 2012-12-13 17:18:19 UTC (rev 137603)
+++ trunk/Source/WebCore/ChangeLog 2012-12-13 17:37:33 UTC (rev 137604)
@@ -1,3 +1,25 @@
+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-13 Claudio Saavedra <[email protected]>
[GTK] Remove deprecated API usage
Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (137603 => 137604)
--- trunk/Source/WebCore/loader/cache/CachedResource.cpp 2012-12-13 17:18:19 UTC (rev 137603)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp 2012-12-13 17:37:33 UTC (rev 137604)
@@ -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: trunk/Source/WebCore/loader/cache/CachedResource.h (137603 => 137604)
--- trunk/Source/WebCore/loader/cache/CachedResource.h 2012-12-13 17:18:19 UTC (rev 137603)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h 2012-12-13 17:37:33 UTC (rev 137604)
@@ -308,6 +308,8 @@
void addAdditionalRequestHeaders(CachedResourceLoader*);
void failBeforeStarting();
+ String m_fragmentIdentifierForRequest;
+
RefPtr<CachedMetadata> m_cachedMetadata;
ResourceError m_error;
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (137603 => 137604)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-12-13 17:18:19 UTC (rev 137603)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2012-12-13 17:37:33 UTC (rev 137604)
@@ -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