summaryrefslogtreecommitdiffstats
path: root/WebCore/loader/MainResourceLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/loader/MainResourceLoader.cpp')
-rw-r--r--WebCore/loader/MainResourceLoader.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index 5aa1cde..39e5b90 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* Redistribution and use in source and binary forms, with or without
@@ -30,12 +30,8 @@
#include "config.h"
#include "MainResourceLoader.h"
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-#include "ApplicationCache.h"
-#include "ApplicationCacheGroup.h"
-#include "ApplicationCacheResource.h"
-#endif
#include "DocumentLoader.h"
+#include "FormState.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
@@ -45,6 +41,12 @@
#include "ResourceHandle.h"
#include "Settings.h"
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+#include "ApplicationCache.h"
+#include "ApplicationCacheGroup.h"
+#include "ApplicationCacheResource.h"
+#endif
+
// FIXME: More that is in common with SubresourceLoader should move up into ResourceLoader.
namespace WebCore {
@@ -161,7 +163,7 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
// Update cookie policy base URL as URL changes, except for subframes, which use the
// URL of the main frame which doesn't change when we redirect.
if (frameLoader()->isLoadingMainFrame())
- newRequest.setMainDocumentURL(newRequest.url());
+ newRequest.setFirstPartyForCookies(newRequest.url());
// If we're fielding a redirect in response to a POST, force a load from origin, since
// this is a common site technique to return to a page viewing some data that the POST
@@ -179,9 +181,10 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
// listener. But there's no way to do that in practice. So instead we cancel later if the
// listener tells us to. In practice that means the navigation policy needs to be decided
// synchronously for these redirect cases.
-
- ref(); // balanced by deref in continueAfterNavigationPolicy
- frameLoader()->checkNavigationPolicy(newRequest, callContinueAfterNavigationPolicy, this);
+ if (!redirectResponse.isNull()) {
+ ref(); // balanced by deref in continueAfterNavigationPolicy
+ frameLoader()->checkNavigationPolicy(newRequest, callContinueAfterNavigationPolicy, this);
+ }
}
static bool shouldLoadAsEmptyDocument(const KURL& url)
@@ -291,6 +294,15 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r)
}
#endif
+ HTTPHeaderMap::const_iterator it = r.httpHeaderFields().find(AtomicString("x-frame-options"));
+ if (it != r.httpHeaderFields().end()) {
+ String content = it->second;
+ if (m_frame->loader()->shouldInterruptLoadForXFrameOptions(content, r.url())) {
+ cancel();
+ return;
+ }
+ }
+
// There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred.
// See <rdar://problem/6304600> for more details.
#if !PLATFORM(CF)