RESOLVED FIXED 244941
AX: AXIsolatedTree and some objects within are not cleaned up upon page reload or navigation
https://bugs.webkit.org/show_bug.cgi?id=244941
Summary AX: AXIsolatedTree and some objects within are not cleaned up upon page reloa...
Tyler Wilcock
Reported 2022-09-08 11:44:13 PDT
AXIsolatedTree and some objects within are not cleaned up upon page reload or navigation
Attachments
Patch (18.11 KB, patch)
2022-09-08 12:04 PDT, Tyler Wilcock
no flags
Patch (18.11 KB, patch)
2022-09-08 12:12 PDT, Tyler Wilcock
no flags
Patch (18.10 KB, patch)
2022-09-08 12:14 PDT, Tyler Wilcock
no flags
Patch (19.82 KB, patch)
2022-09-08 17:49 PDT, Tyler Wilcock
no flags
Patch (27.29 KB, patch)
2022-09-09 11:47 PDT, Tyler Wilcock
no flags
Patch (28.08 KB, patch)
2022-09-09 14:32 PDT, Tyler Wilcock
ews-feeder: commit-queue-
Patch (28.80 KB, patch)
2022-09-09 16:13 PDT, Tyler Wilcock
no flags
Patch (28.79 KB, patch)
2022-09-09 20:14 PDT, Tyler Wilcock
no flags
Patch (28.84 KB, patch)
2022-09-12 10:44 PDT, Tyler Wilcock
no flags
Radar WebKit Bug Importer
Comment 1 2022-09-08 11:44:24 PDT
Tyler Wilcock
Comment 2 2022-09-08 11:50:57 PDT
Tyler Wilcock
Comment 3 2022-09-08 12:04:48 PDT
chris fleizach
Comment 4 2022-09-08 12:10:30 PDT
Comment on attachment 462207 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=462207&action=review > COMMIT_MESSAGE:7 > +Prior to this patch, we never seem to prperly clean up any `AXIsolatedTree`s properly > COMMIT_MESSAGE:18 > +the trees representation in treeIDCache() and treePageCache(). tree's > Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:33 > + AccessibilityUIElement getRetainedElement(); getRetainedElement() -> retainedElement() ?
Tyler Wilcock
Comment 5 2022-09-08 12:12:51 PDT
Tyler Wilcock
Comment 6 2022-09-08 12:14:08 PDT
Tyler Wilcock
Comment 7 2022-09-08 12:14:21 PDT
(In reply to chris fleizach from comment #4) > Comment on attachment 462207 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=462207&action=review > > > COMMIT_MESSAGE:7 > > +Prior to this patch, we never seem to prperly clean up any `AXIsolatedTree`s > > properly > > > COMMIT_MESSAGE:18 > > +the trees representation in treeIDCache() and treePageCache(). > > tree's > > > Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:33 > > + AccessibilityUIElement getRetainedElement(); > > getRetainedElement() -> retainedElement() ? Fixed all of these.
Tyler Wilcock
Comment 8 2022-09-08 17:49:43 PDT
Andres Gonzalez
Comment 9 2022-09-09 07:06:03 PDT
(In reply to Tyler Wilcock from comment #8) > Created attachment 462216 [details] > Patch --- a/LayoutTests/accessibility/wrapper-destroyed-on-reload.html +++ a/LayoutTests/accessibility/wrapper-destroyed-on-reload.html I would call this test wrapper-retained-through-reload.html which is what the test really does. + var testOutput = "This test ensures that when a page is reloaded, we properly clean up the wrappers and AX objects from the previous iteration of the page.\n\n"; + // This is expected behavior because the wrappers and AX objects from the previous iteration of the page (pre-reload) refer + // to DOM, render objects, etc. that no longer exist post-reload. I don't think this test ensures we clean up the wrappers. It ensures that if the wrapper is retained by a client, the AccessibilityController in the TestRunner, after the reload the wrapper is invalid, meaning it wraps no backing object. The AccessibilityController is holding to an AccessibilityUIElement that in turn is retaining the wrapper m_element. So the test should be testing that m_element is invalid/defunct, meaning that it doesn't have a backing object. + // Note that this actually reloads the test, too, which means the testOutput above will be written once, + // then thrown away with the reload, then written again, upon which we should enter the `else` below. + internals.forceReload(true); Doesn't the axButton variable get re-initialized too? Maybe not because it is const? + // The wrapper and AX object that back this AccessibilityUIElement should've been destroyed by the reload, + // so no role should be returned here. I don't think the wrapper (m_element) could have been destroyed, it shouldn't have been destroyed. The AX backing object should. Maybe we need to add a method to the wrapper to determine whether it has a backing object or not. So not sure if by checking the role we can tell for sure whether the wrapper is detached or null. + testOutput += `Role of #button element retained before forced reload: ${accessibilityController.retainedElement().role}\n`; Can we clarify this message to indicate that is after the forced reload? A bit confusing to me whether the "before" refers to the retained or to the reload.
Tyler Wilcock
Comment 10 2022-09-09 11:47:01 PDT
Tyler Wilcock
Comment 11 2022-09-09 11:51:41 PDT
(In reply to Andres Gonzalez from comment #9) > (In reply to Tyler Wilcock from comment #8) > > Created attachment 462216 [details] > > Patch > Doesn't the axButton variable get re-initialized too? Maybe not because it > is const? It is re-initialized, but the AccessibilityController holds a reference to the original AccessibilityUIElement (which is what axButton is). Then when the page reloads, `const axButton = ...` is run again and a new and different AccessibilityUIElement is created.
Tyler Wilcock
Comment 12 2022-09-09 14:32:34 PDT
Tyler Wilcock
Comment 13 2022-09-09 16:13:25 PDT
Tyler Wilcock
Comment 14 2022-09-09 20:14:36 PDT
Tyler Wilcock
Comment 15 2022-09-12 10:44:29 PDT
EWS
Comment 16 2022-09-12 19:05:02 PDT
Committed 254419@main (c808394fb05e): <https://commits.webkit.org/254419@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 462292 [details].
Note You need to log in before you can comment on or make changes to this bug.