Bug 1356275 - Assert that we're on the main thread in the unused and unsafe Gecko_GetFontMetrics ; r?bholley draft
authorManish Goregaokar <manishearth@gmail.com>
Fri, 14 Apr 2017 10:44:00 +0800
changeset 566580 89997fe89e45834e6ad5844f11a7efff63fd4a7a
parent 566524 ff6abe20041933a67f636b748ed698e9616a6833
child 625358 35133123bfaf9f617758e5a18a849c7bad547349
push id55264
push userbmo:manishearth@gmail.com
push dateFri, 21 Apr 2017 20:30:16 +0000
reviewersbholley
bugs1356275
milestone55.0a1
Bug 1356275 - Assert that we're on the main thread in the unused and unsafe Gecko_GetFontMetrics ; r?bholley MozReview-Commit-ID: LGu8mdFMq9
layout/style/ServoBindings.cpp
--- 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,