Bug 1667316 - Pass nsresult status to OnRedirectResult r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140569
This commit is contained in:
@@ -64,5 +64,5 @@ interface nsIParentRedirectingChannel : nsIParentChannel
|
|||||||
* Primarilly used by HttpChannelParent::OnRedirectResult and kept as
|
* Primarilly used by HttpChannelParent::OnRedirectResult and kept as
|
||||||
* mActiveChannel and mRedirectChannel in that class.
|
* mActiveChannel and mRedirectChannel in that class.
|
||||||
*/
|
*/
|
||||||
void completeRedirect(in boolean succeeded);
|
void completeRedirect(in nsresult succeeded);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,5 +18,5 @@ interface nsIRedirectResultListener : nsISupports
|
|||||||
* Indicated whether the redirect will be proceeding, or not (i.e.
|
* Indicated whether the redirect will be proceeding, or not (i.e.
|
||||||
* has been canceled, or failed).
|
* has been canceled, or failed).
|
||||||
*/
|
*/
|
||||||
void onRedirectResult(in boolean proceeding);
|
void onRedirectResult(in nsresult status);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -357,8 +357,8 @@ EarlyHintPreloader::AsyncOnChannelRedirect(
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
EarlyHintPreloader::OnRedirectResult(bool aProceeding) {
|
EarlyHintPreloader::OnRedirectResult(nsresult aStatus) {
|
||||||
if (aProceeding && mRedirectChannel) {
|
if (NS_SUCCEEDED(aStatus) && mRedirectChannel) {
|
||||||
mChannel = mRedirectChannel;
|
mChannel = mRedirectChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1529,7 +1529,7 @@ void HttpChannelChild::Redirect3Complete() {
|
|||||||
nsCOMPtr<nsIRedirectResultListener> vetoHook;
|
nsCOMPtr<nsIRedirectResultListener> vetoHook;
|
||||||
GetCallback(vetoHook);
|
GetCallback(vetoHook);
|
||||||
if (vetoHook) {
|
if (vetoHook) {
|
||||||
vetoHook->OnRedirectResult(true);
|
vetoHook->OnRedirectResult(NS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chrome channel has been AsyncOpen'd. Reflect this in child.
|
// Chrome channel has been AsyncOpen'd. Reflect this in child.
|
||||||
|
|||||||
@@ -1795,9 +1795,9 @@ HttpChannelParent::StartRedirect(nsIChannel* newChannel, uint32_t redirectFlags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
HttpChannelParent::CompleteRedirect(bool succeeded) {
|
HttpChannelParent::CompleteRedirect(nsresult status) {
|
||||||
LOG(("HttpChannelParent::CompleteRedirect [this=%p succeeded=%d]\n", this,
|
LOG(("HttpChannelParent::CompleteRedirect [this=%p status=0x%X]\n", this,
|
||||||
succeeded));
|
static_cast<uint32_t>(status)));
|
||||||
|
|
||||||
// If this was an internal redirect for a service worker interception then
|
// If this was an internal redirect for a service worker interception then
|
||||||
// we will not have a redirecting channel here. Hide this redirect from
|
// we will not have a redirecting channel here. Hide this redirect from
|
||||||
@@ -1806,7 +1806,7 @@ HttpChannelParent::CompleteRedirect(bool succeeded) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (succeeded && !mIPCClosed) {
|
if (NS_SUCCEEDED(status) && !mIPCClosed) {
|
||||||
// TODO: check return value: assume child dead if failed
|
// TODO: check return value: assume child dead if failed
|
||||||
Unused << SendRedirect3Complete();
|
Unused << SendRedirect3Complete();
|
||||||
}
|
}
|
||||||
@@ -1935,11 +1935,11 @@ HttpChannelParent::AsyncOnChannelRedirect(
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
HttpChannelParent::OnRedirectResult(bool succeeded) {
|
HttpChannelParent::OnRedirectResult(nsresult status) {
|
||||||
LOG(("HttpChannelParent::OnRedirectResult [this=%p, suc=%d]", this,
|
LOG(("HttpChannelParent::OnRedirectResult [this=%p, status=0x%X]", this,
|
||||||
succeeded));
|
static_cast<uint32_t>(status)));
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsIParentChannel> redirectChannel;
|
nsCOMPtr<nsIParentChannel> redirectChannel;
|
||||||
if (mRedirectChannelId) {
|
if (mRedirectChannelId) {
|
||||||
@@ -1972,12 +1972,16 @@ HttpChannelParent::OnRedirectResult(bool succeeded) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!redirectChannel) {
|
if (!redirectChannel) {
|
||||||
succeeded = false;
|
if (NS_FAILED(rv)) {
|
||||||
|
status = rv;
|
||||||
|
} else {
|
||||||
|
status = NS_ERROR_NULL_POINTER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CompleteRedirect(succeeded);
|
CompleteRedirect(status);
|
||||||
|
|
||||||
if (succeeded) {
|
if (NS_SUCCEEDED(status)) {
|
||||||
if (!SameCOMIdentity(redirectChannel,
|
if (!SameCOMIdentity(redirectChannel,
|
||||||
static_cast<nsIParentRedirectingChannel*>(this))) {
|
static_cast<nsIParentRedirectingChannel*>(this))) {
|
||||||
Delete();
|
Delete();
|
||||||
|
|||||||
@@ -1041,7 +1041,7 @@ InterceptedHttpChannel::OnRedirectVerifyCallback(nsresult rv) {
|
|||||||
nsCOMPtr<nsIRedirectResultListener> hook;
|
nsCOMPtr<nsIRedirectResultListener> hook;
|
||||||
GetCallback(hook);
|
GetCallback(hook);
|
||||||
if (hook) {
|
if (hook) {
|
||||||
hook->OnRedirectResult(NS_SUCCEEDED(rv));
|
hook->OnRedirectResult(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ void AutoRedirectVetoNotifier::ReportRedirectResult(nsresult aRv) {
|
|||||||
nsHttpChannel* channel = mChannel;
|
nsHttpChannel* channel = mChannel;
|
||||||
mChannel = nullptr;
|
mChannel = nullptr;
|
||||||
|
|
||||||
if (vetoHook) vetoHook->OnRedirectResult(NS_SUCCEEDED(aRv));
|
if (vetoHook) vetoHook->OnRedirectResult(aRv);
|
||||||
|
|
||||||
// Drop after the notification
|
// Drop after the notification
|
||||||
channel->StoreHasAutoRedirectVetoNotifier(false);
|
channel->StoreHasAutoRedirectVetoNotifier(false);
|
||||||
|
|||||||
@@ -475,8 +475,8 @@ WebTransportSessionProxy::AsyncOnChannelRedirect(
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
WebTransportSessionProxy::OnRedirectResult(bool aProceeding) {
|
WebTransportSessionProxy::OnRedirectResult(nsresult aStatus) {
|
||||||
if (aProceeding && mRedirectChannel) {
|
if (NS_SUCCEEDED(aStatus) && mRedirectChannel) {
|
||||||
mChannel = mRedirectChannel;
|
mChannel = mRedirectChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -307,8 +307,8 @@ nsPrefetchNode::AsyncOnChannelRedirect(
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsPrefetchNode::OnRedirectResult(bool proceeding) {
|
nsPrefetchNode::OnRedirectResult(nsresult status) {
|
||||||
if (proceeding && mRedirectChannel) mChannel = mRedirectChannel;
|
if (NS_SUCCEEDED(status) && mRedirectChannel) mChannel = mRedirectChannel;
|
||||||
|
|
||||||
mRedirectChannel = nullptr;
|
mRedirectChannel = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ NS_IMETHODIMP PreloaderBase::RedirectSink::AsyncOnChannelRedirect(
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP PreloaderBase::RedirectSink::OnRedirectResult(bool proceeding) {
|
NS_IMETHODIMP PreloaderBase::RedirectSink::OnRedirectResult(nsresult status) {
|
||||||
if (proceeding && mRedirectChannel) {
|
if (NS_SUCCEEDED(status) && mRedirectChannel) {
|
||||||
mPreloader->mChannel = std::move(mRedirectChannel);
|
mPreloader->mChannel = std::move(mRedirectChannel);
|
||||||
} else {
|
} else {
|
||||||
mRedirectChannel = nullptr;
|
mRedirectChannel = nullptr;
|
||||||
@@ -89,7 +89,7 @@ NS_IMETHODIMP PreloaderBase::RedirectSink::OnRedirectResult(bool proceeding) {
|
|||||||
if (mCallbacks) {
|
if (mCallbacks) {
|
||||||
nsCOMPtr<nsIRedirectResultListener> sink(do_GetInterface(mCallbacks));
|
nsCOMPtr<nsIRedirectResultListener> sink(do_GetInterface(mCallbacks));
|
||||||
if (sink) {
|
if (sink) {
|
||||||
return sink->OnRedirectResult(proceeding);
|
return sink->OnRedirectResult(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user