Index: content/browser/frame_host/navigation_handle_impl.cc |
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc |
index 8dca64448352d1df95c7755808d80e7f7a8b84a0..b86f81e89e52b60d02019c29c55f12e710a23771 100644 |
--- a/content/browser/frame_host/navigation_handle_impl.cc |
+++ b/content/browser/frame_host/navigation_handle_impl.cc |
@@ -13,6 +13,7 @@ |
#include "content/browser/child_process_security_policy_impl.h" |
#include "content/browser/devtools/render_frame_devtools_agent_host.h" |
#include "content/browser/frame_host/ancestor_throttle.h" |
+#include "content/browser/frame_host/data_url_navigation_throttle.h" |
#include "content/browser/frame_host/debug_urls.h" |
#include "content/browser/frame_host/form_submission_throttle.h" |
#include "content/browser/frame_host/frame_tree_node.h" |
@@ -681,14 +682,6 @@ void NavigationHandleImpl::DidCommitNavigation( |
} else { |
state_ = DID_COMMIT; |
} |
- |
- if (url_.SchemeIs(url::kDataScheme) && IsInMainFrame() && |
- IsRendererInitiated()) { |
- GetRenderFrameHost()->AddMessageToConsole( |
- CONSOLE_MESSAGE_LEVEL_WARNING, |
- "Upcoming versions will block content-initiated top frame navigations " |
- "to data: URLs. For more information, see https://goo.gl/BaZAea."); |
- } |
} |
void NavigationHandleImpl::Transfer() { |
@@ -930,6 +923,13 @@ void NavigationHandleImpl::RegisterNavigationThrottles() { |
std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = |
GetDelegate()->CreateThrottlesForNavigation(this); |
+ // Check for renderer-inititated main frame navigations to data URLs. This is |
+ // done first as it may block the main frame navigation altogether. |
+ std::unique_ptr<NavigationThrottle> data_url_navigation_throttle = |
+ DataUrlNavigationThrottle::CreateThrottleForNavigation(this); |
+ if (data_url_navigation_throttle) |
+ throttles_to_register.push_back(std::move(data_url_navigation_throttle)); |
+ |
std::unique_ptr<content::NavigationThrottle> ancestor_throttle = |
content::AncestorThrottle::MaybeCreateThrottleFor(this); |
if (ancestor_throttle) |