OLD | NEW |
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/browser/frame_host/navigation_entry_impl.h" | 5 #include "content/browser/frame_host/navigation_entry_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 #include <utility> | 10 #include <utility> |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 FrameTreeNode* frame_tree_node) const { | 868 FrameTreeNode* frame_tree_node) const { |
869 std::map<std::string, bool> names; | 869 std::map<std::string, bool> names; |
870 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); | 870 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); |
871 if (tree_node) { | 871 if (tree_node) { |
872 // Return the names of all immediate children. | 872 // Return the names of all immediate children. |
873 for (TreeNode* child : tree_node->children) { | 873 for (TreeNode* child : tree_node->children) { |
874 // Keep track of whether we would be loading about:blank, since the | 874 // Keep track of whether we would be loading about:blank, since the |
875 // renderer should be allowed to just commit the initial blank frame if | 875 // renderer should be allowed to just commit the initial blank frame if |
876 // that was the default URL. PageState doesn't matter there, because | 876 // that was the default URL. PageState doesn't matter there, because |
877 // content injected into about:blank frames doesn't use it. | 877 // content injected into about:blank frames doesn't use it. |
878 // | 878 names[child->frame_entry->frame_unique_name()] = |
879 // Be careful not to include iframe srcdoc URLs in this check, which do | 879 child->frame_entry->url() == url::kAboutBlankURL; |
880 // need their PageState. The committed URL in that case gets rewritten to | |
881 // about:blank, but we can detect it via the PageState's URL. | |
882 // | |
883 // See https://crbug.com/657896 for details. | |
884 bool is_about_blank = false; | |
885 ExplodedPageState exploded_page_state; | |
886 if (DecodePageState(child->frame_entry->page_state().ToEncodedData(), | |
887 &exploded_page_state)) { | |
888 ExplodedFrameState frame_state = exploded_page_state.top; | |
889 if (UTF16ToUTF8(frame_state.url_string.string()) == url::kAboutBlankURL) | |
890 is_about_blank = true; | |
891 } | |
892 | |
893 names[child->frame_entry->frame_unique_name()] = is_about_blank; | |
894 } | 880 } |
895 } | 881 } |
896 return names; | 882 return names; |
897 } | 883 } |
898 | 884 |
899 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( | 885 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( |
900 FrameTreeNode* frame_tree_node) { | 886 FrameTreeNode* frame_tree_node) { |
901 DCHECK(!frame_tree_node->IsMainFrame()); | 887 DCHECK(!frame_tree_node->IsMainFrame()); |
902 | 888 |
903 NavigationEntryImpl::TreeNode* node = nullptr; | 889 NavigationEntryImpl::TreeNode* node = nullptr; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 return node; | 942 return node; |
957 | 943 |
958 // Enqueue any children and keep looking. | 944 // Enqueue any children and keep looking. |
959 for (auto* child : node->children) | 945 for (auto* child : node->children) |
960 work_queue.push(child); | 946 work_queue.push(child); |
961 } | 947 } |
962 return nullptr; | 948 return nullptr; |
963 } | 949 } |
964 | 950 |
965 } // namespace content | 951 } // namespace content |
OLD | NEW |