Backed out changeset 07a3a86e82ee (bug 1871498) for causing multiple leakcheck failures CLOSED TREE
This commit is contained in:
@@ -256,13 +256,8 @@ void FetchService::FetchInstance::Cancel() {
|
||||
|
||||
FETCH_LOG(("FetchInstance::Cancel() [%p]", this));
|
||||
|
||||
// If mFetchDriver is not null here, FetchInstance::Fetch() has already
|
||||
// started, let mFetchDriver::RunAbortAlgorithm() to call
|
||||
// FetchInstance::OnResponseEnd() to resolve the pending promises.
|
||||
// Otherwise, resolving the pending promises here.
|
||||
if (mFetchDriver) {
|
||||
mFetchDriver->RunAbortAlgorithm();
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mPromises);
|
||||
@@ -299,28 +294,18 @@ void FetchService::FetchInstance::OnResponseEnd(
|
||||
|
||||
MOZ_ASSERT(mPromises);
|
||||
|
||||
if (aReason == eAborted) {
|
||||
// If ResponseAvailablePromise has not resolved yet, resolved with
|
||||
// NS_ERROR_DOM_ABORT_ERR response.
|
||||
if (!mPromises->GetResponseAvailablePromise()->IsResolved()) {
|
||||
mPromises->ResolveResponseAvailablePromise(
|
||||
InternalResponse::NetworkError(NS_ERROR_DOM_ABORT_ERR), __func__);
|
||||
}
|
||||
|
||||
// If ResponseTimingPromise has not resolved yet, resolved with empty
|
||||
// ResponseTiming.
|
||||
if (!mPromises->GetResponseTimingPromise()->IsResolved()) {
|
||||
mPromises->ResolveResponseTimingPromise(ResponseTiming(), __func__);
|
||||
}
|
||||
return;
|
||||
// If ResponseTimingPromise is not resolved, it means the fetch is aborted.
|
||||
// Resolving ResponseTimingPromise with an emtpy ResponseTiming.
|
||||
if (!mPromises->GetResponseTimingPromise()->IsResolved()) {
|
||||
mPromises->ResolveResponseTimingPromise(ResponseTiming(), __func__);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mPromises->GetResponseAvailablePromise()->IsResolved() &&
|
||||
mPromises->GetResponseTimingPromise()->IsResolved());
|
||||
|
||||
// Resolve the ResponseEndPromise
|
||||
mPromises->ResolveResponseEndPromise(ResponseEndArgs(aReason), __func__);
|
||||
|
||||
if (aReason == eAborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the FetchInstance from FetchInstanceTable
|
||||
RefPtr<FetchService> fetchService = FetchService::GetInstance();
|
||||
MOZ_ASSERT(fetchService);
|
||||
@@ -429,10 +414,7 @@ void FetchService::FetchInstance::OnReportPerformanceTiming() {
|
||||
UniquePtr<PerformanceTimingData> performanceTiming(
|
||||
mFetchDriver->GetPerformanceTimingData(timing.initiatorType(),
|
||||
timing.entryName()));
|
||||
// FetchDriver has no corresponding performance timing when fetch() failed.
|
||||
// Resolve the ResponseTimingPromise with empty timing.
|
||||
if (!performanceTiming) {
|
||||
mPromises->ResolveResponseTimingPromise(ResponseTiming(), __func__);
|
||||
return;
|
||||
}
|
||||
timing.timingData() = performanceTiming->ToIPC();
|
||||
|
||||
Reference in New Issue
Block a user