bug 680037 - check calls for failure before using the results in nsFontFaceLoader::LoadTimerCallback. r=jdaggett
authorJonathan Kew <jfkthame@gmail.com>
Tue, 23 Aug 2011 13:33:51 +0100
changeset 75709 d051bc49c30475b0f0f06078bf1139ced70e25f1
parent 75708 aa9f34f40b16d7e26a8e47b70ce44118c9187f18
child 75710 1e02b2b0d6a6c150d9acd9ea14ed2542be17fa73
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersjdaggett
bugs680037
milestone9.0a1
bug 680037 - check calls for failure before using the results in nsFontFaceLoader::LoadTimerCallback. r=jdaggett
layout/style/nsFontFaceLoader.cpp
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -132,21 +132,20 @@ nsFontFaceLoader::LoadTimerCallback(nsIT
 
   gfxProxyFontEntry *pe = loader->mFontEntry.get();
   bool updateUserFontSet = true;
 
   // If the entry is loading, check whether it's >75% done; if so,
   // we allow another timeout period before showing a fallback font.
   if (pe->mLoadingState == gfxProxyFontEntry::LOADING_STARTED) {
     PRInt32 contentLength;
-    loader->mChannel->GetContentLength(&contentLength);
     PRUint32 numBytesRead;
-    loader->mStreamLoader->GetNumBytesRead(&numBytesRead);
-
-    if (contentLength > 0 &&
+    if (NS_SUCCEEDED(loader->mChannel->GetContentLength(&contentLength)) &&
+        contentLength > 0 &&
+        NS_SUCCEEDED(loader->mStreamLoader->GetNumBytesRead(&numBytesRead)) &&
         numBytesRead > 3 * (PRUint32(contentLength) >> 2))
     {
       // More than 3/4 the data has been downloaded, so allow 50% extra
       // time and hope the remainder will arrive before the additional
       // time expires.
       pe->mLoadingState = gfxProxyFontEntry::LOADING_ALMOST_DONE;
       PRUint32 delay;
       loader->mLoadTimer->GetDelay(&delay);