From a71fd85f7d33700ba4ccf04ef3e2d69158871e7b Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Mon, 13 Feb 2017 13:57:39 -0500 Subject: [PATCH] Bug 1339153 - Part 1: Correctly emulate missing headers in nsViewSourceChannel::GetResponseHeader, r=bz MozReview-Commit-ID: 34bCA7wKkmh --- netwerk/protocol/viewsource/nsViewSourceChannel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp index e8b1f720bd50..91d753d72854 100644 --- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp +++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp @@ -907,7 +907,11 @@ nsViewSourceChannel::GetResponseHeader(const nsACString & aHeader, nsCaseInsensitiveCStringComparator()) && !aHeader.Equals(NS_LITERAL_CSTRING("X-Frame-Options"), nsCaseInsensitiveCStringComparator())) { - return NS_OK; + // We simulate the NS_ERROR_NOT_AVAILABLE error which is produced by + // GetResponseHeader via nsHttpHeaderArray::GetHeader when the entry is + // not present, such that it appears as though no headers except for the + // whitelisted ones were set on this channel. + return NS_ERROR_NOT_AVAILABLE; } return mHttpChannel->GetResponseHeader(aHeader, aValue);