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

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

Issue 2734783010: [Merge to M-58] 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/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/appcache/appcache_navigation_handle.h" 10 #include "content/browser/appcache/appcache_navigation_handle.h"
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 navigation_type_ = navigation_type; 649 navigation_type_ = navigation_type;
650 650
651 // If an error page reloads, net_error_code might be 200 but we still want to 651 // If an error page reloads, net_error_code might be 200 but we still want to
652 // count it as an error page. 652 // count it as an error page.
653 if (params.base_url.spec() == kUnreachableWebDataURL || 653 if (params.base_url.spec() == kUnreachableWebDataURL ||
654 net_error_code_ != net::OK) { 654 net_error_code_ != net::OK) {
655 state_ = DID_COMMIT_ERROR_PAGE; 655 state_ = DID_COMMIT_ERROR_PAGE;
656 } else { 656 } else {
657 state_ = DID_COMMIT; 657 state_ = DID_COMMIT;
658 } 658 }
659
660 if (url_.SchemeIs(url::kDataScheme) && IsInMainFrame() &&
661 IsRendererInitiated()) {
662 GetRenderFrameHost()->AddMessageToConsole(
663 CONSOLE_MESSAGE_LEVEL_WARNING,
664 "Upcoming versions will block content-initiated top frame navigations "
665 "to data: URLs. For more information, see https://goo.gl/BaZAea.");
666 }
659 } 667 }
660 668
661 void NavigationHandleImpl::Transfer() { 669 void NavigationHandleImpl::Transfer() {
662 DCHECK(!IsBrowserSideNavigationEnabled()); 670 DCHECK(!IsBrowserSideNavigationEnabled());
663 // This is an actual transfer. Inform the NavigationResourceThrottle. This 671 // This is an actual transfer. Inform the NavigationResourceThrottle. This
664 // will allow to mark the URLRequest as transferring. When it is marked as 672 // will allow to mark the URLRequest as transferring. When it is marked as
665 // transferring, the URLRequest can no longer be cancelled by its original 673 // transferring, the URLRequest can no longer be cancelled by its original
666 // RenderFrame. Instead it will persist until being picked up by the transfer 674 // RenderFrame. Instead it will persist until being picked up by the transfer
667 // RenderFrame, even if the original RenderFrame is destroyed. 675 // RenderFrame, even if the original RenderFrame is destroyed.
668 // Note: |transfer_callback_| can be null in unit tests. 676 // Note: |transfer_callback_| can be null in unit tests.
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if (node->current_url().EqualsIgnoringRef(url_)) { 942 if (node->current_url().EqualsIgnoringRef(url_)) {
935 if (found_self_reference) 943 if (found_self_reference)
936 return true; 944 return true;
937 found_self_reference = true; 945 found_self_reference = true;
938 } 946 }
939 } 947 }
940 return false; 948 return false;
941 } 949 }
942 950
943 } // namespace content 951 } // 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