From 1bd91d2d6889221efd7ab2e62198ac06d0da4e8c Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 29 Nov 2019 12:43:44 +0000 Subject: [PATCH] Bug 1597865 - Fix do_QueryInterface to a RefPtr in DocumentChannel. r=mattwoodrow,mayhemer. Use QueryObject instead. Some variable renaming to make it clearer we are dealing with a http channel. Differential Revision: https://phabricator.services.mozilla.com/D55238 --HG-- extra : moz-landing-system : lando --- netwerk/ipc/DocumentLoadListener.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp index 101d5aecd0aa..eea97a8d35c1 100644 --- a/netwerk/ipc/DocumentLoadListener.cpp +++ b/netwerk/ipc/DocumentLoadListener.cpp @@ -333,7 +333,7 @@ void DocumentLoadListener::ResumeSuspendedChannel( std::move(mPendingRequests); MOZ_ASSERT(mPendingRequests.IsEmpty()); - nsCOMPtr httpChannel = do_QueryInterface(mChannel); + RefPtr httpChannel = do_QueryObject(mChannel); if (httpChannel) { httpChannel->SetApplyConversion(mOldApplyConversion); } @@ -806,7 +806,7 @@ DocumentLoadListener::AsyncOnChannelRedirect( // Since we're redirecting away from aOldChannel, we should check if it // had a COOP mismatch, since we want the final result for this to // include the state of all channels we redirected through. - nsCOMPtr httpChannel = do_QueryInterface(aOldChannel); + RefPtr httpChannel = do_QueryObject(aOldChannel); if (httpChannel) { bool mismatch = false; MOZ_ALWAYS_SUCCEEDS( @@ -911,14 +911,14 @@ DocumentLoadListener::HasCrossOriginOpenerPolicyMismatch(bool* aMismatch) { return NS_OK; } - nsCOMPtr channel = do_QueryInterface(mChannel); - if (!channel) { + RefPtr httpChannel = do_QueryObject(mChannel); + if (!httpChannel) { // Not an nsHttpChannel assume it's okay to switch. *aMismatch = false; return NS_OK; } - return channel->HasCrossOriginOpenerPolicyMismatch(aMismatch); + return httpChannel->HasCrossOriginOpenerPolicyMismatch(aMismatch); } NS_IMETHODIMP @@ -929,13 +929,13 @@ DocumentLoadListener::GetCrossOriginOpenerPolicy( return NS_ERROR_INVALID_ARG; } - nsCOMPtr channel = do_QueryInterface(mChannel); - if (!channel) { + RefPtr httpChannel = do_QueryObject(mChannel); + if (!httpChannel) { *aPolicy = nsILoadInfo::OPENER_POLICY_NULL; return NS_OK; } - return channel->GetCrossOriginOpenerPolicy(aPolicy); + return httpChannel->GetCrossOriginOpenerPolicy(aPolicy); } } // namespace net