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

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

Issue 2741513002: [Merge M-57] Add a warning for the deprecation of content-initiated data URL navigations (Closed)
Patch Set: Created 3 years, 9 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 render_frame_host_ = render_frame_host; 554 render_frame_host_ = render_frame_host;
555 555
556 // If an error page reloads, net_error_code might be 200 but we still want to 556 // If an error page reloads, net_error_code might be 200 but we still want to
557 // count it as an error page. 557 // count it as an error page.
558 if (params.base_url.spec() == kUnreachableWebDataURL || 558 if (params.base_url.spec() == kUnreachableWebDataURL ||
559 net_error_code_ != net::OK) { 559 net_error_code_ != net::OK) {
560 state_ = DID_COMMIT_ERROR_PAGE; 560 state_ = DID_COMMIT_ERROR_PAGE;
561 } else { 561 } else {
562 state_ = DID_COMMIT; 562 state_ = DID_COMMIT;
563 } 563 }
564
565 if (url_.SchemeIs(url::kDataScheme) && IsInMainFrame() &&
566 IsRendererInitiated()) {
567 GetRenderFrameHost()->AddMessageToConsole(
568 CONSOLE_MESSAGE_LEVEL_WARNING,
569 "Upcoming versions will block content-initiated top frame navigations "
570 "to data: URLs. For more information, see https://goo.gl/BaZAea.");
571 }
564 } 572 }
565 573
566 void NavigationHandleImpl::Transfer() { 574 void NavigationHandleImpl::Transfer() {
567 DCHECK(!IsBrowserSideNavigationEnabled()); 575 DCHECK(!IsBrowserSideNavigationEnabled());
568 // This is an actual transfer. Inform the NavigationResourceThrottle. This 576 // This is an actual transfer. Inform the NavigationResourceThrottle. This
569 // will allow to mark the URLRequest as transferring. When it is marked as 577 // will allow to mark the URLRequest as transferring. When it is marked as
570 // transferring, the URLRequest can no longer be cancelled by its original 578 // transferring, the URLRequest can no longer be cancelled by its original
571 // RenderFrame. Instead it will persist until being picked up by the transfer 579 // RenderFrame. Instead it will persist until being picked up by the transfer
572 // RenderFrame, even if the original RenderFrame is destroyed. 580 // RenderFrame, even if the original RenderFrame is destroyed.
573 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_); 581 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 content::AncestorThrottle::MaybeCreateThrottleFor(this); 814 content::AncestorThrottle::MaybeCreateThrottleFor(this);
807 if (ancestor_throttle) 815 if (ancestor_throttle)
808 throttles_.push_back(std::move(ancestor_throttle)); 816 throttles_.push_back(std::move(ancestor_throttle));
809 817
810 throttles_.insert(throttles_.begin(), 818 throttles_.insert(throttles_.begin(),
811 std::make_move_iterator(throttles_to_register.begin()), 819 std::make_move_iterator(throttles_to_register.begin()),
812 std::make_move_iterator(throttles_to_register.end())); 820 std::make_move_iterator(throttles_to_register.end()));
813 } 821 }
814 822
815 } // namespace content 823 } // 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