diff --git a/netwerk/protocol/data/nsDataChannel.cpp b/netwerk/protocol/data/nsDataChannel.cpp index eb49bfbede11..2b96cb08530e 100644 --- a/netwerk/protocol/data/nsDataChannel.cpp +++ b/netwerk/protocol/data/nsDataChannel.cpp @@ -82,7 +82,13 @@ nsresult nsDataChannel::OpenContentStream(bool async, nsIInputStream** result, if (lBase64) { nsAutoCString decodedData; rv = Base64Decode(data, decodedData); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_FAILED(rv)) { + // Returning this error code instead of what Base64Decode returns + // (NS_ERROR_ILLEGAL_VALUE) will prevent rendering of redirect response + // content by HTTP channels. It's also more logical error to return. + // Here we know the URL is actually corrupted. + return NS_ERROR_MALFORMED_URI; + } contentLen = decodedData.Length(); rv = NS_NewCStringInputStream(getter_AddRefs(bufInStream), decodedData); diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 242d585a71b4..8e07e43e0d4b 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -5617,6 +5617,7 @@ nsresult nsHttpChannel::ContinueProcessRedirection(nsresult rv) { } else { rv = mRedirectChannel->AsyncOpen(mListener, mListenerContext); } + LOG((" new channel AsyncOpen returned %" PRIX32, static_cast(rv))); NS_ENSURE_SUCCESS(rv, rv); // close down this channel