Commit 6d6d4f22 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Chromium LUCI CQ

Add a DCHECK for IA2 hyperlink support

Bug: None
Change-Id: I9f60c15bf5aae5dad9031eae3be71a69e9b9ac27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583010
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835450}
parent 9a0b429c
......@@ -10,6 +10,8 @@
#include <string>
#include <utility>
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
......@@ -502,8 +504,20 @@ IFACEMETHODIMP BrowserAccessibilityComWin::get_hyperlink(
}
int32_t id = hypertext_.hyperlinks[index];
auto* link = static_cast<BrowserAccessibilityComWin*>(
AXPlatformNodeWin::GetFromUniqueId(id));
AXPlatformNode* node = AXPlatformNodeWin::GetFromUniqueId(id);
if (!node) {
// Error: possibly incorrect number of hyper links reported.
LONG num_hyperlinks = -1;
get_nHyperlinks(&num_hyperlinks);
std::ostringstream error;
error << "index=" << index << " nHyperLinks=" << num_hyperlinks;
static auto* hyperlink_err = base::debug::AllocateCrashKeyString(
"ax_hyperlink_err", base::debug::CrashKeySize::Size64);
NOTREACHED() << "Hyperlink error: " << error.str();
base::debug::SetCrashKeyString(hyperlink_err, error.str());
base::debug::DumpWithoutCrashing();
}
auto* link = static_cast<BrowserAccessibilityComWin*>(node);
if (!link)
return E_FAIL;
......
......@@ -181,6 +181,7 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79"))
CONTENT_EXPORT IFACEMETHODIMP get_nHyperlinks(LONG* hyperlink_count) override;
CONTENT_EXPORT IFACEMETHODIMP
// A hyperlink represents an embedded object character (leading to a subtree).
get_hyperlink(LONG index, IAccessibleHyperlink** hyperlink) override;
CONTENT_EXPORT IFACEMETHODIMP
......
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