Commit 06f4b4a3 authored by Kevin Babbitt's avatar Kevin Babbitt Committed by Commit Bot

Ignore failure from CreateStdAccessibleObject()

On non-desktop Windows SKUs such as Hololens,
CreateStdAccessibleObject() will fail since MSAA is not available. That
failure would cause us to exit LegacyRenderWidgetHostHWND::Init() before
creating a UI Automation fragment root. Later on, an inbound UI
Automation call would ask a web content fragment for its fragment root,
we would attempt to look it up and find nothing, and crash.

The fix is to ignore the failure from CreateStdAccessibleObject(). There
are no subsequent calls in Init() that depended on it succeeding. I also
took the opportunity to switch the return value to type void since the
only caller wasn't doing anything with this information anyway.

Bug: 928811
Change-Id: I11f63139575de131f41733be6f73192c118ec792
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037963
Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com>
Reviewed-by: default avatarCliff Smolinsky <cliffsmo@microsoft.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739032}
parent 64d522c2
......@@ -135,17 +135,16 @@ LegacyRenderWidgetHostHWND::~LegacyRenderWidgetHostHWND() {
DCHECK(!::IsWindow(hwnd()));
}
bool LegacyRenderWidgetHostHWND::Init() {
void LegacyRenderWidgetHostHWND::Init() {
// Only register a touch window if we are using WM_TOUCH.
if (!features::IsUsingWMPointerForTouch())
RegisterTouchWindow(hwnd(), TWF_WANTPALM);
HRESULT hr;
hr = ::CreateStdAccessibleObject(hwnd(), OBJID_WINDOW,
IID_PPV_ARGS(&window_accessible_));
if (FAILED(hr))
return false;
// Ignore failure from this call. Some SKUs of Windows such as Hololens do not
// support MSAA, and this call failing should not stop us from initializing
// UI Automation support.
::CreateStdAccessibleObject(hwnd(), OBJID_WINDOW,
IID_PPV_ARGS(&window_accessible_));
if (::switches::IsExperimentalAccessibilityPlatformUIAEnabled()) {
// The usual way for UI Automation to obtain a fragment root is through
......@@ -169,8 +168,6 @@ bool LegacyRenderWidgetHostHWND::Init() {
// Disable pen flicks (http://crbug.com/506977)
base::win::DisableFlicks(hwnd());
return true;
}
// static
......
......@@ -141,7 +141,7 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
explicit LegacyRenderWidgetHostHWND(HWND parent);
~LegacyRenderWidgetHostHWND() override;
bool Init();
void Init();
// Returns the target to which the windows input events are forwarded.
static ui::WindowEventTarget* GetWindowEventTarget(HWND parent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment