Bug 1349815 - Avoid setting the static cache during the servo traversal. r=heycam

MozReview-Commit-ID: E9XC4kaCVd2
This commit is contained in:
Bobby Holley 2017-03-22 19:52:53 -07:00
parent ec78798123
commit 8c4e31302e

View File

@ -13,6 +13,7 @@
#include "nsFont.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/Preferences.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/widget/WidgetMessageUtils.h"
@ -437,6 +438,8 @@ nsXPLookAndFeel::OnPrefChanged(const char* aPref, void* aClosure)
void
nsXPLookAndFeel::Init()
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
// Say we're already initialized, and take the chance that it might fail;
// protects against some other process writing to our static variables.
sInitialized = true;
@ -825,7 +828,10 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, bool aUseStandinsForNativeColors,
}
}
CACHE_COLOR(aID, aResult);
if (!mozilla::ServoStyleSet::IsInServoTraversal()) {
MOZ_ASSERT(NS_IsMainThread());
CACHE_COLOR(aID, aResult);
}
return NS_OK;
}