WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
216974
Make sure our calls to AVCaptureDevice requestAccessForMediaType do processing on the main thread
https://bugs.webkit.org/show_bug.cgi?id=216974
Summary
Make sure our calls to AVCaptureDevice requestAccessForMediaType do processin...
youenn fablet
Reported
2020-09-25 06:54:15 PDT
Make sure our calls to AVCaptureDevice requestAccessForMediaType do processing on the main thread
Attachments
Patch
(4.75 KB, patch)
2020-09-25 07:31 PDT
,
youenn fablet
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(6.37 KB, patch)
2020-09-25 07:43 PDT
,
youenn fablet
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(11.27 KB, patch)
2020-09-25 07:49 PDT
,
youenn fablet
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(7.07 KB, patch)
2020-09-25 08:03 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(8.01 KB, patch)
2020-09-28 02:28 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2020-09-25 07:31:10 PDT
Created
attachment 409691
[details]
Patch
youenn fablet
Comment 2
2020-09-25 07:43:06 PDT
Created
attachment 409692
[details]
Patch
youenn fablet
Comment 3
2020-09-25 07:49:50 PDT
Created
attachment 409693
[details]
Patch
youenn fablet
Comment 4
2020-09-25 08:03:58 PDT
Created
attachment 409694
[details]
Patch
Radar WebKit Bug Importer
Comment 5
2020-09-25 08:17:34 PDT
<
rdar://problem/69572304
>
Darin Adler
Comment 6
2020-09-26 16:07:27 PDT
Comment on
attachment 409694
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=409694&action=review
> Source/WebKit/ChangeLog:8 > + The completion handler to [AVCaptureDeviceClass requestAccessForMediaType:] may sometimes be called in a background thread on iOS.
Can we make a test for this that will fail on iOS?
> Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:995 > + auto completionHandler = [this, weakThis = WTFMove(weakThis), frame = WTFMove(frame), protectedRequest = WTFMove(protectedRequest), webView = WTFMove(webView), topLevelOrigin = WTFMove(topLevelOrigin)](BOOL authorized) {
I think it’s a bad pattern when we pass a pointer twice, once that we use and other for lifetime checking. In case like this, can we *not* capture this, please? Minimizes the chance we use it wrong. I feel the same way about capturing both "this" and "protectedThis".
youenn fablet
Comment 7
2020-09-28 02:20:41 PDT
(In reply to Darin Adler from
comment #6
)
> Comment on
attachment 409694
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=409694&action=review
> > > Source/WebKit/ChangeLog:8 > > + The completion handler to [AVCaptureDeviceClass requestAccessForMediaType:] may sometimes be called in a background thread on iOS. > > Can we make a test for this that will fail on iOS?
We are only calling this code path in case the authorisation is undetermined, which will most probably trigger a prompt. We usually avoid doing so as we cannot handle prompts easily. That said, it seems we could investigate using some additional tools. I filed
rdar://problem/69687122
.
> > > Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:995 > > + auto completionHandler = [this, weakThis = WTFMove(weakThis), frame = WTFMove(frame), protectedRequest = WTFMove(protectedRequest), webView = WTFMove(webView), topLevelOrigin = WTFMove(topLevelOrigin)](BOOL authorized) { > > I think it’s a bad pattern when we pass a pointer twice, once that we use > and other for lifetime checking. In case like this, can we *not* capture > this, please? Minimizes the chance we use it wrong. I feel the same way > about capturing both "this" and "protectedThis".
Will change it. I agree for weakThis, since 'this' is unsafer than using weakThis. Not sure about protectedThis though. This is no different from using 'this' in a method where this is a protectedThis before.
youenn fablet
Comment 8
2020-09-28 02:27:26 PDT
> > > Source/WebKit/ChangeLog:8 > > > + The completion handler to [AVCaptureDeviceClass requestAccessForMediaType:] may sometimes be called in a background thread on iOS. > > > > Can we make a test for this that will fail on iOS? > > We are only calling this code path in case the authorisation is > undetermined, which will most probably trigger a prompt. > We usually avoid doing so as we cannot handle prompts easily. > That said, it seems we could investigate using some additional tools. > I filed
rdar://problem/69687122
.
Or we could add some testing API to force explicit request.
youenn fablet
Comment 9
2020-09-28 02:28:30 PDT
Created
attachment 409875
[details]
Patch for landing
EWS
Comment 10
2020-09-28 07:34:51 PDT
Committed
r267698
: <
https://trac.webkit.org/changeset/267698
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 409875
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug