From 8d8ddeb18457011561b99c5ec231e31e035ab595 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 3 Oct 2012 18:43:26 -0400 Subject: [PATCH] Bug 795571 - Update nsIChannel consumers concerned with privacy status to use the correct NS_UsePrivateBrowsing. r=ehsan --- content/base/src/nsContentUtils.cpp | 6 +----- image/src/imgLoader.cpp | 16 +++------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 781944ab661..33561108d0a 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -2695,11 +2695,7 @@ nsContentUtils::GetImgLoaderForDocument(nsIDocument* aDoc) } } else { nsCOMPtr channel = aDoc->GetChannel(); - if (channel) { - nsCOMPtr context; - NS_QueryNotificationCallbacks(channel, context); - isPrivate = context && context->UsePrivateBrowsing(); - } + isPrivate = channel && NS_UsePrivateBrowsing(channel); } return isPrivate ? sPrivateImgLoader : sImgLoader; } diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp index 2ef70cdc3f1..8286f65e45d 100644 --- a/image/src/imgLoader.cpp +++ b/image/src/imgLoader.cpp @@ -1559,9 +1559,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsCOMPtr channel = do_QueryInterface(aRequest); if (channel) { - nsCOMPtr loadContext; - NS_QueryNotificationCallbacks(channel, loadContext); - isPrivate = loadContext && loadContext->UsePrivateBrowsing(); + isPrivate = NS_UsePrivateBrowsing(channel); } else if (aLoadGroup) { nsCOMPtr callbacks; aLoadGroup->GetNotificationCallbacks(getter_AddRefs(callbacks)); @@ -1664,11 +1662,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, if (NS_FAILED(rv)) return NS_ERROR_FAILURE; -#ifdef DEBUG - nsCOMPtr loadContext; - NS_QueryNotificationCallbacks(newChannel, loadContext); - MOZ_ASSERT_IF(loadContext, loadContext->UsePrivateBrowsing() == mRespectPrivacy); -#endif + MOZ_ASSERT(NS_UsePrivateBrowsing(newChannel) == mRespectPrivacy); NewRequestAndEntry(forcePrincipalCheck, this, getter_AddRefs(request), getter_AddRefs(entry)); @@ -1795,11 +1789,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb { NS_ASSERTION(channel, "imgLoader::LoadImageWithChannel -- NULL channel pointer"); -#ifdef DEBUG - nsCOMPtr loadContext; - NS_QueryNotificationCallbacks(channel, loadContext); - MOZ_ASSERT_IF(loadContext, loadContext->UsePrivateBrowsing() == mRespectPrivacy); -#endif + MOZ_ASSERT(NS_UsePrivateBrowsing(channel) == mRespectPrivacy); nsRefPtr request;