|
Lines 46-51
Source/WebCore/loader/MainResourceLoader.cpp_sec1
|
| 46 |
#include "HTMLFormElement.h" |
46 |
#include "HTMLFormElement.h" |
| 47 |
#include "HistoryItem.h" |
47 |
#include "HistoryItem.h" |
| 48 |
#include "InspectorInstrumentation.h" |
48 |
#include "InspectorInstrumentation.h" |
|
|
49 |
#include "MemoryCache.h" |
| 49 |
#include "Page.h" |
50 |
#include "Page.h" |
| 50 |
#include "ProgressTracker.h" |
51 |
#include "ProgressTracker.h" |
| 51 |
#include "ResourceBuffer.h" |
52 |
#include "ResourceBuffer.h" |
|
Lines 73-79
Source/WebCore/loader/MainResourceLoader.cpp_sec2
|
| 73 |
, m_loadingMultipartContent(false) |
74 |
, m_loadingMultipartContent(false) |
| 74 |
, m_waitingForContentPolicy(false) |
75 |
, m_waitingForContentPolicy(false) |
| 75 |
, m_timeOfLastDataReceived(0.0) |
76 |
, m_timeOfLastDataReceived(0.0) |
| 76 |
, m_substituteDataLoadIdentifier(0) |
77 |
, m_identifierForLoadWithoutResourceLoader(0) |
| 77 |
#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
78 |
#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
| 78 |
, m_filter(0) |
79 |
, m_filter(0) |
| 79 |
#endif |
80 |
#endif |
|
Lines 99-107
Source/WebCore/loader/MainResourceLoader.cpp_sec3
|
| 99 |
RefPtr<MainResourceLoader> protect(this); |
100 |
RefPtr<MainResourceLoader> protect(this); |
| 100 |
RefPtr<Frame> protectFrame(m_documentLoader->frame()); |
101 |
RefPtr<Frame> protectFrame(m_documentLoader->frame()); |
| 101 |
|
102 |
|
| 102 |
if (m_substituteDataLoadIdentifier) { |
103 |
if (m_identifierForLoadWithoutResourceLoader) { |
| 103 |
ASSERT(!loader()); |
104 |
ASSERT(!loader()); |
| 104 |
frameLoader()->client()->dispatchDidFailLoading(documentLoader(), m_substituteDataLoadIdentifier, error); |
105 |
frameLoader()->client()->dispatchDidFailLoading(documentLoader(), m_identifierForLoadWithoutResourceLoader, error); |
| 105 |
} |
106 |
} |
| 106 |
|
107 |
|
| 107 |
// It is important that we call DocumentLoader::mainReceivedError before calling |
108 |
// It is important that we call DocumentLoader::mainReceivedError before calling |
|
Lines 286-292
Source/WebCore/loader/MainResourceLoader.cpp_sec4
|
| 286 |
ASSERT(!m_substituteData.isValid()); |
287 |
ASSERT(!m_substituteData.isValid()); |
| 287 |
documentLoader()->applicationCacheHost()->maybeLoadMainResourceForRedirect(newRequest, m_substituteData); |
288 |
documentLoader()->applicationCacheHost()->maybeLoadMainResourceForRedirect(newRequest, m_substituteData); |
| 288 |
if (m_substituteData.isValid()) |
289 |
if (m_substituteData.isValid()) |
| 289 |
m_substituteDataLoadIdentifier = identifier(); |
290 |
m_identifierForLoadWithoutResourceLoader = identifier(); |
| 290 |
} |
291 |
} |
| 291 |
|
292 |
|
| 292 |
// FIXME: Ideally we'd stop the I/O until we hear back from the navigation policy delegate |
293 |
// FIXME: Ideally we'd stop the I/O until we hear back from the navigation policy delegate |
|
Lines 392-398
Source/WebCore/loader/MainResourceLoader.cpp_sec5
|
| 392 |
void MainResourceLoader::responseReceived(CachedResource* resource, const ResourceResponse& r) |
393 |
void MainResourceLoader::responseReceived(CachedResource* resource, const ResourceResponse& r) |
| 393 |
{ |
394 |
{ |
| 394 |
ASSERT_UNUSED(resource, m_resource == resource); |
395 |
ASSERT_UNUSED(resource, m_resource == resource); |
| 395 |
if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForMainResponse(request(), r)) |
396 |
bool willLoadFallback = documentLoader()->applicationCacheHost()->maybeLoadFallbackForMainResponse(request(), r); |
|
|
397 |
|
| 398 |
// The memory cache doesn't understand the application cache or its caching rules. So if a main resource is served |
| 399 |
// from the application cache, ensure we don't save the result for future use. |
| 400 |
bool shouldRemoveResourceFromCache = willLoadFallback; |
| 401 |
#if PLATFORM(CHROMIUM) |
| 402 |
// chromium's ApplicationCacheHost implementation always returns true for maybeLoadFallbackForMainResponse(). However, all responses loaded |
| 403 |
// from appcache will have a non-zero appCacheID(). |
| 404 |
if (r.appCacheID()) |
| 405 |
shouldRemoveResourceFromCache = true; |
| 406 |
#endif |
| 407 |
if (shouldRemoveResourceFromCache) |
| 408 |
memoryCache()->remove(m_resource.get()); |
| 409 |
|
| 410 |
if (willLoadFallback) |
| 396 |
return; |
411 |
return; |
| 397 |
|
412 |
|
| 398 |
DEFINE_STATIC_LOCAL(AtomicString, xFrameOptionHeader, ("x-frame-options", AtomicString::ConstructFromLiteral)); |
413 |
DEFINE_STATIC_LOCAL(AtomicString, xFrameOptionHeader, ("x-frame-options", AtomicString::ConstructFromLiteral)); |
|
Lines 540-546
Source/WebCore/loader/MainResourceLoader.cpp_sec6
|
| 540 |
|
555 |
|
| 541 |
if (!loader()) { |
556 |
if (!loader()) { |
| 542 |
frameLoader()->notifier()->dispatchDidFinishLoading(documentLoader(), identifier(), finishTime); |
557 |
frameLoader()->notifier()->dispatchDidFinishLoading(documentLoader(), identifier(), finishTime); |
| 543 |
m_substituteDataLoadIdentifier = 0; |
558 |
m_identifierForLoadWithoutResourceLoader = 0; |
| 544 |
} |
559 |
} |
| 545 |
|
560 |
|
| 546 |
#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
561 |
#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
|
Lines 562-567
Source/WebCore/loader/MainResourceLoader.cpp_sec7
|
| 562 |
documentLoader()->timing()->setResponseEnd(finishTime ? finishTime : (m_timeOfLastDataReceived ? m_timeOfLastDataReceived : monotonicallyIncreasingTime())); |
577 |
documentLoader()->timing()->setResponseEnd(finishTime ? finishTime : (m_timeOfLastDataReceived ? m_timeOfLastDataReceived : monotonicallyIncreasingTime())); |
| 563 |
documentLoader()->finishedLoading(); |
578 |
documentLoader()->finishedLoading(); |
| 564 |
|
579 |
|
|
|
580 |
// If the document specified an application cache manifest, it violates the author's intent if we store it in the memory cache |
| 581 |
// and deny the appcache the chance to intercept it in the future, so remove from the memory cache. |
| 582 |
if (Frame* frame = documentLoader()->frame()) { |
| 583 |
if (m_resource && frame->document()->hasManifest()) |
| 584 |
memoryCache()->remove(m_resource.get()); |
| 585 |
} |
| 586 |
|
| 565 |
dl->applicationCacheHost()->finishedLoadingMainResource(); |
587 |
dl->applicationCacheHost()->finishedLoadingMainResource(); |
| 566 |
} |
588 |
} |
| 567 |
|
589 |
|
|
Lines 671-679
Source/WebCore/loader/MainResourceLoader.cpp_sec8
|
| 671 |
documentLoader()->applicationCacheHost()->maybeLoadMainResource(request, m_substituteData); |
693 |
documentLoader()->applicationCacheHost()->maybeLoadMainResource(request, m_substituteData); |
| 672 |
|
694 |
|
| 673 |
if (m_substituteData.isValid()) { |
695 |
if (m_substituteData.isValid()) { |
| 674 |
m_substituteDataLoadIdentifier = m_documentLoader->frame()->page()->progress()->createUniqueIdentifier(); |
696 |
m_identifierForLoadWithoutResourceLoader = m_documentLoader->frame()->page()->progress()->createUniqueIdentifier(); |
| 675 |
frameLoader()->notifier()->assignIdentifierToInitialRequest(m_substituteDataLoadIdentifier, documentLoader(), request); |
697 |
frameLoader()->notifier()->assignIdentifierToInitialRequest(m_identifierForLoadWithoutResourceLoader, documentLoader(), request); |
| 676 |
frameLoader()->notifier()->dispatchWillSendRequest(documentLoader(), m_substituteDataLoadIdentifier, request, ResourceResponse()); |
698 |
frameLoader()->notifier()->dispatchWillSendRequest(documentLoader(), m_identifierForLoadWithoutResourceLoader, request, ResourceResponse()); |
| 677 |
handleSubstituteDataLoadSoon(request); |
699 |
handleSubstituteDataLoadSoon(request); |
| 678 |
return; |
700 |
return; |
| 679 |
} |
701 |
} |
|
Lines 686-698
Source/WebCore/loader/MainResourceLoader.cpp_sec9
|
| 686 |
documentLoader()->setRequest(ResourceRequest()); |
708 |
documentLoader()->setRequest(ResourceRequest()); |
| 687 |
return; |
709 |
return; |
| 688 |
} |
710 |
} |
|
|
711 |
if (!loader()) { |
| 712 |
m_identifierForLoadWithoutResourceLoader = m_documentLoader->frame()->page()->progress()->createUniqueIdentifier(); |
| 713 |
frameLoader()->notifier()->assignIdentifierToInitialRequest(m_identifierForLoadWithoutResourceLoader, documentLoader(), request); |
| 714 |
frameLoader()->notifier()->dispatchWillSendRequest(documentLoader(), m_identifierForLoadWithoutResourceLoader, request, ResourceResponse()); |
| 715 |
} |
| 689 |
m_resource->addClient(this); |
716 |
m_resource->addClient(this); |
| 690 |
|
717 |
|
| 691 |
// We need to wait until after requestMainResource() is called to setRequest(), because there are a bunch of headers set when |
718 |
// A bunch of headers are set when the underlying ResourceLoader is created, and DocumentLoader::m_request needs to include those. |
| 692 |
// the underlying ResourceLoader is created, and DocumentLoader::m_request needs to include those. However, the cache will |
|
|
| 693 |
// strip the fragment identifier (which DocumentLoader::m_request should also include), so add that back in. |
| 694 |
if (loader()) |
719 |
if (loader()) |
| 695 |
request = loader()->originalRequest(); |
720 |
request = loader()->originalRequest(); |
|
|
721 |
// If there was a fragment identifier on initialRequest, the cache will have stripped it. DocumentLoader::m_request should include |
| 722 |
// the fragment identifier, so add that back in. |
| 723 |
if (equalIgnoringFragmentIdentifier(initialRequest.url(), request.url())) |
| 724 |
request.setURL(initialRequest.url()); |
| 696 |
documentLoader()->setRequest(request); |
725 |
documentLoader()->setRequest(request); |
| 697 |
} |
726 |
} |
| 698 |
|
727 |
|
|
Lines 720-728
Source/WebCore/loader/MainResourceLoader.cpp_sec10
|
| 720 |
|
749 |
|
| 721 |
unsigned long MainResourceLoader::identifier() const |
750 |
unsigned long MainResourceLoader::identifier() const |
| 722 |
{ |
751 |
{ |
| 723 |
ASSERT(!m_substituteDataLoadIdentifier || !loader() || !loader()->identifier()); |
752 |
ASSERT(!m_identifierForLoadWithoutResourceLoader || !loader() || !loader()->identifier()); |
| 724 |
if (m_substituteDataLoadIdentifier) |
753 |
if (m_identifierForLoadWithoutResourceLoader) |
| 725 |
return m_substituteDataLoadIdentifier; |
754 |
return m_identifierForLoadWithoutResourceLoader; |
| 726 |
if (ResourceLoader* resourceLoader = loader()) |
755 |
if (ResourceLoader* resourceLoader = loader()) |
| 727 |
return resourceLoader->identifier(); |
756 |
return resourceLoader->identifier(); |
| 728 |
return 0; |
757 |
return 0; |