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

Unified Diff: content/browser/frame_host/frame_accessibility.cc

Issue 864963003: Enable SitePerProcessAccessibilityBrowserTest on more platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@more_robust_site_isolation_a11y
Patch Set: Removed debugging, ready for review Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/frame_accessibility.cc
diff --git a/content/browser/frame_host/frame_accessibility.cc b/content/browser/frame_host/frame_accessibility.cc
index c0e86b29dce12ea6782f7d1f2a5369c1c2103150..39b1e0e62aa4f05eba47542c389fcf3c08e30c76 100644
--- a/content/browser/frame_host/frame_accessibility.cc
+++ b/content/browser/frame_host/frame_accessibility.cc
@@ -161,9 +161,15 @@ bool FrameAccessibility::GetParent(
FrameTree::GloballyFindByID(iter->child_frame_tree_node_id);
if (child_node &&
child_node->current_frame_host() == child_frame_host) {
- // We should have gotten a *direct* child of the parent frame.
dmazzoni 2015/01/28 19:29:00 This ended up being too restrictive. There's one
- if (child_node->parent() !=
- iter->parent_frame_host->frame_tree_node()) {
+ // Assert that the child node is a descendant of the parent frame in
+ // the frame tree. It may not be a direct descendant because the
+ // parent frame's accessibility tree may span multiple frames from the
+ // same origin.
+ FrameTreeNode* parent_node = iter->parent_frame_host->frame_tree_node();
+ FrameTreeNode* child_node_ancestor = child_node->parent();
+ while (child_node_ancestor && child_node_ancestor != parent_node)
+ child_node_ancestor = child_node_ancestor->parent();
+ if (child_node_ancestor != parent_node) {
NOTREACHED();
return false;
}
@@ -201,8 +207,15 @@ RenderFrameHostImpl* FrameAccessibility::GetRFHIFromFrameTreeNodeId(
if (!child_node)
return nullptr;
- // We should have gotten a *direct* child of the parent frame.
- if (child_node->parent() != parent_frame_host->frame_tree_node()) {
+ // Assert that the child node is a descendant of the parent frame in
+ // the frame tree. It may not be a direct descendant because the
+ // parent frame's accessibility tree may span multiple frames from the
+ // same origin.
+ FrameTreeNode* parent_node = parent_frame_host->frame_tree_node();
+ FrameTreeNode* child_node_ancestor = child_node->parent();
+ while (child_node_ancestor && child_node_ancestor != parent_node)
+ child_node_ancestor = child_node_ancestor->parent();
+ if (child_node_ancestor != parent_node) {
NOTREACHED();
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698