Bug 985135 - When owner is a null principal, propagate to replacement channel on redirect. r=bz

This commit is contained in:
Bob Owen 2014-05-28 15:04:04 +01:00
Родитель fe5e0f327b
Коммит 742337c540
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -15,6 +15,7 @@
#include "nsNetUtil.h"
#include "nsICachingChannel.h"
#include "nsIPrincipal.h"
#include "nsISeekableStream.h"
#include "nsITimedChannel.h"
#include "nsIEncodedChannel.h"
@ -1858,6 +1859,13 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
newChannel->SetNotificationCallbacks(mCallbacks);
newChannel->SetLoadFlags(newLoadFlags);
// If our owner is a null principal it will have been set as a security
// measure, so we want to propagate it to the new channel.
nsCOMPtr<nsIPrincipal> ownerPrincipal = do_QueryInterface(mOwner);
if (ownerPrincipal && ownerPrincipal->GetIsNullPrincipal()) {
newChannel->SetOwner(mOwner);
}
// Try to preserve the privacy bit if it has been overridden
if (mPrivateBrowsingOverriden) {
nsCOMPtr<nsIPrivateBrowsingChannel> newPBChannel =