HP Secure Browser support (#16377): Amend browseMode dead document detection to cope with VT_EMPTY runtimeID. #16393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to issue number:
#16377
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.
Testing strategy:
Manual testing
Known issues with pull request:
N/A
Code Review Checklist: