--- old/modules/web/src/main/native/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2016-03-30 11:25:04.950185800 +0530 +++ new/modules/web/src/main/native/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2016-03-30 11:25:04.191109900 +0530 @@ -290,6 +290,19 @@ 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()); @@ -781,6 +794,11 @@ { 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(); }