summaryrefslogtreecommitdiff
path: root/Source/WebCore/loader
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/loader')
-rw-r--r--Source/WebCore/loader/FrameLoader.cpp24
-rw-r--r--Source/WebCore/loader/HistoryController.cpp2
-rw-r--r--Source/WebCore/loader/SubresourceLoader.cpp36
-rw-r--r--[-rwxr-xr-x]Source/WebCore/loader/cache/CachedResource.cpp0
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.cpp2
5 files changed, 43 insertions, 21 deletions
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index a84c508eb..9c3966cab 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -70,6 +70,7 @@
#include "HTMLFormElement.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
+#include "HTMLParserIdioms.h"
#include "HTTPParsers.h"
#include "HistoryItem.h"
#include "InspectorController.h"
@@ -666,6 +667,15 @@ void FrameLoader::didBeginDocument(bool dispatch)
String reportOnlyContentSecurityPolicy = m_documentLoader->response().httpHeaderField("X-WebKit-CSP-Report-Only");
if (!reportOnlyContentSecurityPolicy.isEmpty())
m_frame->document()->contentSecurityPolicy()->didReceiveHeader(reportOnlyContentSecurityPolicy, ContentSecurityPolicy::ReportOnly);
+
+ String headerContentLanguage = m_documentLoader->response().httpHeaderField("Content-Language");
+ if (!headerContentLanguage.isEmpty()) {
+ size_t commaIndex = headerContentLanguage.find(',');
+ headerContentLanguage.truncate(commaIndex); // notFound == -1 == don't truncate
+ headerContentLanguage = headerContentLanguage.stripWhiteSpace(isHTMLSpace);
+ if (!headerContentLanguage.isEmpty())
+ m_frame->document()->setContentLanguage(headerContentLanguage);
+ }
}
history()->restoreDocumentState();
@@ -1689,6 +1699,9 @@ void FrameLoader::commitProvisionalLoad()
prepareForCachedPageRestore();
cachedPage->restore(m_frame->page());
+ // The page should be removed from the cache immediately after a restoration in order for the PageCache to be consistent.
+ pageCache()->remove(history()->currentItem());
+
dispatchDidCommitLoad();
// If we have a title let the WebView know about it.
@@ -1697,8 +1710,11 @@ void FrameLoader::commitProvisionalLoad()
m_client->dispatchDidReceiveTitle(title);
checkCompleted();
- } else
+ } else {
+ if (cachedPage)
+ pageCache()->remove(history()->currentItem());
didOpenURL();
+ }
LOG(Loading, "WebCoreLoading %s: Finished committing provisional load to URL %s", m_frame->tree()->uniqueName().string().utf8().data(),
m_frame->document() ? m_frame->document()->url().string().utf8().data() : "");
@@ -1726,8 +1742,6 @@ void FrameLoader::commitProvisionalLoad()
// Could be an issue with a giant local file.
notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, 0, static_cast<int>(response.expectedContentLength()), 0, error);
}
-
- pageCache()->remove(history()->currentItem());
// FIXME: Why only this frame and not parent frames?
checkLoadCompleteForThisFrame();
@@ -3192,8 +3206,10 @@ void FrameLoader::dispatchDidCommitLoad()
m_client->dispatchDidCommitLoad();
- if (isLoadingMainFrame())
+ if (isLoadingMainFrame()) {
m_frame->page()->resetSeenPlugins();
+ m_frame->page()->resetSeenMediaEngines();
+ }
InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get());
}
diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp
index 8551a52d9..fb6d0e35c 100644
--- a/Source/WebCore/loader/HistoryController.cpp
+++ b/Source/WebCore/loader/HistoryController.cpp
@@ -60,7 +60,7 @@ namespace WebCore {
static inline void addVisitedLink(Page* page, const KURL& url)
{
#if USE(PLATFORM_STRATEGIES)
- platformStrategies()->visitedLinkStrategy()->addVisitedLink(page, visitedLinkHash(url.string().characters(), url.string().length()));
+ platformStrategies()->visitedLinkStrategy()->addVisitedLink(page, visitedLinkHash(url.string()));
#else
page->group().addVisitedLink(url);
#endif
diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp
index 50975794e..e57017126 100644
--- a/Source/WebCore/loader/SubresourceLoader.cpp
+++ b/Source/WebCore/loader/SubresourceLoader.cpp
@@ -128,17 +128,24 @@ void SubresourceLoader::willSendRequest(ResourceRequest& newRequest, const Resou
{
// Store the previous URL because the call to ResourceLoader::willSendRequest will modify it.
KURL previousURL = request().url();
-
- ResourceLoader::willSendRequest(newRequest, redirectResponse);
- if (!previousURL.isNull() && !newRequest.isNull() && previousURL != newRequest.url()) {
- if (m_documentLoader->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) {
- if (m_resource->type() != CachedResource::ImageResource || !m_documentLoader->cachedResourceLoader()->shouldDeferImageLoad(newRequest.url())) {
- m_resource->willSendRequest(newRequest, redirectResponse);
- return;
- }
+
+ ASSERT(!newRequest.isNull());
+ if (!previousURL.isNull() && previousURL != newRequest.url()) {
+ if (!m_documentLoader->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) {
+ cancel();
+ return;
+ }
+ if (m_resource->type() == CachedResource::ImageResource && m_documentLoader->cachedResourceLoader()->shouldDeferImageLoad(newRequest.url())) {
+ cancel();
+ return;
}
- cancel();
+ m_resource->willSendRequest(newRequest, redirectResponse);
}
+
+ if (newRequest.isNull() || reachedTerminalState())
+ return;
+
+ ResourceLoader::willSendRequest(newRequest, redirectResponse);
}
void SubresourceLoader::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
@@ -207,12 +214,11 @@ void SubresourceLoader::didReceiveData(const char* data, int length, long long e
// Reference the object in this method since the additional processing can do
// anything including removing the last reference to this object; one example of this is 3266216.
RefPtr<SubresourceLoader> protect(this);
- ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce);
-
- if (m_loadingMultipartContent)
- return;
-
- sendDataToResource(data, length);
+ addData(data, length, allAtOnce);
+ if (!m_loadingMultipartContent)
+ sendDataToResource(data, length);
+ if (shouldSendResourceLoadCallbacks() && m_frame)
+ frameLoader()->notifier()->didReceiveData(this, data, length, static_cast<int>(encodedDataLength));
}
bool SubresourceLoader::checkForHTTPStatusCodeError()
diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp
index 703c42836..703c42836 100755..100644
--- a/Source/WebCore/loader/cache/CachedResource.cpp
+++ b/Source/WebCore/loader/cache/CachedResource.cpp
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 7c420c066..1ffca4fc1 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -229,7 +229,7 @@ CachedResourceHandle<CachedXSLStyleSheet> CachedResourceLoader::requestXSLStyleS
#if ENABLE(SVG)
CachedResourceHandle<CachedSVGDocument> CachedResourceLoader::requestSVGDocument(ResourceRequest& request)
{
- return static_cast<CachedSVGDocument*>(requestResource(CachedResource::SVGDocumentResource, request, request.url(), defaultCachedResourceOptions()).get());
+ return static_cast<CachedSVGDocument*>(requestResource(CachedResource::SVGDocumentResource, request, String(), defaultCachedResourceOptions()).get());
}
#endif