Bug 195955

Summary: REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
Product: WebKit Reporter: Conrad Shultz <conrad_shultz>
Component: FormsAssignee: Conrad Shultz <conrad_shultz>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, conrad_shultz, ews-watchlist, rniwa, thorton, webkit-bug-importer, wenson_hsieh
Priority: P1 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=195284
Bug Depends on:    
Bug Blocks: 195284    
Attachments:
Description Flags
Patch
wenson_hsieh: review+
Archive of layout-test-results from ews104 for mac-highsierra-wk2 none

Description Conrad Shultz 2019-03-19 11:20:11 PDT
r242369 started passing UTIs to -[UIImagePickerController setMediaTypes:] that correspond to types accepted by the file input element. However, UIImagePickerController expects a specific subset of UTIs. In the worst case, if no expected types are passed, this can cause a crash.
Comment 1 Conrad Shultz 2019-03-19 11:20:37 PDT
<rdar://problem/48788916>
Comment 2 Conrad Shultz 2019-03-19 11:31:23 PDT
Created attachment 365189 [details]
Patch
Comment 3 EWS Watchlist 2019-03-19 12:37:09 PDT
Comment on attachment 365189 [details]
Patch

Attachment 365189 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/11568797

New failing tests:
imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-constructor.html
Comment 4 EWS Watchlist 2019-03-19 12:37:11 PDT
Created attachment 365206 [details]
Archive of layout-test-results from ews104 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 5 Conrad Shultz 2019-03-19 12:50:59 PDT
Crash appears unrelated; apparently we aren’t able to dynamically load a constant:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebCore             	0x00000007080022f3 WTFCrashWithInfo(int, char const*, char const*, int) + 19 (Assertions.h:566)
1   com.apple.WebCore             	0x00000007083e11a0 initAVEncoderBitRateKey() + 128 (MediaRecorderPrivateWriterCocoa.mm:55)

which is:

void* constant = dlsym(framework##Library(), #name); \
RELEASE_ASSERT_WITH_MESSAGE(constant, "%s", dlerror()); \
Comment 6 Wenson Hsieh 2019-03-19 13:03:36 PDT
Comment on attachment 365189 [details]
Patch

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

> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:339
> +                    if (UTTypeConformsTo((CFStringRef)acceptedMediaType, (CFStringRef)availableMediaType)) {

Nit - __bridge
Comment 7 Chris Dumez 2019-03-19 13:03:49 PDT
Comment on attachment 365189 [details]
Patch

r=me
Comment 8 Conrad Shultz 2019-03-19 13:14:46 PDT
(In reply to Wenson Hsieh from comment #6)
> Comment on attachment 365189 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=365189&action=review
> 
> > Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:339
> > +                    if (UTTypeConformsTo((CFStringRef)acceptedMediaType, (CFStringRef)availableMediaType)) {
> 
> Nit - __bridge

Fixed. Thanks!
Comment 9 Conrad Shultz 2019-03-19 13:35:35 PDT
Committed r243168
	M	Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm
	M	Source/WebKit/ChangeLog
r243168 = d69c31b5ad59c2a303902c9e018ec617335702ed (refs/remotes/origin/master)