Bug 1441932 P4 Treat same-value assignments to the LoadInfo reserved and initial ClientInfo values as no-op changes. r=mayhemer

This commit is contained in:
Ben Kelly 2018-06-04 09:26:51 -07:00
Родитель 85490e45e8
Коммит ac7ea6f3f6
3 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -60,6 +60,12 @@ ClientInfo::~ClientInfo()
{
}
bool
ClientInfo::operator==(const ClientInfo& aRight) const
{
return *mData == *aRight.mData;
}
const nsID&
ClientInfo::Id() const
{

Просмотреть файл

@ -47,6 +47,9 @@ public:
~ClientInfo();
bool
operator==(const ClientInfo& aRight) const;
// Get the unique identifier chosen at the time of the global's creation.
const nsID&
Id() const;

Просмотреть файл

@ -1317,6 +1317,11 @@ void
LoadInfo::SetReservedClientInfo(const ClientInfo& aClientInfo)
{
MOZ_DIAGNOSTIC_ASSERT(mInitialClientInfo.isNothing());
// Treat assignments of the same value as a no-op. The emplace below
// will normally assert when overwriting an existing value.
if (mReservedClientInfo.isSome() && mReservedClientInfo.ref() == aClientInfo) {
return;
}
mReservedClientInfo.emplace(aClientInfo);
}
@ -1331,6 +1336,11 @@ LoadInfo::SetInitialClientInfo(const ClientInfo& aClientInfo)
{
MOZ_DIAGNOSTIC_ASSERT(!mReservedClientSource);
MOZ_DIAGNOSTIC_ASSERT(mReservedClientInfo.isNothing());
// Treat assignments of the same value as a no-op. The emplace below
// will normally assert when overwriting an existing value.
if (mInitialClientInfo.isSome() && mInitialClientInfo.ref() == aClientInfo) {
return;
}
mInitialClientInfo.emplace(aClientInfo);
}