mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1156560 - Prefer old CDMs on update if they are in use - r=cpearce
This commit is contained in:
parent
600801e360
commit
35bb5221ce
@ -64,19 +64,12 @@ CDMProxy::Init(PromiseId aPromiseId,
|
|||||||
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
|
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool hasPlugin;
|
|
||||||
nsTArray<nsCString> 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<InitData> data(new InitData());
|
nsAutoPtr<InitData> data(new InitData());
|
||||||
data->mPromiseId = aPromiseId;
|
data->mPromiseId = aPromiseId;
|
||||||
data->mOrigin = aOrigin;
|
data->mOrigin = aOrigin;
|
||||||
data->mTopLevelOrigin = aTopLevelOrigin;
|
data->mTopLevelOrigin = aTopLevelOrigin;
|
||||||
data->mPluginVersion = pluginVersion;
|
|
||||||
data->mInPrivateBrowsing = aInPrivateBrowsing;
|
data->mInPrivateBrowsing = aInPrivateBrowsing;
|
||||||
nsCOMPtr<nsIRunnable> task(
|
nsCOMPtr<nsIRunnable> task(
|
||||||
NS_NewRunnableMethodWithArg<nsAutoPtr<InitData>>(this,
|
NS_NewRunnableMethodWithArg<nsAutoPtr<InitData>>(this,
|
||||||
@ -175,7 +168,6 @@ CDMProxy::gmp_Init(nsAutoPtr<InitData>&& aData)
|
|||||||
nsresult rv = mps->GetNodeId(data.mOrigin,
|
nsresult rv = mps->GetNodeId(data.mOrigin,
|
||||||
data.mTopLevelOrigin,
|
data.mTopLevelOrigin,
|
||||||
data.mInPrivateBrowsing,
|
data.mInPrivateBrowsing,
|
||||||
data.mPluginVersion,
|
|
||||||
Move(callback));
|
Move(callback));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
RejectPromise(data.mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
|
RejectPromise(data.mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||||
|
@ -181,7 +181,6 @@ private:
|
|||||||
uint32_t mPromiseId;
|
uint32_t mPromiseId;
|
||||||
nsAutoString mOrigin;
|
nsAutoString mOrigin;
|
||||||
nsAutoString mTopLevelOrigin;
|
nsAutoString mTopLevelOrigin;
|
||||||
nsAutoCString mPluginVersion;
|
|
||||||
bool mInPrivateBrowsing;
|
bool mInPrivateBrowsing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,12 +148,10 @@ class GetNodeIdDone : public GetServiceChildCallback
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GetNodeIdDone(const nsAString& aOrigin, const nsAString& aTopLevelOrigin,
|
GetNodeIdDone(const nsAString& aOrigin, const nsAString& aTopLevelOrigin,
|
||||||
bool aInPrivateBrowsing, const nsACString& aVersion,
|
bool aInPrivateBrowsing, UniquePtr<GetNodeIdCallback>&& aCallback)
|
||||||
UniquePtr<GetNodeIdCallback>&& aCallback)
|
|
||||||
: mOrigin(aOrigin),
|
: mOrigin(aOrigin),
|
||||||
mTopLevelOrigin(aTopLevelOrigin),
|
mTopLevelOrigin(aTopLevelOrigin),
|
||||||
mInPrivateBrowsing(aInPrivateBrowsing),
|
mInPrivateBrowsing(aInPrivateBrowsing),
|
||||||
mVersion(aVersion),
|
|
||||||
mCallback(Move(aCallback))
|
mCallback(Move(aCallback))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -167,8 +165,7 @@ public:
|
|||||||
|
|
||||||
nsCString outId;
|
nsCString outId;
|
||||||
if (!aGMPServiceChild->SendGetGMPNodeId(mOrigin, mTopLevelOrigin,
|
if (!aGMPServiceChild->SendGetGMPNodeId(mOrigin, mTopLevelOrigin,
|
||||||
mInPrivateBrowsing, mVersion,
|
mInPrivateBrowsing, &outId)) {
|
||||||
&outId)) {
|
|
||||||
mCallback->Done(NS_ERROR_FAILURE, EmptyCString());
|
mCallback->Done(NS_ERROR_FAILURE, EmptyCString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -180,7 +177,6 @@ private:
|
|||||||
nsString mOrigin;
|
nsString mOrigin;
|
||||||
nsString mTopLevelOrigin;
|
nsString mTopLevelOrigin;
|
||||||
bool mInPrivateBrowsing;
|
bool mInPrivateBrowsing;
|
||||||
nsCString mVersion;
|
|
||||||
UniquePtr<GetNodeIdCallback> mCallback;
|
UniquePtr<GetNodeIdCallback> mCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -188,12 +184,10 @@ NS_IMETHODIMP
|
|||||||
GeckoMediaPluginServiceChild::GetNodeId(const nsAString& aOrigin,
|
GeckoMediaPluginServiceChild::GetNodeId(const nsAString& aOrigin,
|
||||||
const nsAString& aTopLevelOrigin,
|
const nsAString& aTopLevelOrigin,
|
||||||
bool aInPrivateBrowsing,
|
bool aInPrivateBrowsing,
|
||||||
const nsACString& aVersion,
|
|
||||||
UniquePtr<GetNodeIdCallback>&& aCallback)
|
UniquePtr<GetNodeIdCallback>&& aCallback)
|
||||||
{
|
{
|
||||||
UniquePtr<GetServiceChildCallback> callback(
|
UniquePtr<GetServiceChildCallback> callback(
|
||||||
new GetNodeIdDone(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, aVersion,
|
new GetNodeIdDone(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, Move(aCallback)));
|
||||||
Move(aCallback)));
|
|
||||||
GetServiceChild(Move(callback));
|
GetServiceChild(Move(callback));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ public:
|
|||||||
NS_IMETHOD GetNodeId(const nsAString& aOrigin,
|
NS_IMETHOD GetNodeId(const nsAString& aOrigin,
|
||||||
const nsAString& aTopLevelOrigin,
|
const nsAString& aTopLevelOrigin,
|
||||||
bool aInPrivateBrowsingMode,
|
bool aInPrivateBrowsingMode,
|
||||||
const nsACString& aVersion,
|
|
||||||
UniquePtr<GetNodeIdCallback>&& aCallback) override;
|
UniquePtr<GetNodeIdCallback>&& aCallback) override;
|
||||||
|
|
||||||
NS_DECL_NSIOBSERVER
|
NS_DECL_NSIOBSERVER
|
||||||
|
@ -584,9 +584,17 @@ GeckoMediaPluginServiceParent::SelectPluginForAPI(const nsACString& aNodeId,
|
|||||||
return gmp;
|
return gmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This GMP has the correct type but has the wrong nodeId; hold on to it
|
if (!gmpToClone ||
|
||||||
// in case we need to clone it.
|
(gmpToClone->IsMarkedForDeletion() && !gmp->IsMarkedForDeletion())) {
|
||||||
gmpToClone = gmp;
|
// 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.
|
// Loop around and try the next plugin; it may be usable from aNodeId.
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
@ -912,7 +920,6 @@ nsresult
|
|||||||
GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin,
|
GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin,
|
||||||
const nsAString& aTopLevelOrigin,
|
const nsAString& aTopLevelOrigin,
|
||||||
bool aInPrivateBrowsing,
|
bool aInPrivateBrowsing,
|
||||||
const nsACString& aVersion,
|
|
||||||
nsACString& aOutId)
|
nsACString& aOutId)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||||
@ -941,8 +948,7 @@ GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t hash = AddToHash(HashString(aOrigin),
|
const uint32_t hash = AddToHash(HashString(aOrigin),
|
||||||
HashString(aTopLevelOrigin),
|
HashString(aTopLevelOrigin));
|
||||||
HashString(aVersion));
|
|
||||||
|
|
||||||
if (aInPrivateBrowsing) {
|
if (aInPrivateBrowsing) {
|
||||||
// For PB mode, we store the node id, indexed by the origin pair,
|
// For PB mode, we store the node id, indexed by the origin pair,
|
||||||
@ -1062,11 +1068,10 @@ NS_IMETHODIMP
|
|||||||
GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin,
|
GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin,
|
||||||
const nsAString& aTopLevelOrigin,
|
const nsAString& aTopLevelOrigin,
|
||||||
bool aInPrivateBrowsing,
|
bool aInPrivateBrowsing,
|
||||||
const nsACString& aVersion,
|
|
||||||
UniquePtr<GetNodeIdCallback>&& aCallback)
|
UniquePtr<GetNodeIdCallback>&& aCallback)
|
||||||
{
|
{
|
||||||
nsCString nodeId;
|
nsCString nodeId;
|
||||||
nsresult rv = GetNodeId(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, aVersion, nodeId);
|
nsresult rv = GetNodeId(aOrigin, aTopLevelOrigin, aInPrivateBrowsing, nodeId);
|
||||||
aCallback->Done(rv, nodeId);
|
aCallback->Done(rv, nodeId);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -1435,11 +1440,10 @@ bool
|
|||||||
GMPServiceParent::RecvGetGMPNodeId(const nsString& aOrigin,
|
GMPServiceParent::RecvGetGMPNodeId(const nsString& aOrigin,
|
||||||
const nsString& aTopLevelOrigin,
|
const nsString& aTopLevelOrigin,
|
||||||
const bool& aInPrivateBrowsing,
|
const bool& aInPrivateBrowsing,
|
||||||
const nsCString& aVersion,
|
|
||||||
nsCString* aID)
|
nsCString* aID)
|
||||||
{
|
{
|
||||||
nsresult rv = mService->GetNodeId(aOrigin, aTopLevelOrigin,
|
nsresult rv = mService->GetNodeId(aOrigin, aTopLevelOrigin,
|
||||||
aInPrivateBrowsing, aVersion, *aID);
|
aInPrivateBrowsing, *aID);
|
||||||
return NS_SUCCEEDED(rv);
|
return NS_SUCCEEDED(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ public:
|
|||||||
NS_IMETHOD GetNodeId(const nsAString& aOrigin,
|
NS_IMETHOD GetNodeId(const nsAString& aOrigin,
|
||||||
const nsAString& aTopLevelOrigin,
|
const nsAString& aTopLevelOrigin,
|
||||||
bool aInPrivateBrowsingMode,
|
bool aInPrivateBrowsingMode,
|
||||||
const nsACString& aVersion,
|
|
||||||
UniquePtr<GetNodeIdCallback>&& aCallback) override;
|
UniquePtr<GetNodeIdCallback>&& aCallback) override;
|
||||||
|
|
||||||
NS_DECL_MOZIGECKOMEDIAPLUGINCHROMESERVICE
|
NS_DECL_MOZIGECKOMEDIAPLUGINCHROMESERVICE
|
||||||
@ -70,8 +69,7 @@ private:
|
|||||||
size_t* aOutPluginIndex);
|
size_t* aOutPluginIndex);
|
||||||
|
|
||||||
nsresult GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin,
|
nsresult GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin,
|
||||||
bool aInPrivateBrowsing, const nsACString& aVersion,
|
bool aInPrivateBrowsing, nsACString& aOutId);
|
||||||
nsACString& aOutId);
|
|
||||||
|
|
||||||
void UnloadPlugins();
|
void UnloadPlugins();
|
||||||
void CrashPlugins();
|
void CrashPlugins();
|
||||||
@ -199,7 +197,6 @@ public:
|
|||||||
virtual bool RecvGetGMPNodeId(const nsString& aOrigin,
|
virtual bool RecvGetGMPNodeId(const nsString& aOrigin,
|
||||||
const nsString& aTopLevelOrigin,
|
const nsString& aTopLevelOrigin,
|
||||||
const bool& aInPrivateBrowsing,
|
const bool& aInPrivateBrowsing,
|
||||||
const nsCString& aVersion,
|
|
||||||
nsCString* aID) override;
|
nsCString* aID) override;
|
||||||
static bool RecvGetGMPPluginVersionForAPI(const nsCString& aAPI,
|
static bool RecvGetGMPPluginVersionForAPI(const nsCString& aAPI,
|
||||||
nsTArray<nsCString>&& aTags,
|
nsTArray<nsCString>&& aTags,
|
||||||
|
@ -19,7 +19,7 @@ parent:
|
|||||||
ProcessId[] alreadyBridgedTo)
|
ProcessId[] alreadyBridgedTo)
|
||||||
returns (ProcessId id, nsCString displayName, nsCString pluginId);
|
returns (ProcessId id, nsCString displayName, nsCString pluginId);
|
||||||
sync GetGMPNodeId(nsString origin, nsString topLevelOrigin,
|
sync GetGMPNodeId(nsString origin, nsString topLevelOrigin,
|
||||||
bool inPrivateBrowsing, nsCString version)
|
bool inPrivateBrowsing)
|
||||||
returns (nsCString id);
|
returns (nsCString id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ native GetGMPVideoDecoderCallback(mozilla::UniquePtr<GetGMPVideoDecoderCallback>
|
|||||||
native GetGMPVideoEncoderCallback(mozilla::UniquePtr<GetGMPVideoEncoderCallback>&&);
|
native GetGMPVideoEncoderCallback(mozilla::UniquePtr<GetGMPVideoEncoderCallback>&&);
|
||||||
native GetNodeIdCallback(mozilla::UniquePtr<GetNodeIdCallback>&&);
|
native GetNodeIdCallback(mozilla::UniquePtr<GetNodeIdCallback>&&);
|
||||||
|
|
||||||
[scriptable, uuid(6e3023f4-d9a2-46b4-8f50-70d4c918471d)]
|
[scriptable, uuid(787cf744-eea8-48c8-b692-376e0485ef97)]
|
||||||
interface mozIGeckoMediaPluginService : nsISupports
|
interface mozIGeckoMediaPluginService : nsISupports
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -146,6 +146,5 @@ interface mozIGeckoMediaPluginService : nsISupports
|
|||||||
void getNodeId(in AString origin,
|
void getNodeId(in AString origin,
|
||||||
in AString topLevelOrigin,
|
in AString topLevelOrigin,
|
||||||
in bool inPrivateBrowsingMode,
|
in bool inPrivateBrowsingMode,
|
||||||
in ACString version,
|
|
||||||
in GetNodeIdCallback callback);
|
in GetNodeIdCallback callback);
|
||||||
};
|
};
|
||||||
|
@ -497,7 +497,6 @@ GetNodeId(const nsAString& aOrigin,
|
|||||||
nsresult rv = service->GetNodeId(aOrigin,
|
nsresult rv = service->GetNodeId(aOrigin,
|
||||||
aTopLevelOrigin,
|
aTopLevelOrigin,
|
||||||
aInPBMode,
|
aInPBMode,
|
||||||
NS_LITERAL_CSTRING(""),
|
|
||||||
Move(callback));
|
Move(callback));
|
||||||
EXPECT_TRUE(NS_SUCCEEDED(rv) && NS_SUCCEEDED(result));
|
EXPECT_TRUE(NS_SUCCEEDED(rv) && NS_SUCCEEDED(result));
|
||||||
return nodeId;
|
return nodeId;
|
||||||
|
Loading…
Reference in New Issue
Block a user