0

Fix for null deref of ax_context_ in test-only code

Fixed: 1379636
Change-Id: I680699f9d3fe442c0f38e35c89cbd2621d951e70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3999980
Reviewed-by: David Tseng <dtseng@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1066518}
This commit is contained in:
Aaron Leventhal
2022-11-02 16:21:35 +00:00
committed by Chromium LUCI CQ
parent 03edd2db55
commit 85a3569677
2 changed files with 3 additions and 1 deletions

@ -284,6 +284,8 @@ v8::Local<v8::Object> AccessibilityController::RootElement() {
v8::Local<v8::Object> AccessibilityController::AccessibleElementById(
const std::string& id) {
if (!IsInstalled())
return v8::Local<v8::Object>();
ax_context_->UpdateAXForAllDocuments();
blink::WebAXObject root_element = GetAccessibilityObjectForMainFrame();

@ -61,7 +61,7 @@ class AccessibilityController {
v8::Local<v8::Object> RootElement();
v8::Local<v8::Object> AccessibleElementById(const std::string& id);
bool CanCallAOMEventListeners() const;
bool IsInstalled() { return elements_ != nullptr; }
bool IsInstalled() { return elements_ != nullptr && ax_context_ != nullptr; }
v8::Local<v8::Object> FindAccessibleElementByIdRecursive(
const blink::WebAXObject&,