Bug 1330487 - Part 3: Use correct referrer policy for fontface loader draft
authorThomas Nguyen <tnguyen@mozilla.com>
Tue, 16 Jan 2018 15:42:18 +0800
changeset 721906 2e9830ab5d585b95451ca43159a2ac13526426d9
parent 721905 5c2a600ddcc8e7a54c9060132bc0e358717d8cd3
child 721907 f4a56a02ba50b1b28c6905df2b5da90889422cb3
push id95995
push userbmo:tnguyen@mozilla.com
push dateThu, 18 Jan 2018 02:41:54 +0000
bugs1330487
milestone59.0a1
Bug 1330487 - Part 3: Use correct referrer policy for fontface loader MozReview-Commit-ID: IMzqO2tCDgh
layout/style/FontFaceSet.cpp
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -671,17 +671,17 @@ FontFaceSet::StartLoad(gfxUserFontEntry*
          aFontFaceSrc->mReferrer
          ? aFontFaceSrc->mReferrer->GetSpecOrDefault().get()
          : ""));
   }
 
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
   if (httpChannel) {
     rv = httpChannel->SetReferrerWithPolicy(aFontFaceSrc->mReferrer,
-                                            mDocument->GetReferrerPolicy());
+                                            aFontFaceSrc->mReferrerPolicy);
     Unused << NS_WARN_IF(NS_FAILED(rv));
 
     nsAutoCString accept("application/font-woff;q=0.9,*/*;q=0.8");
     if (Preferences::GetBool(GFX_PREF_WOFF2_ENABLED)) {
       accept.InsertLiteral("application/font-woff2;q=1.0,", 0);
     }
     rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
                                        accept, false);
@@ -1145,17 +1145,17 @@ FontFaceSet::FindOrCreateUserFontEntryFr
           face->mReferrerPolicy = mozilla::net::RP_Unset;
           break;
         case eCSSUnit_URL: {
           face->mSourceType = gfxFontFaceSrc::eSourceType_URL;
           nsIURI* uri = val.GetURLValue();
           face->mURI = uri ? new gfxFontSrcURI(uri) : nullptr;
           URLValue* url = val.GetURLStructValue();
           face->mReferrer = url->mExtraData->GetReferrer();
-          face->mReferrerPolicy = set->mDocument->GetReferrerPolicy();
+          face->mReferrerPolicy = url->mExtraData->GetReferrerPolicy();
           face->mOriginPrincipal =
             new gfxFontSrcPrincipal(url->mExtraData->GetPrincipal());
           NS_ASSERTION(face->mOriginPrincipal, "null origin principal in @font-face rule");
 
           // agent and user stylesheets are treated slightly differently,
           // the same-site origin check and access control headers are
           // enforced against the sheet principal rather than the document
           // principal to allow user stylesheets to include @font-face rules