Bug 195955 - REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
Summary: REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: Conrad Shultz
URL:
Keywords: InRadar
Depends on:
Blocks: 195284
  Show dependency treegraph
 
Reported: 2019-03-19 11:20 PDT by Conrad Shultz
Modified: 2019-03-19 13:35 PDT (History)
7 users (show)

See Also:


Attachments
Patch (4.34 KB, patch)
2019-03-19 11:31 PDT, Conrad Shultz
wenson_hsieh: review+
Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-highsierra-wk2 (3.39 MB, application/zip)
2019-03-19 12:37 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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)