From 41106451521df38b564680e9d9e83e6e52f12e6b Mon Sep 17 00:00:00 2001 From: Wei-Cheng Pan Date: Tue, 20 Dec 2016 17:19:56 +0800 Subject: [PATCH] Bug 1310127 - Part 13: Use MOZ_MUST_USE in netwerk/protocol/http r=heycam MozReview-Commit-ID: 9qpbe86biXz --HG-- extra : rebase_source : f76dde754eea0f253f7c2b16fdb1067623617291 --- layout/style/FontFaceSet.cpp | 17 +++++++++++------ layout/style/Loader.cpp | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 034b1de89f2f..a35556c8587b 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -617,20 +617,25 @@ FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry, nsCOMPtr httpChannel(do_QueryInterface(channel)); if (httpChannel) { - httpChannel->SetReferrerWithPolicy(aFontFaceSrc->mReferrer, - mDocument->GetReferrerPolicy()); + rv = httpChannel->SetReferrerWithPolicy(aFontFaceSrc->mReferrer, + mDocument->GetReferrerPolicy()); + NS_ENSURE_SUCCESS(rv, rv); + nsAutoCString accept("application/font-woff;q=0.9,*/*;q=0.8"); if (Preferences::GetBool(GFX_PREF_WOFF2_ENABLED)) { accept.Insert(NS_LITERAL_CSTRING("application/font-woff2;q=1.0,"), 0); } - httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"), - accept, false); + rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"), + accept, false); + NS_ENSURE_SUCCESS(rv, rv); + // For WOFF and WOFF2, we should tell servers/proxies/etc NOT to try // and apply additional compression at the content-encoding layer if (aFontFaceSrc->mFormatFlags & (gfxUserFontSet::FLAG_FORMAT_WOFF | gfxUserFontSet::FLAG_FORMAT_WOFF2)) { - httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept-Encoding"), - NS_LITERAL_CSTRING("identity"), false); + rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept-Encoding"), + NS_LITERAL_CSTRING("identity"), false); + NS_ENSURE_SUCCESS(rv, rv); } } nsCOMPtr priorityChannel(do_QueryInterface(channel)); diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 31be1bef4920..23aa22b11e17 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -1680,17 +1680,22 @@ Loader::LoadSheet(SheetLoadData* aLoadData, nsCOMPtr httpChannel(do_QueryInterface(channel)); if (httpChannel) { // Send a minimal Accept header for text/css - httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"), - NS_LITERAL_CSTRING("text/css,*/*;q=0.1"), - false); + rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"), + NS_LITERAL_CSTRING("text/css,*/*;q=0.1"), + false); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr referrerURI = aLoadData->GetReferrerURI(); - if (referrerURI) - httpChannel->SetReferrerWithPolicy(referrerURI, - aLoadData->mSheet->GetReferrerPolicy()); + if (referrerURI) { + rv = httpChannel->SetReferrerWithPolicy(referrerURI, + aLoadData->mSheet->GetReferrerPolicy()); + NS_ENSURE_SUCCESS(rv, rv); + } nsCOMPtr internalChannel = do_QueryInterface(httpChannel); if (internalChannel) { - internalChannel->SetIntegrityMetadata(sriMetadata.GetIntegrityString()); + rv = internalChannel->SetIntegrityMetadata(sriMetadata.GetIntegrityString()); + NS_ENSURE_SUCCESS(rv, rv); } // Set the initiator type