Bug 1144450 - Part 2: Don't replace a FontFaceSet's ready promise when there are no loading FontFaces. r=jdaggett
authorCameron McCormack <cam@mcc.id.au>
Tue, 24 Mar 2015 19:34:32 +1100
changeset 264089 f2c86fe2f8e92ef8cd19a0e224b259d0927785fd
parent 264088 a106024f6b0da57d2e25a1b8b34a3ff17edddef3
child 264090 8530a96751c6b43aed6783b8936b31dce36fed31
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs1144450
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1144450 - Part 2: Don't replace a FontFaceSet's ready promise when there are no loading FontFaces. r=jdaggett
layout/style/FontFaceSet.cpp
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -1331,17 +1331,21 @@ void
 FontFaceSet::DidRefresh()
 {
   CheckLoadingFinished();
 }
 
 void
 FontFaceSet::CheckLoadingStarted()
 {
-  if (HasLoadingFontFaces() && !mDispatchedLoadingEvent) {
+  if (!HasLoadingFontFaces()) {
+    return;
+  }
+
+  if (!mDispatchedLoadingEvent) {
     mStatus = FontFaceSetLoadStatus::Loading;
     mDispatchedLoadingEvent = true;
     (new AsyncEventDispatcher(this, NS_LITERAL_STRING("loading"),
                               false))->RunDOMEventWhenSafe();
   }
 
   if (mReadyIsResolved && PrefEnabled()) {
     nsRefPtr<Promise> ready;