Bug 1356275 - Assert that we're on the main thread in the unused and unsafe Gecko_GetFontMetrics ; r=bholley
authorManish Goregaokar <manishearth@gmail.com>
Fri, 14 Apr 2017 10:44:00 +0800
changeset 566717 9c187a205fc6a527a9f73a72d69daaba51b163aa
parent 566700 0a18e825015bddda8779c40a5dd0ee6144e7d531
child 566718 33d4c888561305b5c97f2697889e7e8e5013c9c1
push id55308
push userbmo:rajesh.kathiriya507@gmail.com
push dateSat, 22 Apr 2017 10:15:05 +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
@@ -1755,16 +1755,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,