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 names[child->frame_entry->frame_unique_name()] = | 878 // |
879 child->frame_entry->url() == url::kAboutBlankURL; | 879 // Be careful not to include iframe srcdoc URLs in this check, which do |
| 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; |
880 } | 894 } |
881 } | 895 } |
882 return names; | 896 return names; |
883 } | 897 } |
884 | 898 |
885 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( | 899 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( |
886 FrameTreeNode* frame_tree_node) { | 900 FrameTreeNode* frame_tree_node) { |
887 DCHECK(!frame_tree_node->IsMainFrame()); | 901 DCHECK(!frame_tree_node->IsMainFrame()); |
888 | 902 |
889 NavigationEntryImpl::TreeNode* node = nullptr; | 903 NavigationEntryImpl::TreeNode* node = nullptr; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 return node; | 956 return node; |
943 | 957 |
944 // Enqueue any children and keep looking. | 958 // Enqueue any children and keep looking. |
945 for (auto* child : node->children) | 959 for (auto* child : node->children) |
946 work_queue.push(child); | 960 work_queue.push(child); |
947 } | 961 } |
948 return nullptr; | 962 return nullptr; |
949 } | 963 } |
950 | 964 |
951 } // namespace content | 965 } // namespace content |
OLD | NEW |