Index: content/browser/frame_host/render_frame_host_impl.h |
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h |
index 3fcb8e2fb33b8f8dc9ca208b5904f7093fc63417..ea159cbad61aa1a20db7c2ed4eef0541e98df009 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.h |
+++ b/content/browser/frame_host/render_frame_host_impl.h |
@@ -93,6 +93,11 @@ class CONTENT_EXPORT RenderFrameHostImpl |
// number of active frames of a SiteInstance or not. |
static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); |
+ // An accessibility reset is only allowed to prevent very rare corner cases |
+ // or race conditions where the browser and renderer get out of sync. If |
+ // this happens more than this many times, kill the renderer. |
+ static const int kMaxAccessibilityResets = 5; |
+ |
static RenderFrameHostImpl* FromID(int process_id, int routing_id); |
~RenderFrameHostImpl() override; |
@@ -334,6 +339,10 @@ class CONTENT_EXPORT RenderFrameHostImpl |
// NULL. |
BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager(); |
+ void set_no_create_browser_accessibility_manager_for_testing(bool flag) { |
+ no_create_browser_accessibility_manager_for_testing_ = flag; |
+ } |
+ |
#if defined(OS_WIN) |
void SetParentNativeViewAccessible( |
gfx::NativeViewAccessible accessible_parent); |
@@ -426,7 +435,8 @@ class CONTENT_EXPORT RenderFrameHostImpl |
void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, |
const CommonNavigationParams& common_params); |
void OnAccessibilityEvents( |
- const std::vector<AccessibilityHostMsg_EventParams>& params); |
+ const std::vector<AccessibilityHostMsg_EventParams>& params, |
+ int reset_token); |
void OnAccessibilityLocationChanges( |
const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); |
@@ -554,12 +564,25 @@ class CONTENT_EXPORT RenderFrameHostImpl |
scoped_ptr<ServiceRegistryAndroid> service_registry_android_; |
#endif |
+ // The object managing the accessibility tree for this frame. |
scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; |
+ // This is nonzero if we sent an accessibility reset to the renderer and |
+ // we're waiting for an IPC containing this reset token (sequentially |
+ // assigned) and a complete replacement accessibility tree. |
+ int accessibility_reset_token_; |
+ |
+ // A count of the number of times we needed to reset accessibility, so |
+ // we don't keep trying to reset forever. |
+ int accessibility_reset_count_; |
+ |
// Callback when an event is received, for testing. |
base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; |
// The most recently received accessibility tree - for testing only. |
scoped_ptr<ui::AXTree> ax_tree_for_testing_; |
+ // Flag to not create a BrowserAccessibilityManager, for testing. If one |
+ // already exists it will still be used. |
+ bool no_create_browser_accessibility_manager_for_testing_; |
// PlzNavigate: Owns the stream used in navigations to store the body of the |
// response once it has started. |