diff --git a/dom/media/eme/CDMProxy.cpp b/dom/media/eme/CDMProxy.cpp index 9c669e3dbf1..b42bfdb58c4 100644 --- a/dom/media/eme/CDMProxy.cpp +++ b/dom/media/eme/CDMProxy.cpp @@ -64,19 +64,12 @@ CDMProxy::Init(PromiseId aPromiseId, RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR); return; } - bool hasPlugin; - nsTArray tags; - tags.AppendElement(NS_ConvertUTF16toUTF8(mKeySystem)); - nsresult rv = mps->GetPluginVersionForAPI(NS_LITERAL_CSTRING(GMP_API_DECRYPTOR), - &tags, &hasPlugin, pluginVersion); - NS_ENSURE_SUCCESS_VOID(rv); } nsAutoPtr data(new InitData()); data->mPromiseId = aPromiseId; data->mOrigin = aOrigin; data->mTopLevelOrigin = aTopLevelOrigin; - data->mPluginVersion = pluginVersion; data->mInPrivateBrowsing = aInPrivateBrowsing; nsCOMPtr task( NS_NewRunnableMethodWithArg>(this, @@ -175,7 +168,6 @@ CDMProxy::gmp_Init(nsAutoPtr&& aData) nsresult rv = mps->GetNodeId(data.mOrigin, data.mTopLevelOrigin, data.mInPrivateBrowsing, - data.mPluginVersion, Move(callback)); if (NS_FAILED(rv)) { RejectPromise(data.mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR); diff --git a/dom/media/eme/CDMProxy.h b/dom/media/eme/CDMProxy.h index 28c1516fc6d..d6270791f9a 100644 --- a/dom/media/eme/CDMProxy.h +++ b/dom/media/eme/CDMProxy.h @@ -181,7 +181,6 @@ private: uint32_t mPromiseId; nsAutoString mOrigin; nsAutoString mTopLevelOrigin; - nsAutoCString mPluginVersion; bool mInPrivateBrowsing; }; diff --git a/dom/media/gmp/GMPServiceChild.cpp b/dom/media/gmp/GMPServiceChild.cpp index 0dee5c16cfb..1c29f6fac52 100644 --- a/dom/media/gmp/GMPServiceChild.cpp +++ b/dom/media/gmp/GMPServiceChild.cpp @@ -148,12 +148,10 @@ class GetNodeIdDone : public GetServiceChildCallback { public: GetNodeIdDone(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - bool aInPrivateBrowsing, const nsACString& aVersion, - UniquePtr&& aCallback) + bool aInPrivateBrowsing, UniquePtr&& aCallback) : mOrigin(aOrigin), mTopLevelOrigin(aTopLevelOrigin), mInPrivateBrowsing(aInPrivateBrowsing), - mVersion(aVersion), mCallback(Move(aCallback)) { } @@ -167,8 +165,7 @@ public: nsCString outId; if (!aGMPServiceChild->SendGetGMPNodeId(mOrigin, mTopLevelOrigin, - mInPrivateBrowsing, mVersion, - &outId)) { + mInPrivateBrowsing, &outId)) { mCallback->Done(NS_ERROR_FAILURE, EmptyCString()); return; } @@ -180,7 +177,6 @@ private: nsString mOrigin; nsString mTopLevelOrigin; bool mInPrivateBrowsing; - nsCString mVersion; UniquePtr mCallback; }; @@ -188,12 +184,10 @@ NS_IMETHODIMP GeckoMediaPluginServiceChild::GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, bool aInPrivateBrowsing, - const nsACString& aVersion, UniquePtr&& aCallback) { UniquePtr callback( - new GetNodeIdDone(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, aVersion, - Move(aCallback))); + new GetNodeIdDone(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, Move(aCallback))); GetServiceChild(Move(callback)); return NS_OK; } diff --git a/dom/media/gmp/GMPServiceChild.h b/dom/media/gmp/GMPServiceChild.h index b8a3d970fd1..678423dfe10 100644 --- a/dom/media/gmp/GMPServiceChild.h +++ b/dom/media/gmp/GMPServiceChild.h @@ -34,7 +34,6 @@ public: NS_IMETHOD GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, bool aInPrivateBrowsingMode, - const nsACString& aVersion, UniquePtr&& aCallback) override; NS_DECL_NSIOBSERVER diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index b4da6eeb69f..9f7233766ae 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -584,9 +584,17 @@ GeckoMediaPluginServiceParent::SelectPluginForAPI(const nsACString& aNodeId, return gmp; } - // This GMP has the correct type but has the wrong nodeId; hold on to it - // in case we need to clone it. - gmpToClone = gmp; + if (!gmpToClone || + (gmpToClone->IsMarkedForDeletion() && !gmp->IsMarkedForDeletion())) { + // This GMP has the correct type but has the wrong nodeId; hold on to it + // in case we need to clone it. + // Prefer GMPs in-use for the case where an upgraded plugin version is + // waiting for the old one to die. If the old plugin is in use, we + // should continue using it so that any persistent state remains + // consistent. Otherwise, just check that the plugin isn't scheduled + // for deletion. + gmpToClone = gmp; + } // Loop around and try the next plugin; it may be usable from aNodeId. index++; } @@ -912,7 +920,6 @@ nsresult GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, bool aInPrivateBrowsing, - const nsACString& aVersion, nsACString& aOutId) { MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread); @@ -941,8 +948,7 @@ GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin, } const uint32_t hash = AddToHash(HashString(aOrigin), - HashString(aTopLevelOrigin), - HashString(aVersion)); + HashString(aTopLevelOrigin)); if (aInPrivateBrowsing) { // For PB mode, we store the node id, indexed by the origin pair, @@ -1062,11 +1068,10 @@ NS_IMETHODIMP GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, bool aInPrivateBrowsing, - const nsACString& aVersion, UniquePtr&& aCallback) { nsCString nodeId; - nsresult rv = GetNodeId(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, aVersion, nodeId); + nsresult rv = GetNodeId(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, nodeId); aCallback->Done(rv, nodeId); return rv; } @@ -1435,11 +1440,10 @@ bool GMPServiceParent::RecvGetGMPNodeId(const nsString& aOrigin, const nsString& aTopLevelOrigin, const bool& aInPrivateBrowsing, - const nsCString& aVersion, nsCString* aID) { nsresult rv = mService->GetNodeId(aOrigin, aTopLevelOrigin, - aInPrivateBrowsing, aVersion, *aID); + aInPrivateBrowsing, *aID); return NS_SUCCEEDED(rv); } diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h index 3c6ded77e85..044433ea067 100644 --- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -42,7 +42,6 @@ public: NS_IMETHOD GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, bool aInPrivateBrowsingMode, - const nsACString& aVersion, UniquePtr&& aCallback) override; NS_DECL_MOZIGECKOMEDIAPLUGINCHROMESERVICE @@ -70,8 +69,7 @@ private: size_t* aOutPluginIndex); nsresult GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin, - bool aInPrivateBrowsing, const nsACString& aVersion, - nsACString& aOutId); + bool aInPrivateBrowsing, nsACString& aOutId); void UnloadPlugins(); void CrashPlugins(); @@ -199,7 +197,6 @@ public: virtual bool RecvGetGMPNodeId(const nsString& aOrigin, const nsString& aTopLevelOrigin, const bool& aInPrivateBrowsing, - const nsCString& aVersion, nsCString* aID) override; static bool RecvGetGMPPluginVersionForAPI(const nsCString& aAPI, nsTArray&& aTags, diff --git a/dom/media/gmp/PGMPService.ipdl b/dom/media/gmp/PGMPService.ipdl index 76db2b9cf05..80d24f7a6aa 100644 --- a/dom/media/gmp/PGMPService.ipdl +++ b/dom/media/gmp/PGMPService.ipdl @@ -19,7 +19,7 @@ parent: ProcessId[] alreadyBridgedTo) returns (ProcessId id, nsCString displayName, nsCString pluginId); sync GetGMPNodeId(nsString origin, nsString topLevelOrigin, - bool inPrivateBrowsing, nsCString version) + bool inPrivateBrowsing) returns (nsCString id); }; diff --git a/dom/media/gmp/mozIGeckoMediaPluginService.idl b/dom/media/gmp/mozIGeckoMediaPluginService.idl index 6a958c6be0b..e7541aad288 100644 --- a/dom/media/gmp/mozIGeckoMediaPluginService.idl +++ b/dom/media/gmp/mozIGeckoMediaPluginService.idl @@ -52,7 +52,7 @@ native GetGMPVideoDecoderCallback(mozilla::UniquePtr native GetGMPVideoEncoderCallback(mozilla::UniquePtr&&); native GetNodeIdCallback(mozilla::UniquePtr&&); -[scriptable, uuid(6e3023f4-d9a2-46b4-8f50-70d4c918471d)] +[scriptable, uuid(787cf744-eea8-48c8-b692-376e0485ef97)] interface mozIGeckoMediaPluginService : nsISupports { @@ -146,6 +146,5 @@ interface mozIGeckoMediaPluginService : nsISupports void getNodeId(in AString origin, in AString topLevelOrigin, in bool inPrivateBrowsingMode, - in ACString version, in GetNodeIdCallback callback); }; diff --git a/dom/media/gtest/TestGMPCrossOrigin.cpp b/dom/media/gtest/TestGMPCrossOrigin.cpp index 6ef7e46cbce..bbb034ffb5c 100644 --- a/dom/media/gtest/TestGMPCrossOrigin.cpp +++ b/dom/media/gtest/TestGMPCrossOrigin.cpp @@ -497,7 +497,6 @@ GetNodeId(const nsAString& aOrigin, nsresult rv = service->GetNodeId(aOrigin, aTopLevelOrigin, aInPBMode, - NS_LITERAL_CSTRING(""), Move(callback)); EXPECT_TRUE(NS_SUCCEEDED(rv) && NS_SUCCEEDED(result)); return nodeId;