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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2151323003: Add a check for mismatching URL and origin in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable the test on Mac, until more debugging can be done. Created 4 years, 5 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 | « content/browser/frame_host/render_frame_host_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 1ababbbe32c6b05884bfe936730cea01f86bd89b..bc00811ffd075cf8360233fb71f3119e2b03f59c 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4772,6 +4772,20 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(
render_view_->SetZoomLevel(render_view_->page_zoom_level());
}
+ // Standard URLs must match the reported origin, when it is not unique.
+ // This check is very similar to RenderFrameHostImpl::CanCommitOrigin, but
+ // adapted to the renderer process side.
+ if (!params.origin.unique() && params.url.IsStandard() &&
+ render_view_->GetWebkitPreferences().web_security_enabled) {
+ // Exclude file: URLs when settings allow them access any origin.
+ if (params.origin.scheme() != url::kFileScheme ||
+ !render_view_->GetWebkitPreferences()
+ .allow_universal_access_from_file_urls) {
+ CHECK(params.origin.IsSameOriginWith(url::Origin(params.url)))
+ << " url:" << params.url << " origin:" << params.origin;
+ }
+ }
+
// This message needs to be sent before any of allowScripts(),
// allowImages(), allowPlugins() is called for the new page, so that when
// these functions send a ViewHostMsg_ContentBlocked message, it arrives
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698