Bug 1473217 - Part 1: webspeech: Fix clang-tidy's misc-unused-raii warning. r?jesup draft
authorChris Peterson <cpeterson@mozilla.com>
Wed, 04 Jul 2018 12:18:27 -0700
changeset 814213 264a521b1efe5f3e308e2db1da3ac4dcb40f6c4b
parent 814180 6c0fa9a675c91390ca27664ffb626c56e8afea4d
child 814214 3295686df39694fb234318c684a335621d164294
push id115133
push usercpeterson@mozilla.com
push dateWed, 04 Jul 2018 19:23:36 +0000
reviewersjesup
bugs1473217, 1088758
milestone63.0a1
Bug 1473217 - Part 1: webspeech: Fix clang-tidy's misc-unused-raii warning. r?jesup AutoNoJSAPI is an RAII class to put the JS engine in an unusable state and set the subject principal to System. Without a name, this AutoNoJSAPI is a temporary object that is destructed before GetUserMedia() is called, thus making the AutoNoJSAPI a no-op. This AutoNoJSAPI was added in tab mirroring bug 1088758, with comments from you in bug 1088758 comment 5. MozReview-Commit-ID: 9bY72LhSufn
dom/media/webspeech/recognition/SpeechRecognition.cpp
--- a/dom/media/webspeech/recognition/SpeechRecognition.cpp
+++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp
@@ -748,17 +748,17 @@ SpeechRecognition::Start(const Optional<
   }
 
   MediaStreamConstraints constraints;
   constraints.mAudio.SetAsBoolean() = true;
 
   if (aStream.WasPassed()) {
     StartRecording(&aStream.Value());
   } else {
-    AutoNoJSAPI();
+    AutoNoJSAPI nojsapi;
     MediaManager* manager = MediaManager::Get();
     manager->GetUserMedia(GetOwner(),
                           constraints,
                           new GetUserMediaSuccessCallback(this),
                           new GetUserMediaErrorCallback(this),
                           aCallerType);
   }