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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2694903007: Add a warning for the deprecation of content-initiated data URL navigations (Closed)
Patch Set: creis comments Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/debug/dump_without_crashing.h" 9 #include "base/debug/dump_without_crashing.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 navigation_type_ = navigation_type; 631 navigation_type_ = navigation_type;
632 632
633 // If an error page reloads, net_error_code might be 200 but we still want to 633 // If an error page reloads, net_error_code might be 200 but we still want to
634 // count it as an error page. 634 // count it as an error page.
635 if (params.base_url.spec() == kUnreachableWebDataURL || 635 if (params.base_url.spec() == kUnreachableWebDataURL ||
636 net_error_code_ != net::OK) { 636 net_error_code_ != net::OK) {
637 state_ = DID_COMMIT_ERROR_PAGE; 637 state_ = DID_COMMIT_ERROR_PAGE;
638 } else { 638 } else {
639 state_ = DID_COMMIT; 639 state_ = DID_COMMIT;
640 } 640 }
641
642 if (url_.SchemeIs(url::kDataScheme) && IsInMainFrame() &&
643 IsRendererInitiated()) {
644 GetRenderFrameHost()->AddMessageToConsole(
645 CONSOLE_MESSAGE_LEVEL_WARNING,
646 "Upcoming versions will block content-initiated top frame navigations "
647 "to data: URLs. For more information, see https://goo.gl/BaZAea.");
648 }
641 } 649 }
642 650
643 void NavigationHandleImpl::Transfer() { 651 void NavigationHandleImpl::Transfer() {
644 DCHECK(!IsBrowserSideNavigationEnabled()); 652 DCHECK(!IsBrowserSideNavigationEnabled());
645 // This is an actual transfer. Inform the NavigationResourceThrottle. This 653 // This is an actual transfer. Inform the NavigationResourceThrottle. This
646 // will allow to mark the URLRequest as transferring. When it is marked as 654 // will allow to mark the URLRequest as transferring. When it is marked as
647 // transferring, the URLRequest can no longer be cancelled by its original 655 // transferring, the URLRequest can no longer be cancelled by its original
648 // RenderFrame. Instead it will persist until being picked up by the transfer 656 // RenderFrame. Instead it will persist until being picked up by the transfer
649 // RenderFrame, even if the original RenderFrame is destroyed. 657 // RenderFrame, even if the original RenderFrame is destroyed.
650 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_); 658 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 content::AncestorThrottle::MaybeCreateThrottleFor(this); 891 content::AncestorThrottle::MaybeCreateThrottleFor(this);
884 if (ancestor_throttle) 892 if (ancestor_throttle)
885 throttles_.push_back(std::move(ancestor_throttle)); 893 throttles_.push_back(std::move(ancestor_throttle));
886 894
887 throttles_.insert(throttles_.begin(), 895 throttles_.insert(throttles_.begin(),
888 std::make_move_iterator(throttles_to_register.begin()), 896 std::make_move_iterator(throttles_to_register.begin()),
889 std::make_move_iterator(throttles_to_register.end())); 897 std::make_move_iterator(throttles_to_register.end()));
890 } 898 }
891 899
892 } // namespace content 900 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698