Bug 219972

Summary: SpeechRecognitionRemoteRealtimeMediaSourceManager should not issue sandbox extension for mocked devices
Product: WebKit Reporter: Sihui Liu <sihui_liu>
Component: New BugsAssignee: Sihui Liu <sihui_liu>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, hta, jer.noble, philipj, sergio, tommyw, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch for landing none

Description Sihui Liu 2020-12-16 19:52:10 PST
...
Comment 1 Sihui Liu 2020-12-16 19:58:49 PST
Created attachment 416383 [details]
Patch
Comment 2 Sihui Liu 2020-12-16 20:27:42 PST
Created attachment 416387 [details]
Patch
Comment 3 Sihui Liu 2020-12-17 09:12:26 PST
Created attachment 416426 [details]
Patch
Comment 4 Eric Carlson 2020-12-17 15:06:36 PST
Comment on attachment 416426 [details]
Patch

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

> Source/WebCore/platform/mediastream/CaptureDevice.h:70
> +    bool mocked() const { return m_mocked; }
> +    void setMocked(bool mocked) { m_mocked = mocked; }

Nit: I think `mockDevice` or `isMockDevice` would be better than `mocked`

> Source/WebCore/platform/mediastream/CaptureDevice.h:133
> +    bool m_mocked { false };

Is there any reason to not add this to the encoder and decoder methods?

> Source/WebKit/UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h:76
> +    HashSet<WebCore::RealtimeMediaSourceIdentifier> m_sourcesNeedSandboxExtension;

Nit: `m_sourcesNeedingSandboxExtension` might be a better name.

> Source/WebKit/UIProcess/SpeechRecognitionServer.h:85
> +    SpeechRecognitionCheckIfMockSpeechRecognitionEnabled m_checkIfmockSpeechRecognitionEnabled;

s/m_checkIfmock/m_checkIfMock/
Comment 5 Sihui Liu 2020-12-18 09:12:15 PST
(In reply to Eric Carlson from comment #4)
> Comment on attachment 416426 [details]
> Patch

Thanks for the review!

> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=416426&action=review
> 
> > Source/WebCore/platform/mediastream/CaptureDevice.h:70
> > +    bool mocked() const { return m_mocked; }
> > +    void setMocked(bool mocked) { m_mocked = mocked; }
> 
> Nit: I think `mockDevice` or `isMockDevice` would be better than `mocked`

Will update.

> 
> > Source/WebCore/platform/mediastream/CaptureDevice.h:133
> > +    bool m_mocked { false };
> 
> Is there any reason to not add this to the encoder and decoder methods?

Nope, will add

> 
> > Source/WebKit/UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h:76
> > +    HashSet<WebCore::RealtimeMediaSourceIdentifier> m_sourcesNeedSandboxExtension;
> 
> Nit: `m_sourcesNeedingSandboxExtension` might be a better name.

Will update!

> 
> > Source/WebKit/UIProcess/SpeechRecognitionServer.h:85
> > +    SpeechRecognitionCheckIfMockSpeechRecognitionEnabled m_checkIfmockSpeechRecognitionEnabled;
> 
> s/m_checkIfmock/m_checkIfMock/
Comment 6 Sihui Liu 2020-12-18 11:33:51 PST
Created attachment 416534 [details]
Patch for landing
Comment 7 EWS 2020-12-18 12:32:28 PST
Committed r270986: <https://trac.webkit.org/changeset/270986>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 416534 [details].
Comment 8 Radar WebKit Bug Importer 2020-12-18 12:33:20 PST
<rdar://problem/72477329>