Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: Source/WebCore/loader/MainResourceLoader.cpp

Issue 8198008: Merge 96610 - Resource loader should block HTTP redirects to local resources (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/loader/FrameLoader.cpp ('k') | Source/WebCore/page/SecurityOrigin.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/MainResourceLoader.cpp
===================================================================
--- Source/WebCore/loader/MainResourceLoader.cpp (revision 96956)
+++ Source/WebCore/loader/MainResourceLoader.cpp (working copy)
@@ -182,6 +182,15 @@
ASSERT(documentLoader()->timing()->fetchStart);
if (!redirectResponse.isNull()) {
+ // If the redirecting url is not allowed to display content from the target origin,
+ // then block the redirect.
+ RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectResponse.url());
+ if (!redirectingOrigin->canDisplay(newRequest.url())) {
+ FrameLoader::reportLocalLoadFailed(m_frame.get(), newRequest.url().string());
+ cancel();
+ return;
+ }
+
DocumentLoadTiming* documentLoadTiming = documentLoader()->timing();
// Check if the redirected url is allowed to access the redirecting url's timing information.
« no previous file with comments | « Source/WebCore/loader/FrameLoader.cpp ('k') | Source/WebCore/page/SecurityOrigin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698