diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index f6e5f7217c7..d10de70a4fe 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -2611,7 +2611,7 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem, if (!Preferences::GetBool("media.eme.enabled", false)) { // EME disabled by user, send notification to chrome so UI can // inform user. - MediaKeySystemAccess::NotifyObservers(aKeySystem, + MediaKeySystemAccess::NotifyObservers(mWindow, aKeySystem, MediaKeySystemStatus::Api_disabled); p->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR); return p.forget(); @@ -2629,7 +2629,7 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem, // Failed due to user disabling something, send a notification to // chrome, so we can show some UI to explain how the user can rectify // the situation. - MediaKeySystemAccess::NotifyObservers(aKeySystem, status); + MediaKeySystemAccess::NotifyObservers(mWindow, aKeySystem, status); } p->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR); return p.forget(); diff --git a/dom/media/eme/MediaKeySystemAccess.cpp b/dom/media/eme/MediaKeySystemAccess.cpp index 6546fefd5ec..46889f5cb04 100644 --- a/dom/media/eme/MediaKeySystemAccess.cpp +++ b/dom/media/eme/MediaKeySystemAccess.cpp @@ -226,7 +226,8 @@ MediaKeySystemAccess::IsSupported(const nsAString& aKeySystem, /* static */ void -MediaKeySystemAccess::NotifyObservers(const nsAString& aKeySystem, +MediaKeySystemAccess::NotifyObservers(nsIDOMWindow* aWindow, + const nsAString& aKeySystem, MediaKeySystemStatus aStatus) { RequestMediaKeySystemAccessNotification data; @@ -236,7 +237,7 @@ MediaKeySystemAccess::NotifyObservers(const nsAString& aKeySystem, data.ToJSON(json); nsCOMPtr obs = services::GetObserverService(); if (obs) { - obs->NotifyObservers(nullptr, "mediakeys-request", json.get()); + obs->NotifyObservers(aWindow, "mediakeys-request", json.get()); } } diff --git a/dom/media/eme/MediaKeySystemAccess.h b/dom/media/eme/MediaKeySystemAccess.h index 22c74a07411..ba8feff1562 100644 --- a/dom/media/eme/MediaKeySystemAccess.h +++ b/dom/media/eme/MediaKeySystemAccess.h @@ -49,7 +49,8 @@ public: static bool IsSupported(const nsAString& aKeySystem, const Sequence& aOptions); - static void NotifyObservers(const nsAString& aKeySystem, + static void NotifyObservers(nsIDOMWindow* aWindow, + const nsAString& aKeySystem, MediaKeySystemStatus aStatus); private: diff --git a/dom/media/eme/MediaKeys.cpp b/dom/media/eme/MediaKeys.cpp index 34f8383fd65..e6e52742e9a 100644 --- a/dom/media/eme/MediaKeys.cpp +++ b/dom/media/eme/MediaKeys.cpp @@ -367,7 +367,8 @@ MediaKeys::OnCDMCreated(PromiseId aId, const nsACString& aNodeId) Release(); } - MediaKeySystemAccess::NotifyObservers(mKeySystem, + MediaKeySystemAccess::NotifyObservers(mParent, + mKeySystem, MediaKeySystemStatus::Cdm_created); }