зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1111787 - Part 2: Kill plugins with valid node IDs when clearing storage data for those IDs will be invalid and can't be used anymore. r=cpearce
This commit is contained in:
Родитель
ea65e9fd34
Коммит
1725e359fe
|
@ -62,7 +62,6 @@ GMPParent::GMPParent()
|
|||
, mAbnormalShutdownInProgress(false)
|
||||
, mAsyncShutdownRequired(false)
|
||||
, mAsyncShutdownInProgress(false)
|
||||
, mHasAccessedStorage(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -697,12 +696,6 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GMPParent::HasAccessedStorage() const
|
||||
{
|
||||
return mHasAccessedStorage;
|
||||
}
|
||||
|
||||
mozilla::dom::PCrashReporterParent*
|
||||
GMPParent::AllocPCrashReporterParent(const NativeThreadId& aThread)
|
||||
{
|
||||
|
@ -809,7 +802,6 @@ GMPParent::RecvPGMPStorageConstructor(PGMPStorageParent* aActor)
|
|||
if (NS_WARN_IF(NS_FAILED(p->Init()))) {
|
||||
return false;
|
||||
}
|
||||
mHasAccessedStorage = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
|
||||
// Specifies that a GMP can only work with the specified NodeIds.
|
||||
void SetNodeId(const nsACString& aNodeId);
|
||||
const nsACString& GetNodeId() const { return mNodeId; }
|
||||
|
||||
// Returns true if a plugin can be or is being used across multiple NodeIds.
|
||||
bool CanBeSharedCrossNodeIds() const;
|
||||
|
@ -131,8 +132,6 @@ public:
|
|||
|
||||
void AbortAsyncShutdown();
|
||||
|
||||
bool HasAccessedStorage() const;
|
||||
|
||||
private:
|
||||
~GMPParent();
|
||||
nsRefPtr<GeckoMediaPluginService> mService;
|
||||
|
@ -197,7 +196,6 @@ private:
|
|||
|
||||
bool mAsyncShutdownRequired;
|
||||
bool mAsyncShutdownInProgress;
|
||||
bool mHasAccessedStorage;
|
||||
};
|
||||
|
||||
} // namespace gmp
|
||||
|
|
|
@ -1256,11 +1256,9 @@ GeckoMediaPluginService::ClearStorage()
|
|||
return;
|
||||
#endif
|
||||
|
||||
// Shutdown plugins that have touched storage, as they could have
|
||||
// state that depends on storage. We don't want them to write data
|
||||
// after we've cleared storage, as they could end up in an inconsistent
|
||||
// state, so we must ensure they're shutdown before we actually clear
|
||||
// storage. Note: we can't shut them down while holding the lock,
|
||||
// Shutdown all plugins that have valid node IDs as those IDs will become
|
||||
// invalid and shouldn't be used anymore after we clear storage data.
|
||||
// Note: we can't shut them down while holding the lock,
|
||||
// as the lock is not re-entrant and shutdown requires taking the lock.
|
||||
// The plugin list is only edited on the GMP thread, so this should be OK.
|
||||
nsTArray<nsRefPtr<GMPParent>> pluginsToKill;
|
||||
|
@ -1268,7 +1266,7 @@ GeckoMediaPluginService::ClearStorage()
|
|||
MutexAutoLock lock(mMutex);
|
||||
for (size_t i = 0; i < mPlugins.Length(); i++) {
|
||||
nsRefPtr<GMPParent> parent(mPlugins[i]);
|
||||
if (parent->HasAccessedStorage()) {
|
||||
if (!parent->GetNodeId().IsEmpty()) {
|
||||
pluginsToKill.AppendElement(parent);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче