Bug 1661587 - Assert if there is no native widget only when not in headless mode. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D88493
This commit is contained in:
Eitan Isaacson 2020-08-27 22:22:12 +00:00
Родитель 1bebc65e70
Коммит 42fa537b50
2 изменённых файлов: 6 добавлений и 11 удалений

Просмотреть файл

@ -9,6 +9,7 @@
#include "mozRootAccessible.h"
#include "gfxPlatform.h"
#include "nsCOMPtr.h"
#include "nsObjCExceptions.h"
#include "nsIFrame.h"
@ -40,8 +41,8 @@ void RootAccessibleWrap::GetNativeWidget(void** aOutView) {
nsIWidget* widget = view->GetWidget();
if (widget) {
*aOutView = (void**)widget->GetNativeData(NS_NATIVE_WIDGET);
NS_ASSERTION(
*aOutView,
MOZ_ASSERT(
*aOutView || gfxPlatform::IsHeadless(),
"Couldn't get the native NSView parent we need to connect the "
"accessibility hierarchy!");
}

Просмотреть файл

@ -53,15 +53,9 @@ static id<mozAccessible, mozView> getNativeViewFromRootAccessible(
- (id)moxUnignoredParent {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if (!mParallelView)
mParallelView = (id<mozView, mozAccessible>)[self representedView];
if (mParallelView)
return [mParallelView
accessibilityAttributeValue:NSAccessibilityParentAttribute];
MOZ_ASSERT(mParallelView, "we're a root accessible w/o native view?");
return [super moxUnignoredParent];
// If there is no represented view (eg. headless), this will return nil.
return [[self representedView]
accessibilityAttributeValue:NSAccessibilityParentAttribute];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}