mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1871048 - Don't call OnDataFinished on main thread, r=jesup,necko-reviewers,valentin,sunil
Differential Revision: https://phabricator.services.mozilla.com/D197141
This commit is contained in:
parent
c05e35171b
commit
39bd8d1622
@ -816,6 +816,11 @@ void HttpChannelChild::DoOnDataAvailable(nsIRequest* aRequest,
|
||||
|
||||
void HttpChannelChild::SendOnDataFinished(const nsresult& aChannelStatus) {
|
||||
LOG(("HttpChannelChild::SendOnDataFinished [this=%p]\n", this));
|
||||
if (MOZ_UNLIKELY(NS_IsMainThread())) {
|
||||
MOZ_ASSERT(false, "SendOnDataFinished should not be called on main thread");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCanceled) return;
|
||||
|
||||
// we need to ensure we OnDataFinished only after all the progress
|
||||
@ -893,7 +898,8 @@ void HttpChannelChild::ProcessOnStopRequest(
|
||||
|
||||
RefPtr<RecordStopRequestDelta> timing;
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
if (StaticPrefs::network_send_OnDataFinished()) {
|
||||
if (StaticPrefs::network_send_OnDataFinished() &&
|
||||
mOMTResult == LABELS_HTTP_CHILD_OMT_STATS::success) {
|
||||
timing = new RecordStopRequestDelta;
|
||||
mEventQ->RunOrEnqueue(new ChannelFunctionEvent(
|
||||
[self = UnsafePtr<HttpChannelChild>(this)]() {
|
||||
@ -1166,7 +1172,8 @@ void HttpChannelChild::CollectOMTTelemetry() {
|
||||
nsAutoCString key(
|
||||
NS_CP_ContentTypeName(mLoadInfo->InternalContentPolicyType()));
|
||||
|
||||
Telemetry::AccumulateCategoricalKeyed(key, mOMTResult);
|
||||
Telemetry::AccumulateCategoricalKeyed(
|
||||
key, static_cast<LABELS_HTTP_CHILD_OMT_STATS>(mOMTResult));
|
||||
}
|
||||
|
||||
void HttpChannelChild::CollectMixedContentTelemetry() {
|
||||
|
@ -312,8 +312,8 @@ class HttpChannelChild final : public PHttpChannelChild,
|
||||
|
||||
// The result of RetargetDeliveryTo for this channel.
|
||||
// |notRequested| represents OMT is not requested by the channel owner.
|
||||
LABELS_HTTP_CHILD_OMT_STATS mOMTResult =
|
||||
LABELS_HTTP_CHILD_OMT_STATS::notRequested;
|
||||
Atomic<LABELS_HTTP_CHILD_OMT_STATS, mozilla::Relaxed> mOMTResult{
|
||||
LABELS_HTTP_CHILD_OMT_STATS::notRequested};
|
||||
|
||||
uint32_t mCacheKey{0};
|
||||
int32_t mCacheFetchCount{0};
|
||||
|
@ -619,14 +619,7 @@ nsIndexedToHTML::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInput,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIndexedToHTML::OnDataFinished(nsresult aStatus) {
|
||||
nsCOMPtr<nsIThreadRetargetableStreamListener> listener =
|
||||
do_QueryInterface(mListener);
|
||||
|
||||
if (listener) {
|
||||
return listener->OnDataFinished(aStatus);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
Reference in New Issue
Block a user