-
Notifications
You must be signed in to change notification settings - Fork 1.6k
AX: Add a failsafe to the while loop in AXCoreObject::partialOrder #47392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AX: Add a failsafe to the while loop in AXCoreObject::partialOrder #47392
Conversation
EWS run on previous version of this PR (hash fb364f3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
while (current || otherCurrent) { | ||
while (failsafeCounter < maxIterations && (current || otherCurrent)) { | ||
++failsafeCounter; | ||
|
||
if (RefPtr maybeParent = current ? current->parentObject() : nullptr) { | ||
if (maybeParent == &other) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it'd be worth a debug assert that maybeParent isn't the same as current? While of course that should never happen, that feels like one of the most likely ways we could end up in an endless loop here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Done in latest commit.
fb364f3
to
a66ff09
Compare
EWS run on previous version of this PR (hash a66ff09) |
// For now, add a failsafe and ASSERT() so we can try to debug the root cause when it does | ||
// happen again. | ||
unsigned failsafeCounter = 0; | ||
static constexpr unsigned maxIterations = Settings::defaultMaximumRenderTreeDepth * 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need 2* the maximum depth? A comment explaining that might be helpful here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure, without a doubt, that this failsafe only triggers when something is wrong. Just Settings::defaultMaximumRenderTreeDepth
would be wrong — the accessibility tree can be deeper than that when considering things like scrollviews, which in the ancestry chain but not associated with any renderer.
Comment added in latest commit
a66ff09
to
bd4754d
Compare
EWS run on current version of this PR (hash bd4754d) |
Failed api-gtk checks. Please resolve failures and re-apply Rejecting #47392 from merge queue. |
Safe-Merge-Queue: Build #61904. |
https://bugs.webkit.org/show_bug.cgi?id=295222 rdar://154696128 Reviewed by Joshua Hoffman. When testing a different bug, I was able to enter an infinite loop in this function. I tried to rebuild with logging to debug, but wasn't able to hit it again despite much effort. To avoid a permanent hang for our users, add a failsafe counter, and an ASSERT which should hopefully help us debug the root cause when it triggers. * Source/WebCore/accessibility/AXCoreObject.cpp: (WebCore::AXCoreObject::partialOrder): Canonical link: https://commits.webkit.org/296846@main
bd4754d
to
c187483
Compare
Committed 296846@main (c187483): https://commits.webkit.org/296846@main Reviewed commits have been landed. Closing PR #47392 and removing active labels. |
c187483
bd4754d