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