[webkit-reviews] review granted: [Bug 220436] Make SpeechRecognition permission error more informative : [Attachment 417211] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 8 00:29:06 PST 2021


youenn fablet <youennf at gmail.com> has granted Sihui Liu <sihui_liu at apple.com>'s
request for review:
Bug 220436: Make SpeechRecognition permission error more informative
https://bugs.webkit.org/show_bug.cgi?id=220436

Attachment 417211: Patch

https://bugs.webkit.org/attachment.cgi?id=417211&action=review




--- Comment #2 from youenn fablet <youennf at gmail.com> ---
Comment on attachment 417211
  --> https://bugs.webkit.org/attachment.cgi?id=417211
Patch

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

> Source/WebKit/ChangeLog:9
> +	   boolean value.

For debug purposes, it might be good to add release logging for each error case
so that we get the information in sysdiagnose.

> Source/WebKit/UIProcess/SpeechRecognitionPermissionManager.cpp:78
> +void SpeechRecognitionPermissionManager::request(const String& lang, const
WebCore::ClientOrigin& origin,
CompletionHandler<void(Optional<WebCore::SpeechRecognitionError>)>&&
completiontHandler)

Optional<WebCore::SpeechRecognitionError>&& here and elsewhere

> Source/WebKit/UIProcess/SpeechRecognitionPermissionManager.cpp:110
>	   m_speechRecognitionServiceCheck = CheckResult::Granted;

We do not need to compute m_microphoneCheck and m_speechRecognitionServiceCheck
if mockCaptureDevicesEnabled is true.
We could write it as:
if (mockCaptureDevicesEnabled) {
    m_microphoneCheck = CheckResult::Granted;
    ...
} else {
    m_microphoneCheck = computeMicrophoneAccess();
    if (m_microphoneCheck == CheckResult::Denied) { 
	...
	return;
    }
    ...
}

> Source/WebKit/UIProcess/SpeechRecognitionPermissionManager.cpp:124
>      if (!mockCaptureDevicesEnabled && m_speechRecognitionServiceCheck !=
CheckResult::Denied) {

We no longer need m_speechRecognitionServiceCheck != CheckResult::Denied

> Source/WebKit/UIProcess/SpeechRecognitionServer.cpp:77
>	       sendUpdate(identifier,
WebCore::SpeechRecognitionUpdateType::Error, error);

WTFMove(error)

> Source/WebKit/UIProcess/SpeechRecognitionServer.h:48
> +using SpeechRecognitionPermissionChecker = Function<void(const String&,
const WebCore::ClientOrigin&,
CompletionHandler<void(Optional<WebCore::SpeechRecognitionError>)>&&)>;

Optional<WebCore::SpeechRecognitionError>&&


More information about the webkit-reviews mailing list