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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 std::string error_html; 2333 std::string error_html;
2334 GetContentClient()->renderer()->GetNavigationErrorStrings( 2334 GetContentClient()->renderer()->GetNavigationErrorStrings(
2335 this, failed_request, error, &error_html, nullptr); 2335 this, failed_request, error, &error_html, nullptr);
2336 2336
2337 blink::WebFrameLoadType frame_load_type = 2337 blink::WebFrameLoadType frame_load_type =
2338 entry ? blink::WebFrameLoadType::BackForward 2338 entry ? blink::WebFrameLoadType::BackForward
2339 : blink::WebFrameLoadType::Standard; 2339 : blink::WebFrameLoadType::Standard;
2340 const blink::WebHistoryItem& history_item = 2340 const blink::WebHistoryItem& history_item =
2341 entry ? entry->root() : blink::WebHistoryItem(); 2341 entry ? entry->root() : blink::WebHistoryItem();
2342 2342
2343 // Requests blocked by the X-Frame-Options or by the CSP directive
2344 // 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.
2345 // 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.
2346 if (error.reason == net::ERR_BLOCKED_BY_RESPONSE) {
2347 frame_->loadData("", WebString::fromUTF8("text/html"),
2348 WebString::fromUTF8("UTF-8"),
2349 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.
2350 frame_load_type, history_item,
2351 blink::WebHistoryDifferentDocumentLoad, false);
2352 return;
2353 }
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
2354
2343 frame_->loadData(error_html, WebString::fromUTF8("text/html"), 2355 frame_->loadData(error_html, WebString::fromUTF8("text/html"),
2344 WebString::fromUTF8("UTF-8"), GURL(kUnreachableWebDataURL), 2356 WebString::fromUTF8("UTF-8"), GURL(kUnreachableWebDataURL),
2345 error.unreachableURL, replace, frame_load_type, history_item, 2357 error.unreachableURL, replace, frame_load_type, history_item,
2346 blink::WebHistoryDifferentDocumentLoad, false); 2358 blink::WebHistoryDifferentDocumentLoad, false);
2347 } 2359 }
2348 2360
2349 void RenderFrameImpl::DidMeaningfulLayout( 2361 void RenderFrameImpl::DidMeaningfulLayout(
2350 blink::WebMeaningfulLayout layout_type) { 2362 blink::WebMeaningfulLayout layout_type) {
2351 for (auto& observer : observers_) 2363 for (auto& observer : observers_)
2352 observer.DidMeaningfulLayout(layout_type); 2364 observer.DidMeaningfulLayout(layout_type);
(...skipping 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after
6609 // event target. Potentially a Pepper plugin will receive the event. 6621 // event target. Potentially a Pepper plugin will receive the event.
6610 // In order to tell whether a plugin gets the last mouse event and which it 6622 // In order to tell whether a plugin gets the last mouse event and which it
6611 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6623 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6612 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6624 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6613 // |pepper_last_mouse_event_target_|. 6625 // |pepper_last_mouse_event_target_|.
6614 pepper_last_mouse_event_target_ = nullptr; 6626 pepper_last_mouse_event_target_ = nullptr;
6615 #endif 6627 #endif
6616 } 6628 }
6617 6629
6618 } // namespace content 6630 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698