diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 930a7276eac6..7e6fc258c08c 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -527,7 +527,7 @@ class GetUserMediaWindowListener { auto req = MakeRefPtr( globalWindow, VoidString(), VoidString(), UserActivation::IsHandlingUserInput()); - obs->NotifyObservers(req, "recording-device-stopped", nullptr); + obs->NotifyWhenScriptSafe(req, "recording-device-stopped", nullptr); } return; } @@ -589,7 +589,7 @@ class GetUserMediaWindowListener { auto req = MakeRefPtr( window, removedRawId, removedSourceType, UserActivation::IsHandlingUserInput()); - obs->NotifyObservers(req, "recording-device-stopped", nullptr); + obs->NotifyWhenScriptSafe(req, "recording-device-stopped", nullptr); } } @@ -616,7 +616,7 @@ class GetUserMediaWindowListener { auto req = MakeRefPtr( window, removedRawId, removedSourceType, UserActivation::IsHandlingUserInput()); - obs->NotifyObservers(req, "recording-device-stopped", nullptr); + obs->NotifyWhenScriptSafe(req, "recording-device-stopped", nullptr); } } if (mInactiveListeners.Length() == 0 && mActiveListeners.Length() == 0) { @@ -3407,7 +3407,7 @@ void MediaManager::RemoveWindowID(uint64_t aWindowId) { nsString data = NS_ConvertUTF8toUTF16(windowBuffer); nsCOMPtr obs = services::GetObserverService(); - obs->NotifyObservers(nullptr, "recording-window-ended", data.get()); + obs->NotifyWhenScriptSafe(nullptr, "recording-window-ended", data.get()); LOG("Sent recording-window-ended for window %" PRIu64 " (outer %" PRIu64 ")", aWindowId, outerID); }