Bug 904559 - Veto redirect when target channel doesn't implement nsIParentRedirectingChannel. r=jduell

This commit is contained in:
Honza Bambas 2016-04-06 11:30:00 -04:00
Родитель e420e52db5
Коммит de1eeb4be3
1 изменённых файлов: 8 добавлений и 7 удалений

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

@ -166,6 +166,14 @@ HttpChannelParentListener::AsyncOnChannelRedirect(
{
nsresult rv;
nsCOMPtr<nsIParentRedirectingChannel> activeRedirectingChannel =
do_QueryInterface(mNextListener);
if (!activeRedirectingChannel) {
NS_ERROR("Channel got a redirect response, but doesn't implement "
"nsIParentRedirectingChannel to handle it.");
return NS_ERROR_NOT_IMPLEMENTED;
}
// Register the new channel and obtain id for it
nsCOMPtr<nsIRedirectChannelRegistrar> registrar =
do_GetService("@mozilla.org/redirectchannelregistrar;1", &rv);
@ -176,13 +184,6 @@ HttpChannelParentListener::AsyncOnChannelRedirect(
LOG(("Registered %p channel under id=%d", newChannel, mRedirectChannelId));
nsCOMPtr<nsIParentRedirectingChannel> activeRedirectingChannel =
do_QueryInterface(mNextListener);
if (!activeRedirectingChannel) {
NS_RUNTIMEABORT("Channel got a redirect response, but doesn't implement "
"nsIParentRedirectingChannel to handle it.");
}
return activeRedirectingChannel->StartRedirect(mRedirectChannelId,
newChannel,
redirectFlags,