DescriptionWeb Speech API: Fix a race condition causing renderer crash.
The introduction of the MediaRequestPermission (i.e. infobar) has
opened a race window which causes a recognition session to be aborted
twice, causing a consequent crash on the renderer.
The race window is the following:
1) Session 1 is started (SpeechRecognitionManagerImpl::StartSession)
2) Security checks for session 1 are started asynchronously
(delegate_->CheckRecognitionIsAllowed).
3) Session 2 is started. This causes an immediate abort of session 1.
4) The oustanding security check for session 1 completes and returns
a nack. The nack causes an abort of session 1 (in
RecognitionAllowedCallback). However, session 1 was already aborted
in 3).
5) The double abort is not tolerated by the renderer, which crashes.
This CL closes the race window with a not-so-elegant fix.
A refactoring of the speech_recognition_manager_impl.cc is STRONGLY
adviced (Hint: use and extend the already existing FSM to keep track
of the asynchronous completion of security checks. Don't introduce
extra state with extra variables).
BUG=296690, 116954
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=226523
Patch Set 1 #
Total comments: 6
Patch Set 2 : Nits + moved check #Patch Set 3 : DCHECK #Patch Set 4 : Fixed return condition #
Messages
Total messages: 8 (0 generated)
|