Bug 1356275 - Assert that we're on the main thread in the unused and unsafe Gecko_GetFontMetrics ; r?bholley
MozReview-Commit-ID: LGu8mdFMq9
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1719,16 +1719,19 @@ ShutdownServo()
GeckoFontMetrics
Gecko_GetFontMetrics(RawGeckoPresContextBorrowed aPresContext,
bool aIsVertical,
const nsStyleFont* aFont,
nscoord aFontSize,
bool aUseUserFontSet)
{
+ // This function is still unsafe due to frobbing DOM and network
+ // off main thread. We currently disable it in Servo, see bug 1356105
+ MOZ_ASSERT(NS_IsMainThread());
MutexAutoLock lock(*sServoFontMetricsLock);
GeckoFontMetrics ret;
// Safe because we are locked, and this function is only
// ever called from Servo parallel traversal or the main thread
nsPresContext* presContext = const_cast<nsPresContext*>(aPresContext);
presContext->SetUsesExChUnits(true);
RefPtr<nsFontMetrics> fm = nsRuleNode::GetMetricsFor(presContext, aIsVertical,
aFont, aFontSize,