Bug 234699

Summary: [macOS WebView] Hovering over image causes crash
Product: WebKit Reporter: Jon Kelley <jkelleyrtp>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: RESOLVED MOVED    
Severity: Blocker CC: bfulgham, harshaga97, sabouhallawa, souricevincent, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Mac (Apple Silicon)   
OS: macOS 12   
Attachments:
Description Flags
crash logs none

Description Jon Kelley 2021-12-26 18:42:38 PST
Created attachment 447995 [details]
crash logs

When hovering over images (among other things - it seems that anything that interacts with alt-text is affected), the WebView thread crashes completely.

This bug has been reported on two Rust WebView binding repos:
- https://github.com/Boscop/web-view/issues/308
- https://github.com/tauri-apps/tauri/issues/2934


This is a pretty major blocker - I really can't ship any Webview app on macOS 12 / M1 .

The main crash thread looks like this:
```

2021-12-26 21:15:27.547 hello_file[50054:630185] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[15]'
*** First throw call stack:
(
        0   CoreFoundation                      0x000000018e0c81cc __exceptionPreprocess + 240
        1   libobjc.A.dylib                     0x000000018de197b8 objc_exception_throw + 60
        2   CoreFoundation                      0x000000018e198488 -[__NSCFString characterAtIndex:].cold.1 + 0
        3   CoreFoundation                      0x000000018e1a50c4 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
        4   CoreFoundation                      0x000000018dfcfed0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320
        5   CoreFoundation                      0x000000018dfcfd64 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 60
        6   VisionKitCore                       0x0000000204ca7e08 -[VKAnalyticsAnalyzerEvent coreAnalyticsDictionary] + 1208
        7   VisionKitCore                       0x0000000204c6ab00 -[VKAnalyticsProcessor processAndSendEvent:] + 92
        8   VisionKitCore                       0x0000000204c607d8 __69-[VKImageAnalyzer _processRequest:progressHandler:completionHandler:]_block_invoke_2 + 1200
        9   libdispatch.dylib                   0x000000018ddbce60 _dispatch_call_block_and_release + 32
        10  libdispatch.dylib                   0x000000018ddbebac _dispatch_client_callout + 20
        11  libdispatch.dylib                   0x000000018ddc6330 _dispatch_lane_serial_drain + 672
        12  libdispatch.dylib                   0x000000018ddc6ea4 _dispatch_lane_invoke + 392
        13  libdispatch.dylib                   0x000000018ddd1708 _dispatch_workloop_worker_thread + 656
        14  libsystem_pthread.dylib             0x000000018df79304 _pthread_wqthread + 288
        15  libsystem_pthread.dylib             0x000000018df78018 start_wqthread + 8
)
libc++abi: terminating with uncaught exception of type NSException
[1]    50054 abort      cargo run --example hello_file
```

However, digging in a bit deeper, I can expose more information through the console.

```rust
2021-12-08 13:55:26.898938-0500 hello_file[56305:1092535] [General] An uncaught exception was raised
2021-12-08 13:55:26.898958-0500 hello_file[56305:1092535] [General] *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[15]
2021-12-08 13:55:26.898978-0500 hello_file[56305:1092535] [General] (
        0   CoreFoundation                      0x00000001b81ac12c __exceptionPreprocess + 240
        1   libobjc.A.dylib                     0x00000001b7efd808 objc_exception_throw + 60
        2   CoreFoundation                      0x00000001b827c464 -[__NSCFString characterAtIndex:].cold.1 + 0
        3   CoreFoundation                      0x00000001b82890a0 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
        4   CoreFoundation                      0x00000001b80b3e30 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320
new webview inner
Wry has started!
2021-12-08 13:57:24.929118-0500 hello_file[56488:1095248] [General] An uncaught exception was raised
2021-12-08 13:57:24.929142-0500 hello_file[56488:1095248] [General] *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[15]
2021-12-08 13:57:24.929169-0500 hello_file[56488:1095248] [General] (
        0   CoreFoundation                      0x00000001b81ac12c __exceptionPreprocess + 240
        1   libobjc.A.dylib                     0x00000001b7efd808 objc_exception_throw + 60
        2   CoreFoundation                      0x00000001b827c464 -[__NSCFString characterAtIndex:].cold.1 + 0
        3   CoreFoundation                      0x00000001b82890a0 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
        4   CoreFoundation                      0x00000001b80b3e30 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320
        5   CoreFoundation                      0x00000001b80b3cc4 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 60
        6   VisionKitCore                       0x000000022e55cd4c -[VKAnalyticsAnalyzerEvent coreAnalyticsDictionary] + 1208
        7   VisionKitCore                       0x000000022e51fb1c -[VKAnalyticsProcessor processAndSendEvent:] + 92
        8   VisionKitCore                       0x000000022e5157f4 __69-[VKImageAnalyzer _processRequest:progressHandler:completionHandler:]_block_invoke_2 + 1200
        9   libdispatch.dylib                   0x00000001b7ea0e60 _dispatch_call_block_and_release + 32
        10  libdispatch.dylib                   0x00000001b7ea2bac _dispatch_client_callout + 20
        11  libdispatch.dylib                   0x00000001b7eaa330 _dispatch_lane_serial_drain + 672
        12  libdispatch.dylib                   0x00000001b7eaaea4 _dispatch_lane_invoke + 392
        13  libdispatch.dylib                   0x00000001b7eb5708 _dispatch_workloop_worker_thread + 656
        14  libsystem_pthread.dylib             0x00000001b805d5b0 _pthread_wqthread + 288
        15  libsystem_pthread.dylib             0x00000001b805c2c4 start_wqthread + 8


```
Comment 1 Radar WebKit Bug Importer 2021-12-29 14:45:27 PST
<rdar://problem/86991372>
Comment 2 souricevincent 2022-01-04 12:43:36 PST
hello, i have a same problem here:
https://github.com/webview/webview/issues/627
Comment 3 Brent Fulgham 2022-02-09 12:15:40 PST
The underlying cause of this bug was outside of WebKit, so we cannot show a fix revision.

This is fixed at that level, and you should be able to confirm the fix in an upcoming macOS 12.3 beta.
Comment 4 Brent Fulgham 2022-02-10 08:44:34 PST
Note: Using 'Moved' to indicate it was fixed in a non-WebKit part of macOS/iOS.