Backed out changeset 99c0d338a5f3 (bug 1376964) for bustage
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 12 Jul 2017 10:33:05 +0200
changeset 607468 34fe793e4c4db9813343589ad9fc4a7f0f8883a7
parent 607467 95b3b94ce27ef544bebf89d6d7555474e2726542
child 607469 f936e37dfe095928201bc771648cb0c83ff6351f
child 607810 46fb242c49d810653d7d1f7cbbd4370a019d7ce6
push id67985
push userbmo:emilio+bugs@crisal.io
push dateWed, 12 Jul 2017 08:36:44 +0000
bugs1376964
milestone56.0a1
backs out99c0d338a5f34e36267a96dae13411b914584dbe
Backed out changeset 99c0d338a5f3 (bug 1376964) for bustage
layout/style/FontFaceSet.cpp
layout/style/FontFaceSet.h
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -101,47 +101,28 @@ FontFaceSet::FontFaceSet(nsPIDOMWindowIn
   : DOMEventTargetHelper(aWindow)
   , mDocument(aDocument)
   , mResolveLazilyCreatedReadyPromise(false)
   , mStatus(FontFaceSetLoadStatus::Loaded)
   , mNonRuleFacesDirty(false)
   , mHasLoadingFontFaces(false)
   , mHasLoadingFontFacesIsDirty(false)
   , mDelayedLoadCheck(false)
-  , mBypassCache(false)
 {
   MOZ_ASSERT(mDocument, "We should get a valid document from the caller!");
 
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aWindow);
 
   // If the pref is not set, don't create the Promise (which the page wouldn't
   // be able to get to anyway) as it causes the window.FontFaceSet constructor
   // to be created.
   if (global && PrefEnabled()) {
     mResolveLazilyCreatedReadyPromise = true;
   }
 
-  // Record the state of the "bypass cache" flags from the docshell now,
-  // since we want to look at them from style worker threads, and we can
-  // only get to the docshell through a weak pointer (which is only
-  // possible on the main thread).
-  //
-  // In theory the load type of a docshell could change after the document
-  // is loaded, but handling that doesn't seem too important.
-  if (nsCOMPtr<nsIDocShell> docShell = mDocument->GetDocShell()) {
-    uint32_t loadType;
-    uint32_t flags;
-    if ((NS_SUCCEEDED(docShell->GetLoadType(&loadType)) &&
-         ((loadType >> 16) & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)) ||
-        (NS_SUCCEEDED(docShell->GetDefaultLoadFlags(&flags)) &&
-         (flags & nsIRequest::LOAD_BYPASS_CACHE))) {
-      mBypassCache = true;
-    }
-  }
-
   if (!mDocument->DidFireDOMContentLoaded()) {
     mDocument->AddSystemEventListener(NS_LITERAL_STRING("DOMContentLoaded"),
                                       this, false, false);
   }
 
   mDocument->CSSLoader()->AddObserver(this);
 
   mUserFontSet = new UserFontSet(this);
@@ -1341,17 +1322,33 @@ FontFaceSet::CheckFontLoad(const gfxFont
   *aPrincipal = mDocument->NodePrincipal();
 
   NS_ASSERTION(aFontFaceSrc->mOriginPrincipal,
                "null origin principal in @font-face rule");
   if (aFontFaceSrc->mUseOriginPrincipal) {
     *aPrincipal = aFontFaceSrc->mOriginPrincipal;
   }
 
-  *aBypassCache = mBypassCache;
+  *aBypassCache = false;
+
+  nsCOMPtr<nsIDocShell> docShell = mDocument->GetDocShell();
+  if (docShell) {
+    uint32_t loadType;
+    if (NS_SUCCEEDED(docShell->GetLoadType(&loadType))) {
+      if ((loadType >> 16) & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE) {
+        *aBypassCache = true;
+      }
+    }
+    uint32_t flags;
+    if (NS_SUCCEEDED(docShell->GetDefaultLoadFlags(&flags))) {
+      if (flags & nsIRequest::LOAD_BYPASS_CACHE) {
+        *aBypassCache = true;
+      }
+    }
+  }
 
   return NS_OK;
 }
 
 // @arg aPrincipal: generally this is mDocument->NodePrincipal() but
 // might also be the original principal which enables user stylesheets
 // to load font files via @font-face rules.
 bool
--- a/layout/style/FontFaceSet.h
+++ b/layout/style/FontFaceSet.h
@@ -350,18 +350,14 @@ private:
   bool mHasLoadingFontFaces;
 
   // This variable is only valid when mLoadingDirty is false.
   bool mHasLoadingFontFacesIsDirty;
 
   // Whether CheckLoadingFinished calls should be ignored.  See comment in
   // OnFontFaceStatusChanged.
   bool mDelayedLoadCheck;
-
-  // Whether the docshell for our document indicated that loads should
-  // bypass the cache.
-  bool mBypassCache;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // !defined(mozilla_dom_FontFaceSet_h)