Bug 224606 - MacCatalyst tests crash on NSInternalInconsistencyException, reason: NSApplication has not been created yet
Summary: MacCatalyst tests crash on NSInternalInconsistencyException, reason: NSApplic...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
: 224605 (view as bug list)
Depends on: 224605
Blocks:
  Show dependency treegraph
 
Reported: 2021-04-15 05:44 PDT by Kimmo Kinnunen
Modified: 2021-04-23 02:42 PDT (History)
6 users (show)

See Also:


Attachments
Patch (10.91 KB, patch)
2021-04-20 15:30 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (10.88 KB, patch)
2021-04-20 15:39 PDT, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2021-04-15 05:44:42 PDT
MacCatalyst tests crash on NSInternalInconsistencyException, reason: NSApplication has not been created yet

It's unclear :
- if the crashes are due to the inconsistent build (see bug 224605) 
- if it's somehow not constructing the UIApplication which would then probably construct the NSApplication
- if it's just missing the runBlockWhenSharedDelegateBecomesAvailable


  2021-04-15 05:41:14.144 TestWebKitAPI[95606:4911569] *** Assertion failure in -[UINSApplicationDelegate init], UINSApplicationDelegate.m:286
        2021-04-15 05:41:14.167 TestWebKitAPI[95606:4911569] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSApplication has not been created yet. Consider using -[UINSApplicationDelegate runBlockWhenSharedDelegateBecomesAvailable:] to avoid premature instantiation.'
        *** First throw call stack:
        (
        	0   CoreFoundation                      0x00007fff20807d2b __exceptionPreprocess + 242
        	1   libobjc.A.dylib                     0x00007fff2053fd92 objc_exception_throw + 48
        	2   CoreFoundation                      0x00007fff20830e92 +[NSException raise:format:arguments:] + 88
        	3   Foundation                          0x00007fff215e8a82 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
        	4   UIKitMacHelper                      0x00007fff34222637 -[UINSApplicationDelegate init] + 1128
        	5   UIKitMacHelper                      0x00007fff34222178 __41+[UINSApplicationDelegate sharedDelegate]_block_invoke + 40
        	6   libdispatch.dylib                   0x00007fff204ea7e6 _dispatch_client_callout + 8
        	7   libdispatch.dylib                   0x00007fff204eb96c _dispatch_once_callout + 20
        	8   UIKitMacHelper                      0x00007fff34222051 +[UINSApplicationDelegate sharedDelegate] + 285
        	9   UIKitCore                           0x00007fff446917d0 -[UIWindow(iOSMac) _hostWindow] + 88
        	10  UIKitCore                           0x00007fff4568a163 -[UIScrollView _updateScrollViewTrackingAdapter] + 303
        	11  UIKitCore                           0x00007fff447a2ff7 -[UIScrollView _didMoveFromWindow:toWindow:] + 484
        	12  UIKitCore                           0x00007fff44704bc4 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 759
        	13  UIKitCore                           0x00007fff446b9e51 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 130
        	14  UIKitCore                           0x00007fff446b9cca -[UIView(Hierarchy) _postMovedFromSuperview:] + 800
        	15  UIKitCore                           0x00007fff446b8a7d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1957
        	16  TestWebKitAPI                       0x00000001027670eb -[TestWKWebView _setUpTestWindow:] + 283
        	17  TestWebKitAPI                       0x0000000102766cf8 -[TestWKWebView initWithFrame:configuration:addToWindow:] + 296
        	18  TestWebKitAPI                       0x0000000102766bca -[TestWKWebView initWithFrame:configuration:] + 122
        	19  TestWebKitAPI                       0x000000010279d0bf _ZN13TestWebKitAPI43VideoQualityDisplayCompositing_Enabled_Test8TestBodyEv + 335
        	20  TestWebKitAPI                       0x00000001029170e4 _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc + 132
        	21  TestWebKitAPI                       0x00000001028e3f5b _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc + 123
        	22  TestWebKitAPI                       0x00000001028e3e93 _ZN7testing4Test3RunEv + 195
        	23  TestWebKitAPI                       0x00000001028e4f44 _ZN7testing8TestInfo3RunEv + 244
        	24  TestWebKitAPI                       0x00000001028e6085 _ZN7testing9TestSuite3RunEv + 261
        	25  TestWebKitAPI                       0x00000001028f505a _ZN7testing8internal12UnitTestImpl11RunAllTestsEv + 986
        	26  TestWebKitAPI                       0x000000010291c684 _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc + 132
        	27  TestWebKitAPI                       0x00000001028f4a1b _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc + 123
        	28  TestWebKitAPI                       0x00000001028f48ed _ZN7testing8UnitTest3RunEv + 205
        	29  TestWebKitAPI                       0x0000000102759f91 _Z13RUN_ALL_TESTSv + 17
        	30  TestWebKitAPI                       0x0000000102759f22 _ZN13TestWebKitAPI15TestsController3runEiPPc + 162
        	31  TestWebKitAPI                       0x00000001028b14b1 main + 481
        	32  libdyld.dylib                       0x00007fff206aff3d start + 1
        	33  ???                                 0x0000000000000002 0x0 + 2
Comment 1 Kimmo Kinnunen 2021-04-18 22:56:48 PDT
Based on some discussion, this is likely due to:
- TestWebKitAPI never was enabled for MacCatalyst (e.g. it's not implemented)
- TestWebKitAPI is not a (UIKit?) "ui application"
Comment 2 Tim Horton 2021-04-20 15:30:28 PDT
Created attachment 426598 [details]
Patch
Comment 3 Wenson Hsieh 2021-04-20 15:31:26 PDT
Comment on attachment 426598 [details]
Patch

r=mews
Comment 4 Tim Horton 2021-04-20 15:39:20 PDT
Created attachment 426603 [details]
Patch
Comment 5 Tim Horton 2021-04-20 15:39:49 PDT
*** Bug 224605 has been marked as a duplicate of this bug. ***
Comment 6 Tim Horton 2021-04-20 15:47:22 PDT
The *correct* fix for this is to make a proper UIApplication, but that is a bigger project. This gets us back to limping along like we used to, as the ChangeLog says. Enough so it is possible to write and run tests on macCatalyst.
Comment 7 EWS 2021-04-20 16:44:38 PDT
Committed r276328 (236808@main): <https://commits.webkit.org/236808@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426603 [details].
Comment 8 Ling Ho 2021-04-23 02:42:54 PDT
76925635