Bug 1473217 - webspeech: Fix clang-tidy's misc-unused-raii warning. r=jesup
authorChris Peterson <cpeterson@mozilla.com>
Wed, 04 Jul 2018 12:18:27 -0700
changeset 494085 67f6872c7302f90eda14adce95360bb21f613539
parent 494084 00056b5eb7140780986df16e69214f4a20e0e42b
child 494086 eb8f3d8844616dbe6789b10a0fa248a7f9da5693
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1473217, 1088758
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1473217 - 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.
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();
     MediaManager::GetUserMediaSuccessCallback onsuccess(
       new GetUserMediaSuccessCallback(this));
     MediaManager::GetUserMediaErrorCallback onerror(
       new GetUserMediaErrorCallback(this));
     manager->GetUserMedia(GetOwner(),
                           constraints,
                           std::move(onsuccess),