Bug 181331 - VoiceOver does not work when the WebContent process is using NSRunLoop.
Summary: VoiceOver does not work when the WebContent process is using NSRunLoop.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-01-05 10:40 PST by Per Arne Vollan
Modified: 2018-01-11 15:20 PST (History)
6 users (show)

See Also:


Attachments
Patch (3.35 KB, patch)
2018-01-05 10:47 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (3.44 KB, patch)
2018-01-05 12:13 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (5.04 KB, patch)
2018-01-08 11:54 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (6.09 KB, patch)
2018-01-10 08:42 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (7.33 KB, patch)
2018-01-10 10:09 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews116 for mac-sierra (3.00 MB, application/zip)
2018-01-10 11:42 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews107 for mac-sierra-wk2 (2.78 MB, application/zip)
2018-01-10 13:42 PST, EWS Watchlist
no flags Details
Patch (5.91 KB, patch)
2018-01-11 12:53 PST, Per Arne Vollan
bfulgham: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2018-01-05 10:40:53 PST
When NSRunLoop is used in the WebContent process, accessibility must be initialized for VoiceOver to work.
Comment 1 Per Arne Vollan 2018-01-05 10:47:04 PST
Created attachment 330558 [details]
Patch
Comment 2 Brent Fulgham 2018-01-05 11:27:59 PST
Comment on attachment 330558 [details]
Patch

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

This looks good, but I'm sad we have to instantiate an NSApp instance. We should see if the accessibility team can live without that change (but that's not relevant to this patch).

> Source/WebKit/Configurations/WebContentService.xcconfig:56
> +RUNLOOP_TYPE[sdk=macosx10.11*] = _NSApplicationMain;

Oh, nice!

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:302
> +    NSApp = [NSApplication alloc];

We need to see if allocating an NSApplication causes us to attach to stuff we don't want. So the accessibility code needs an NSApp instantiated to work? Or is this just something that they could potentially fix on their side?
Comment 3 Per Arne Vollan 2018-01-05 11:38:33 PST
(In reply to Brent Fulgham from comment #2)
> Comment on attachment 330558 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330558&action=review
> 
> This looks good, but I'm sad we have to instantiate an NSApp instance. We
> should see if the accessibility team can live without that change (but
> that's not relevant to this patch).
> 
> > Source/WebKit/Configurations/WebContentService.xcconfig:56
> > +RUNLOOP_TYPE[sdk=macosx10.11*] = _NSApplicationMain;
> 
> Oh, nice!
> 
> > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:302
> > +    NSApp = [NSApplication alloc];
> 
> We need to see if allocating an NSApplication causes us to attach to stuff
> we don't want. So the accessibility code needs an NSApp instantiated to
> work? Or is this just something that they could potentially fix on their
> side?

Currently, allocating an NSApplication object is needed for VoiceOver to work, but I believe this could be fixed on their side.

Thanks for reviewing!
Comment 4 Brent Fulgham 2018-01-05 11:39:43 PST
Comment on attachment 330558 [details]
Patch

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

>>> Source/WebKit/Configurations/WebContentService.xcconfig:56
>>> +RUNLOOP_TYPE[sdk=macosx10.11*] = _NSApplicationMain;
>> 
>> Oh, nice!
> 
> Currently, allocating an NSApplication object is needed for VoiceOver to work, but I believe this could be fixed on their side.
> 
> Thanks for reviewing!

Can you file a Radar about that and add it as a comment to the place where we make the NSApp allocation?
Comment 5 Per Arne Vollan 2018-01-05 11:42:30 PST
(In reply to Brent Fulgham from comment #4)
> Comment on attachment 330558 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330558&action=review
> 
> >>> Source/WebKit/Configurations/WebContentService.xcconfig:56
> >>> +RUNLOOP_TYPE[sdk=macosx10.11*] = _NSApplicationMain;
> >> 
> >> Oh, nice!
> > 
> > Currently, allocating an NSApplication object is needed for VoiceOver to work, but I believe this could be fixed on their side.
> > 
> > Thanks for reviewing!
> 
> Can you file a Radar about that and add it as a comment to the place where
> we make the NSApp allocation?

Yes, will do :)
Comment 6 Per Arne Vollan 2018-01-05 12:13:48 PST
Created attachment 330567 [details]
Patch
Comment 7 Per Arne Vollan 2018-01-08 11:54:46 PST
Created attachment 330717 [details]
Patch
Comment 8 Anders Carlsson 2018-01-08 16:50:19 PST
Comment on attachment 330717 [details]
Patch

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

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:304
> +    NSApp = [NSApplication alloc];
> +    [NSApplication _accessibilityInitialize];

Calling +alloc without -init is bad.
Comment 9 Per Arne Vollan 2018-01-09 10:46:04 PST
(In reply to Anders Carlsson from comment #8)
> Comment on attachment 330717 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330717&action=review
> 
> > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:304
> > +    NSApp = [NSApplication alloc];
> > +    [NSApplication _accessibilityInitialize];
> 
> Calling +alloc without -init is bad.

That makes sense. However, we are trying to avoid all initialization of NSApplication, since it should not be needed in the WebContent process. This allocation will be unnecessary when NSApp is no longer needed for VoiceOver to work.

Thanks for reviewing!
Comment 10 Per Arne Vollan 2018-01-10 08:42:19 PST
Created attachment 330914 [details]
Patch
Comment 11 Brent Fulgham 2018-01-10 09:04:31 PST
Comment on attachment 330914 [details]
Patch

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

> Source/WebCore/ChangeLog:4
> +        https://bugs.webkit.org/show_bug.cgi?id=181331

Please put the <rdar> here.

> Source/WebCore/platform/mac/ThemeMac.mm:71
> +    // Creating a NSWindow will crash if the NSApplication event loop is not running.

Creating AN (not Creating A)

> Source/WebKit/ChangeLog:4
> +        https://bugs.webkit.org/show_bug.cgi?id=181331

<radar>

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:92
> ++ (void)_accessibilityInitialize;

We should do this in a header file (Source/WebCore/pal/spi/cocoa/NSApplicationSPI.h), then include that header file here.

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:304
> +    NSApp = [NSApplication alloc];

While Anders is correct, I prefer that we not initialize NSApp, since we are trying to get rid of it, and it does bad things (sandbox-wise) when it starts up.
Comment 12 Brent Fulgham 2018-01-10 09:04:59 PST
This patch looks good, but r- until the SPI is moved to our "spi" folder.
Comment 13 Per Arne Vollan 2018-01-10 09:22:01 PST
(In reply to Brent Fulgham from comment #12)
> This patch looks good, but r- until the SPI is moved to our "spi" folder.

Thanks for reviewing! I will update the patch.
Comment 14 Radar WebKit Bug Importer 2018-01-10 09:36:49 PST
<rdar://problem/36408004>
Comment 15 Per Arne Vollan 2018-01-10 10:09:51 PST
Created attachment 330926 [details]
Patch
Comment 16 Brent Fulgham 2018-01-10 11:09:40 PST
Comment on attachment 330926 [details]
Patch

Excellent! r=me.
Comment 17 EWS Watchlist 2018-01-10 11:42:16 PST
Comment on attachment 330926 [details]
Patch

Attachment 330926 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/6023079

New failing tests:
http/tests/misc/slow-loading-animated-image.html
Comment 18 EWS Watchlist 2018-01-10 11:42:17 PST
Created attachment 330937 [details]
Archive of layout-test-results from ews116 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 19 EWS Watchlist 2018-01-10 13:42:06 PST
Comment on attachment 330926 [details]
Patch

Attachment 330926 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/6024538

New failing tests:
http/tests/workers/service/postmessage-after-sw-process-crash.https.html
Comment 20 EWS Watchlist 2018-01-10 13:42:08 PST
Created attachment 330956 [details]
Archive of layout-test-results from ews107 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 21 Per Arne Vollan 2018-01-11 12:53:41 PST
Created attachment 331100 [details]
Patch
Comment 22 Brent Fulgham 2018-01-11 13:09:48 PST
Comment on attachment 331100 [details]
Patch

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

Assuming the statement about [NSApplication sharedApplication] I made is true, r=me.

> Source/WebCore/PAL/ChangeLog:5
> +        rdar://problem/36408004

<rdar://problem/3640004>

(I.e., angle brackets around the radar URL please!)

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:177
> +    [NSApplication sharedApplication];

So I believe that this call causes an alloc and init of NSApplication to occur. Is that correct?
Comment 23 Per Arne Vollan 2018-01-11 13:17:23 PST
(In reply to Brent Fulgham from comment #22)
> Comment on attachment 331100 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=331100&action=review
> 
> Assuming the statement about [NSApplication sharedApplication] I made is
> true, r=me.
> 
> > Source/WebCore/PAL/ChangeLog:5
> > +        rdar://problem/36408004
> 
> <rdar://problem/3640004>
> 
> (I.e., angle brackets around the radar URL please!)
> 
> > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:177
> > +    [NSApplication sharedApplication];
> 
> So I believe that this call causes an alloc and init of NSApplication to
> occur. Is that correct?

Yes, that is correct.

Thanks for reviewing!
Comment 24 Alexey Proskuryakov 2018-01-11 13:26:17 PST
rdar://problem/36408004

(because comment 22 had a typo, targeting the wrong radar number)
Comment 25 Per Arne Vollan 2018-01-11 14:22:09 PST
Committed r226807: <https://trac.webkit.org/changeset/226807/webkit>.