Summary: | Make SpeechRecognition permission error more informative | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Sihui Liu <sihui_liu> | ||||||
Component: | New Bugs | Assignee: | Sihui Liu <sihui_liu> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | webkit-bug-importer, youennf | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Sihui Liu
2021-01-07 14:19:08 PST
Created attachment 417211 [details]
Patch
Comment on attachment 417211 [details] 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>&& Created attachment 417409 [details]
Patch for landing
Committed r271381: <https://trac.webkit.org/changeset/271381> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417409 [details]. |