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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2488743003: (Re-)introduce AncestorThrottle to handle 'X-Frame-Options'. (Closed)
Patch Set: Display a blank page instead of an error page. ( and add checks in NavigationRequest) Created 4 years, 1 month 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
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 824f1b636f0d3a2c3d07cf96e77a6f8afc320513..ec92930e3023afe5cf8a6a0817526f6417ca33b4 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -2340,6 +2340,18 @@ void RenderFrameImpl::LoadNavigationErrorPage(
const blink::WebHistoryItem& history_item =
entry ? entry->root() : blink::WebHistoryItem();
+ // Requests blocked by the X-Frame-Options or by the CSP directive
+ // frame-ancestor don't display error pages but blank pages instead.
alexmos 2016/11/30 01:22:19 I think this CL only moves XFO to the browser proc
arthursonzogni 2016/11/30 13:49:55 Done.
+ // See crbug.com/622385 if you want to remove this.
alexmos 2016/11/30 01:22:19 Let's rephrase this as a TODO to remove this once
arthursonzogni 2016/11/30 13:49:55 Done.
+ if (error.reason == net::ERR_BLOCKED_BY_RESPONSE) {
+ frame_->loadData("", WebString::fromUTF8("text/html"),
+ WebString::fromUTF8("UTF-8"),
+ GURL("data:text/html,"), WebURL(), replace,
alexmos 2016/11/30 01:22:19 Existing code uses SecurityOrigin::urlWithUniqueSe
arthursonzogni 2016/11/30 13:49:55 Done.
+ frame_load_type, history_item,
+ blink::WebHistoryDifferentDocumentLoad, false);
+ return;
+ }
arthursonzogni 2016/11/23 17:38:51 Some justifications about this: * I use "" to load
alexmos 2016/11/30 01:22:19 Ack. This seems fairly similar to what is current
+
frame_->loadData(error_html, WebString::fromUTF8("text/html"),
WebString::fromUTF8("UTF-8"), GURL(kUnreachableWebDataURL),
error.unreachableURL, replace, frame_load_type, history_item,

Powered by Google App Engine
This is Rietveld 408576698