Bug 1638313 - Let devtool show CORS rejected requests correctly, r=necko-reviewers,mayhemer

Differential Revision: https://phabricator.services.mozilla.com/D76255
This commit is contained in:
Junior Hsu 2020-05-21 22:41:44 +00:00
Родитель c452d01a0d
Коммит 6ff998ce0c
4 изменённых файлов: 16 добавлений и 8 удалений

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

@ -2280,7 +2280,7 @@ HttpChannelChild::Cancel(nsresult aStatus) {
mCanceled = true;
mStatus = aStatus;
if (RemoteChannelExists()) {
SendCancel(aStatus);
SendCancel(aStatus, mLoadInfo->GetRequestBlockingReason());
}
// If the channel is intercepted and already pumping, then just

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

@ -807,13 +807,20 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvResume() {
return IPC_OK();
}
mozilla::ipc::IPCResult HttpChannelParent::RecvCancel(const nsresult& status) {
mozilla::ipc::IPCResult HttpChannelParent::RecvCancel(
const nsresult& status, const uint32_t& requestBlockingReason) {
LOG(("HttpChannelParent::RecvCancel [this=%p]\n", this));
// May receive cancel before channel has been constructed!
if (mChannel) {
mChannel->Cancel(status);
if (MOZ_UNLIKELY(requestBlockingReason !=
nsILoadInfo::BLOCKING_REASON_NONE)) {
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->LoadInfo();
loadInfo->SetRequestBlockingReason(requestBlockingReason);
}
// Once we receive |Cancel|, child will stop sending RecvBytesRead. Force
// the channel resumed if needed.
if (mSuspendedForFlowControl) {
@ -939,11 +946,11 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
// load info, so we must carry iver the change.
// The channel may have already been cleaned up, so there is nothing we can
// do.
if (MOZ_UNLIKELY(aSourceRequestBlockingReason) && mChannel) {
if (MOZ_UNLIKELY(aSourceRequestBlockingReason !=
nsILoadInfo::BLOCKING_REASON_NONE) &&
mChannel) {
nsCOMPtr<nsILoadInfo> sourceLoadInfo = mChannel->LoadInfo();
if (sourceLoadInfo) {
sourceLoadInfo->SetRequestBlockingReason(aSourceRequestBlockingReason);
}
sourceLoadInfo->SetRequestBlockingReason(aSourceRequestBlockingReason);
}
// Continue the verification procedure if child has veto the redirection.

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

@ -187,7 +187,8 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
const nsCString& charset) override;
virtual mozilla::ipc::IPCResult RecvSuspend() override;
virtual mozilla::ipc::IPCResult RecvResume() override;
virtual mozilla::ipc::IPCResult RecvCancel(const nsresult& status) override;
virtual mozilla::ipc::IPCResult RecvCancel(
const nsresult& status, const uint32_t& requestBlockingReason) override;
virtual mozilla::ipc::IPCResult RecvRedirect2Verify(
const nsresult& result, const RequestHeaderTuples& changedHeaders,
const uint32_t& aSourceRequestBlockingReason,

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

@ -40,7 +40,7 @@ parent:
async Suspend();
async Resume();
async Cancel(nsresult status);
async Cancel(nsresult status, uint32_t requestBlockingReason);
// Reports approval/veto of redirect by child process redirect observers
async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,