Bug 248049

Summary: Ventura Beta 16.1 - SafariForWebkitDevelopment crashes when opening settings
Product: WebKit Reporter: @TimGMichaud <tmm08a>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED MOVED    
Severity: Normal CC: achristensen, ap, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=253063
Attachments:
Description Flags
Safari Crash when opening Safari Settings none

Description @TimGMichaud 2022-11-17 11:02:22 PST
Created attachment 463590 [details]
Safari Crash when opening Safari Settings

System details:
    * MBP w/ an intel i7 chip 
    * OS version: Ventura 13.1 beta (22c5033e)
    * Kernel version: 22.2.0
    * System firmware version: 1916.40.8.0.0

Webkit details:
    * Git head is at 8e78751b47200105b5533f13fdf31339351c1b21 (Github webkit)

After building SafariForWebkitDevelopment by doing:

./Tools/Scripts/set-webkit-configuration --release --asan
./Tools/Scripts/build-webkit -DENABLE_SANITIZERS=address

I then run Safari with:
./Tools/Scripts/run-safari --release

I get the attached crash log (crash.log.ips) when opening the settings menu, the terminal output is copy/pasted below:


tim@tims-MacBook-Pro WebKit % ./Tools/Scripts/run-safari --release                     
Starting SafariForWebKitDevelopment with DYLD_FRAMEWORK_PATH set to point to built WebKit in /Users/tim/Desktop/WebKit/WebKitBuild/Release.
SafariForWebKitDevelopment(41985,0x7ff853f3cf80) malloc: nano zone abandoned due to inability to preallocate reserved vm space.
2022-11-17 12:57:44.418 SafariForWebKitDevelopment[41985:401687] -[NSURL init] called; this results in an NSURL instance with an empty URL string. Please use one of the documented NSURL initialization methods instead (initWithString:, initFileURLWithPath:, etc.). This message shown only once.
2022-11-17 12:57:44.944 com.apple.WebKit.WebContent.Development[41989:401750] XType: Using static font registry.
2022-11-17 12:58:20.070 SafariForWebKitDevelopment[41985:401687] *** Assertion failure in -[NSMenuItem initWithTitle:action:keyEquivalent:], NSMenuItem.m:467
2022-11-17 12:58:20.072 SafariForWebKitDevelopment[41985:401687] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff810a3543b __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff810583e25 objc_exception_throw + 48
	2   Foundation                          0x00007ff8118dafb0 -[NSCalendarDate initWithCoder:] + 0
	3   AppKit                              0x00007ff813af636c -[NSMenuItem initWithTitle:action:keyEquivalent:] + 363
	4   Safari                              0x00007ff91d7fdc21 +[NSMenuItem(BrowserExtras) safari_menuItemForFileAtPath:] + 140
	5   Safari                              0x00007ff91d6a47d0 -[GeneralPreferences _updateDownloadLocationMenu] + 158
	6   libclang_rt.asan_osx_dynamic.dylib  0x00000001047e310b __wrap_dispatch_async_block_invoke + 203
	7   libdispatch.dylib                   0x00007ff8107617fb _dispatch_call_block_and_release + 12
	8   libdispatch.dylib                   0x00007ff810762a44 _dispatch_client_callout + 8
	9   libdispatch.dylib                   0x00007ff81076f7b9 _dispatch_main_queue_drain + 952
	10  libdispatch.dylib                   0x00007ff81076f3f3 _dispatch_main_queue_callback_4CF + 31
	11  CoreFoundation                      0x00007ff8109fb640 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	12  CoreFoundation                      0x00007ff8109bbbc0 __CFRunLoopRun + 2454
	13  CoreFoundation                      0x00007ff8109babb0 CFRunLoopRunSpecific + 560
	14  HIToolbox                           0x00007ff81a3b0bd6 RunCurrentEventLoopInMode + 292
	15  HIToolbox                           0x00007ff81a3b09e6 ReceiveNextEventCommon + 679
	16  HIToolbox                           0x00007ff81a3b0723 _BlockUntilNextEventMatchingListInModeWithFilter + 70
	17  AppKit                              0x00007ff813b02a13 _DPSNextEvent + 909
	18  AppKit                              0x00007ff813b01894 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1219
	19  Safari                              0x00007ff91d41c073 -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 224
	20  AppKit                              0x00007ff813af3ed3 -[NSApplication run] + 586
	21  AppKit                              0x00007ff813ac7f07 NSApplicationMain + 817
	22  Safari                              0x00007ff91d7c4797 SafariMain + 464
	23  dyld                                0x00007ff8105b0310 start + 2432
)
libc++abi: terminating with uncaught exception of type NSException
Comment 1 Radar WebKit Bug Importer 2022-11-17 19:21:58 PST
<rdar://problem/102497417>
Comment 2 Alex Christensen 2022-11-18 10:03:27 PST
I can reproduce the issue, and it's not immediately clear what's causing it.  As a possible workaround until this is fixed, I think opening the settings without your built WebKit, changing the settings, closing Safari, then opening Safari with your built WebKit should see the changed settings.
Comment 3 @TimGMichaud 2022-11-19 11:40:31 PST
I see, I'll give that a shot later today; I noticed there's a similar bug here: https://developer.apple.com/forums/thread/719704, though that's me assuming the root cause is something in NSCalendarDate initWithCoder!
Comment 4 Alex Christensen 2022-12-01 11:11:00 PST
That forum link is quite unrelated.

I have good news and bad news: we found a fix, but it has nothing to do with open source WebKit so there's no PR I can show you to fix it.
Comment 5 @TimGMichaud 2022-12-01 11:26:21 PST
No worries, long as it's eventually fixed! Should I rebuild and expect it to work now?
Comment 6 Alex Christensen 2022-12-01 12:44:37 PST
No, it still won't work if you do that.
Comment 7 @TimGMichaud 2022-12-01 12:47:53 PST
ACK - thanks :)
Comment 8 Alex Christensen 2023-02-28 10:23:45 PST
*** Bug 253063 has been marked as a duplicate of this bug. ***
Comment 9 Alexey Proskuryakov 2023-02-28 10:46:57 PST
This should work with macOS 13.3 beta now. Please let us know how it goes!
Comment 10 @TimGMichaud 2023-03-02 14:27:32 PST
This is working; thanks so much :D!