< prev index next >
modules/web/src/main/native/Source/WebCore/loader/cache/CachedResourceLoader.cpp
Print this page
*** 288,297 ****
--- 288,310 ----
FrameLoader::reportLocalLoadFailed(frame(), url.stringCenterEllipsizedToLength());
LOG(ResourceLoading, "CachedResourceLoader::requestResource URL was not allowed by SecurityOrigin::canDisplay");
return 0;
}
+ if (m_documentLoader) {
+ // Don't load for user cancel or stop
+ if (!m_documentLoader->mainDocumentError().isNull() && m_documentLoader->mainDocumentError().isCancellation())
+ return false;
+
+ // While navigating to new page and till the main resource is not received completly or
+ // till the Provisional state the current frame is not detached. These will lead to
+ // loading sub resource of previous page from either script runner, ResourceLoadScheduler,
+ // HTMLScriptRunner.
+ if (m_documentLoader->frame() && m_documentLoader->frame()->loader().state() == FrameState::FrameStateProvisional && type != CachedResource::Type::MainResource)
+ return false;
+ }
+
// FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
bool shouldBypassMainWorldContentSecurityPolicy = (frame() && frame()->script().shouldBypassMainWorldContentSecurityPolicy());
// Some types of resources can be loaded only from the same origin. Other
// types of resources, like Images, Scripts, and CSS, can be loaded from
*** 779,788 ****
--- 792,806 ----
void CachedResourceLoader::performPostLoadActions()
{
checkForPendingPreloads();
+ // PostLoad might trigger async resource request which is not required for Canceled Main Document
+ // caused by user cancel or stop
+ if (m_documentLoader && !m_documentLoader->mainDocumentError().isNull() && m_documentLoader->mainDocumentError().isCancellation())
+ return;
+
platformStrategies()->loaderStrategy()->resourceLoadScheduler()->servePendingRequests();
}
void CachedResourceLoader::incrementRequestCount(const CachedResource* res)
{
< prev index next >