HP Secure Browser support (#16377): Amend browseMode dead document detection to cope with VT_EMPTY runtimeID. (#16393)
Summary of the issue:
When enough websites are open in separate tabs, SB will suspend some
of the virtual machines hosting the websites to disk. This can cause
UIA documents representing these websites to become dead.
In this scenario querying UIA_RuntimeIdPropertyId of the dead document
returns VT_EMPTY variant, causing uncaught exception raised from
UIABrowseModeDocument.__contains__. This keeps repeating, preventing
NVDA from working correctly, if at all.
Description of user facing changes:
NVDA works correctly regardless of vm suspensions or other scenarios
where UIA documents can become dead.
Description of development approach:
UIABrowseModeDocument.__contains__ already has code to detect dead documents,
however it relies on COMError being reported from UIA_RuntimeIdPropertyId
property query.
In my testing, even when the server side reports an error HRESULT from
IRawElementProviderFragment::GetRuntimeID() uia method, UIA core appears
to translate it into a successful property query, yet with a VT_EMPTY variant
as the property value. It's possible this behaviour is different between
various UIA core versions, my testing is primarily on Windows 11 build 22631.
We amend the detection such that both COMError and VT_EMPTY variant
are detected and treated equally, causing the dead document codepath to execute.
Co-authored-by: Tomasz Wroblewski <tomasz.wroblewski@hp.com>