From f46dde37b533fde340ad0fed6f8efcb9adca74fd Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Fri, 9 Feb 2024 19:28:39 -0800 Subject: [PATCH] Workaround to prevent infinite accessibilityParent access for the same view. --- .../render_widget_host_view_cocoa.mm | 11 +++++++++++ ...mote_cocoa-render_widget_host_view_cocoa.mm.patch | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 chromium_src/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm create mode 100644 patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch diff --git a/chromium_src/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/chromium_src/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm new file mode 100644 index 00000000000..df716019388 --- /dev/null +++ b/chromium_src/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -0,0 +1,11 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// Temporary fix for https://github.com/brave/brave-browser/issues/35938 +#define BRAVE_ACCESSIBILITY_PARENT \ + if (self == _accessibilityParent) \ + return [super accessibilityParent]; +#include "src/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm" +#undef BRAVE_ACCESSIBILITY_PARENT diff --git a/patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch b/patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch new file mode 100644 index 00000000000..e2ff40d6f1c --- /dev/null +++ b/patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch @@ -0,0 +1,12 @@ +diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +index 81f705328efd2de0957c1ef309e20c421e0959eb..589d342594bbff3a7e3ad83626b02f94adfad3f5 100644 +--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm ++++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +@@ -1935,6 +1935,7 @@ void ExtractUnderlines(NSAttributedString* string, + } + + - (id)accessibilityParent { ++ BRAVE_ACCESSIBILITY_PARENT + if (_accessibilityParent) + return NSAccessibilityUnignoredAncestor(_accessibilityParent); + return [super accessibilityParent];