Bug 237051 - Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in isolated tree mode.
Summary: Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andres Gonzalez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-22 13:08 PST by Andres Gonzalez
Modified: 2022-03-01 13:45 PST (History)
11 users (show)

See Also:


Attachments
Patch (10.93 KB, patch)
2022-02-22 13:15 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (11.02 KB, patch)
2022-02-22 16:19 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (11.02 KB, patch)
2022-02-28 17:51 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Gonzalez 2022-02-22 13:08:37 PST
Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in isolated tree mode.
Comment 1 Radar WebKit Bug Importer 2022-02-22 13:08:51 PST
<rdar://problem/89312156>
Comment 2 Andres Gonzalez 2022-02-22 13:15:32 PST
Created attachment 452898 [details]
Patch
Comment 3 Tyler Wilcock 2022-02-22 15:49:18 PST
Comment on attachment 452898 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=452898&action=review

> Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:117
> +    NSString *attributeName = [NSString stringWithJSStringRef:idAttribute];

> Convert the JSString to NSString on the main thread and capture the NSString to be used on the AX secondary thread.
Why is it better to do it this way?

> LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html:98
> +        setTimeout(async () => {

Does this entire block need to be wrapped in async in order for the test to pass? It seems like this portion is testing static content, right?

Though maybe there's enough static content such that this part of the test does need to be async. What do you think?
Comment 4 Andres Gonzalez 2022-02-22 16:19:36 PST
Created attachment 452912 [details]
Patch
Comment 5 Andres Gonzalez 2022-02-22 16:33:39 PST
(In reply to Tyler Wilcock from comment #3)
> Comment on attachment 452898 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=452898&action=review
> 
> > Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:117
> > +    NSString *attributeName = [NSString stringWithJSStringRef:idAttribute];
> 
> > Convert the JSString to NSString on the main thread and capture the NSString to be used on the AX secondary thread.
> Why is it better to do it this way?

I believe JSStringRefs are conceived to be used on the main thread, so I think it may be safer to convert it to NSString on the main thread and then use the NSString off the main thread. Somebody with deeper knowledge of JSStringRef may say that they are just as good off the main thread as NSStrings, in which case this is a mute point, but I feel more comfortable doing it this way without knowing more intimately the threading behavior of JSStringRefs. Hopefully Darin Adler or somebody else may shed more light here.

> 
> > LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html:98
> > +        setTimeout(async () => {
> 
> Does this entire block need to be wrapped in async in order for the test to
> pass? It seems like this portion is testing static content, right?
> 
> Though maybe there's enough static content such that this part of the test
> does need to be async. What do you think?

It is necessary to have the whole thing async because that's the only way we keep the order in the outputs. In other words, to keep the same sequence of outputs between the main body and the unload function, they both need to be sync or async, but as soon as any part of them doesn't match the rest, then the outputs get intermingled. I think setTimeout dispatches to some other queue or thread, and if you don't queue everything that produces an output into the expected.txt in that same queue, the order of the output is undefined.
Comment 6 Andres Gonzalez 2022-02-22 16:40:31 PST
(In reply to Andres Gonzalez from comment #5)
> (In reply to Tyler Wilcock from comment #3)
> > Comment on attachment 452898 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=452898&action=review
> > 
> > > Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:117
> > > +    NSString *attributeName = [NSString stringWithJSStringRef:idAttribute];
> > 
> > > Convert the JSString to NSString on the main thread and capture the NSString to be used on the AX secondary thread.
> > Why is it better to do it this way?
> 
> I believe JSStringRefs are conceived to be used on the main thread, so I
> think it may be safer to convert it to NSString on the main thread and then
> use the NSString off the main thread. Somebody with deeper knowledge of
> JSStringRef may say that they are just as good off the main thread as
> NSStrings, in which case this is a mute point, but I feel more comfortable
> doing it this way without knowing more intimately the threading behavior of
> JSStringRefs. Hopefully Darin Adler or somebody else may shed more light
> here.
> 
> > 
> > > LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html:98
> > > +        setTimeout(async () => {
> > 
> > Does this entire block need to be wrapped in async in order for the test to
> > pass? It seems like this portion is testing static content, right?
> > 
> > Though maybe there's enough static content such that this part of the test
> > does need to be async. What do you think?
> 
> It is necessary to have the whole thing async because that's the only way we
> keep the order in the outputs. In other words, to keep the same sequence of
> outputs between the main body and the unload function, they both need to be
> sync or async, but as soon as any part of them doesn't match the rest, then
> the outputs get intermingled. I think setTimeout dispatches to some other
> queue or thread, and if you don't queue everything that produces an output
> into the expected.txt in that same queue, the order of the output is
> undefined.

Meant "onload function", not "unload function", spell checker playing tricks.
Comment 7 Tyler Wilcock 2022-02-22 16:50:04 PST
(In reply to Andres Gonzalez from comment #5)
> (In reply to Tyler Wilcock from comment #3)
> > Comment on attachment 452898 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=452898&action=review
> > 
> > > Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:117
> > > +    NSString *attributeName = [NSString stringWithJSStringRef:idAttribute];
> > 
> > > Convert the JSString to NSString on the main thread and capture the NSString to be used on the AX secondary thread.
> > Why is it better to do it this way?
> 
> I believe JSStringRefs are conceived to be used on the main thread, so I
> think it may be safer to convert it to NSString on the main thread and then
> use the NSString off the main thread. Somebody with deeper knowledge of
> JSStringRef may say that they are just as good off the main thread as
> NSStrings, in which case this is a mute point, but I feel more comfortable
> doing it this way without knowing more intimately the threading behavior of
> JSStringRefs. Hopefully Darin Adler or somebody else may shed more light
> here.
> 
> > 
> > > LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html:98
> > > +        setTimeout(async () => {
> > 
> > Does this entire block need to be wrapped in async in order for the test to
> > pass? It seems like this portion is testing static content, right?
> > 
> > Though maybe there's enough static content such that this part of the test
> > does need to be async. What do you think?
> 
> It is necessary to have the whole thing async because that's the only way we
> keep the order in the outputs. In other words, to keep the same sequence of
> outputs between the main body and the unload function, they both need to be
> sync or async, but as soon as any part of them doesn't match the rest, then
> the outputs get intermingled. I think setTimeout dispatches to some other
> queue or thread, and if you don't queue everything that produces an output
> into the expected.txt in that same queue, the order of the output is
> undefined.
Thanks for the explanation!
Comment 8 Andres Gonzalez 2022-02-28 17:51:48 PST
Created attachment 453454 [details]
Patch
Comment 9 EWS 2022-03-01 13:45:42 PST
Committed r290673 (247944@main): <https://commits.webkit.org/247944@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 453454 [details].