From ab961aeb54335fd07c66de2e3b8c3b6af6f89ea2 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 3 Sep 2018 10:11:38 +0200 Subject: Remove all C++ Telemetry Accumulation calls. This creates a number of stubs and leaves some surrounding code that may be irrelevant (eg. recorded time stamps, status variables). Stub resolution/removal should be a follow-up to this. --- dom/fetch/Fetch.cpp | 5 ----- dom/fetch/FetchDriver.cpp | 3 --- 2 files changed, 8 deletions(-) (limited to 'dom/fetch') diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 5c05f3602..e2c139426 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -38,7 +38,6 @@ #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/URLSearchParams.h" #include "mozilla/dom/workers/ServiceWorkerManager.h" -#include "mozilla/Telemetry.h" #include "InternalRequest.h" #include "InternalResponse.h" @@ -237,8 +236,6 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput, } } - Telemetry::Accumulate(Telemetry::FETCH_IS_MAINTHREAD, 1); - RefPtr resolver = new MainThreadFetchResolver(p); RefPtr fetch = new FetchDriver(r, principal, loadGroup); fetch->SetDocument(doc); @@ -251,8 +248,6 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput, WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); MOZ_ASSERT(worker); - Telemetry::Accumulate(Telemetry::FETCH_IS_MAINTHREAD, 0); - if (worker->IsServiceWorker()) { r->SetSkipServiceWorker(); } diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index aac79b829..1791399b7 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -77,9 +77,6 @@ FetchDriver::Fetch(FetchDriverObserver* aObserver) mObserver = aObserver; - Telemetry::Accumulate(Telemetry::SERVICE_WORKER_REQUEST_PASSTHROUGH, - mRequest->WasCreatedByFetchEvent()); - // FIXME(nsm): Deal with HSTS. MOZ_RELEASE_ASSERT(!mRequest->IsSynchronous(), -- cgit v1.2.3 From b2cbc7b654d51543d9b5e75f0397bdc8c8b5fc5b Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 16 Sep 2018 10:26:02 +0200 Subject: Stop using the worker MainThreadTaskQueue from dom/fetch. --- dom/fetch/Fetch.cpp | 2 +- dom/fetch/FetchConsumer.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'dom/fetch') diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index e2c139426..f944352e3 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -260,7 +260,7 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput, } RefPtr run = new MainThreadFetchRunnable(resolver, r); - worker->DispatchToMainThread(run.forget()); + MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(run)); } return p.forget(); diff --git a/dom/fetch/FetchConsumer.cpp b/dom/fetch/FetchConsumer.cpp index 42dfcbaba..e82e5ec51 100644 --- a/dom/fetch/FetchConsumer.cpp +++ b/dom/fetch/FetchConsumer.cpp @@ -339,11 +339,7 @@ FetchBodyConsumer::Create(nsIGlobalObject* aGlobal, nsCOMPtr r = new BeginConsumeBodyRunnable(consumer); - if (workerPrivate) { - aRv = workerPrivate->DispatchToMainThread(r.forget()); - } else { - aRv = NS_DispatchToMainThread(r.forget()); - } + aRv = NS_DispatchToMainThread(r.forget()); if (NS_WARN_IF(aRv.Failed())) { return nullptr; @@ -655,9 +651,7 @@ FetchBodyConsumer::ShutDownMainThreadConsuming() nsCOMPtr r = NS_NewRunnableFunction( [self] () { self->ShutDownMainThreadConsuming(); }); - WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate(); - MOZ_ASSERT(workerPrivate); - workerPrivate->DispatchToMainThread(r.forget()); + MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r.forget())); return; } -- cgit v1.2.3 From b00b0763776f9ae47b1843d025ecb50c4b997bca Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 Mar 2019 13:05:13 +0100 Subject: Remove various hard-coded Accept: headers Since we're now handling this in the network back-end, there's no need for this anymore. Tag #993. --- dom/fetch/FetchDriver.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'dom/fetch') diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index 1791399b7..6294b0dc5 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -903,11 +903,7 @@ FetchDriver::SetRequestHeaders(nsIHttpChannel* aChannel) const AutoTArray headers; mRequest->Headers()->GetEntries(headers); - bool hasAccept = false; for (uint32_t i = 0; i < headers.Length(); ++i) { - if (!hasAccept && headers[i].mName.EqualsLiteral("accept")) { - hasAccept = true; - } if (headers[i].mValue.IsEmpty()) { aChannel->SetEmptyRequestHeader(headers[i].mName); } else { @@ -915,12 +911,6 @@ FetchDriver::SetRequestHeaders(nsIHttpChannel* aChannel) const } } - if (!hasAccept) { - aChannel->SetRequestHeader(NS_LITERAL_CSTRING("accept"), - NS_LITERAL_CSTRING("*/*"), - false /* merge */); - } - if (mRequest->ForceOriginHeader()) { nsAutoString origin; if (NS_SUCCEEDED(nsContentUtils::GetUTFOrigin(mPrincipal, origin))) { -- cgit v1.2.3 From 5a10462a92197769cc7af04287c6315fa8961dcd Mon Sep 17 00:00:00 2001 From: JustOff Date: Wed, 13 Mar 2019 18:46:01 +0200 Subject: Change the MozMap API and data storage to more what we want record<> to look like --- dom/fetch/InternalHeaders.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'dom/fetch') diff --git a/dom/fetch/InternalHeaders.cpp b/dom/fetch/InternalHeaders.cpp index 11585615e..83a686785 100644 --- a/dom/fetch/InternalHeaders.cpp +++ b/dom/fetch/InternalHeaders.cpp @@ -316,10 +316,11 @@ InternalHeaders::Fill(const Sequence>& aInit, ErrorResult& a void InternalHeaders::Fill(const MozMap& aInit, ErrorResult& aRv) { - nsTArray keys; - aInit.GetKeys(keys); - for (uint32_t i = 0; i < keys.Length() && !aRv.Failed(); ++i) { - Append(NS_ConvertUTF16toUTF8(keys[i]), aInit.Get(keys[i]), aRv); + for (auto& entry : aInit.Entries()) { + Append(NS_ConvertUTF16toUTF8(entry.mKey), entry.mValue, aRv); + if (aRv.Failed()) { + return; + } } } -- cgit v1.2.3 From 5890367d30702ff8f2fbb6fc28e6ecdd6d5b2b84 Mon Sep 17 00:00:00 2001 From: JustOff Date: Wed, 13 Mar 2019 19:37:03 +0200 Subject: Rename "MozMap" to "record" in our IDL parser and IDL files --- dom/fetch/Headers.cpp | 14 +++++++------- dom/fetch/Headers.h | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'dom/fetch') diff --git a/dom/fetch/Headers.cpp b/dom/fetch/Headers.cpp index 1e1a46c62..ca5aa57a6 100644 --- a/dom/fetch/Headers.cpp +++ b/dom/fetch/Headers.cpp @@ -25,7 +25,7 @@ NS_INTERFACE_MAP_END // static already_AddRefed Headers::Constructor(const GlobalObject& aGlobal, - const Optional& aInit, + const Optional& aInit, ErrorResult& aRv) { RefPtr ih = new InternalHeaders(); @@ -39,8 +39,8 @@ Headers::Constructor(const GlobalObject& aGlobal, ih->Fill(*aInit.Value().GetAsHeaders().mInternalHeaders, aRv); } else if (aInit.Value().IsByteStringSequenceSequence()) { ih->Fill(aInit.Value().GetAsByteStringSequenceSequence(), aRv); - } else if (aInit.Value().IsByteStringMozMap()) { - ih->Fill(aInit.Value().GetAsByteStringMozMap(), aRv); + } else if (aInit.Value().IsByteStringByteStringRecord()) { + ih->Fill(aInit.Value().GetAsByteStringByteStringRecord(), aRv); } if (aRv.Failed()) { @@ -53,7 +53,7 @@ Headers::Constructor(const GlobalObject& aGlobal, // static already_AddRefed Headers::Constructor(const GlobalObject& aGlobal, - const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, + const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit, ErrorResult& aRv) { nsCOMPtr global = do_QueryInterface(aGlobal.GetAsSupports()); @@ -62,7 +62,7 @@ Headers::Constructor(const GlobalObject& aGlobal, /* static */ already_AddRefed Headers::Create(nsIGlobalObject* aGlobal, - const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, + const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit, ErrorResult& aRv) { RefPtr ih = new InternalHeaders(); @@ -72,8 +72,8 @@ Headers::Create(nsIGlobalObject* aGlobal, ih->Fill(*(aInit.GetAsHeaders().get()->mInternalHeaders), aRv); } else if (aInit.IsByteStringSequenceSequence()) { ih->Fill(aInit.GetAsByteStringSequenceSequence(), aRv); - } else if (aInit.IsByteStringMozMap()) { - ih->Fill(aInit.GetAsByteStringMozMap(), aRv); + } else if (aInit.IsByteStringByteStringRecord()) { + ih->Fill(aInit.GetAsByteStringByteStringRecord(), aRv); } if (NS_WARN_IF(aRv.Failed())) { diff --git a/dom/fetch/Headers.h b/dom/fetch/Headers.h index b603dc836..38b0fc68f 100644 --- a/dom/fetch/Headers.h +++ b/dom/fetch/Headers.h @@ -21,8 +21,8 @@ class ErrorResult; namespace dom { template class MozMap; -class HeadersOrByteStringSequenceSequenceOrByteStringMozMap; -class OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap; +class HeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord; +class OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord; /** * This Headers class is only used to represent the content facing Headers @@ -57,17 +57,17 @@ public: static already_AddRefed Constructor(const GlobalObject& aGlobal, - const Optional& aInit, + const Optional& aInit, ErrorResult& aRv); static already_AddRefed Constructor(const GlobalObject& aGlobal, - const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, + const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit, ErrorResult& aRv); static already_AddRefed Create(nsIGlobalObject* aGlobalObject, - const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, + const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit, ErrorResult& aRv); void Append(const nsACString& aName, const nsACString& aValue, -- cgit v1.2.3 From b586a191ec085d2c6c5c4fdfb1b12102fb5de4c4 Mon Sep 17 00:00:00 2001 From: JustOff Date: Wed, 13 Mar 2019 20:04:13 +0200 Subject: Rename the MozMap C++ type to "record" and give it a template parameter for the key type --- dom/fetch/Headers.h | 2 +- dom/fetch/InternalHeaders.cpp | 2 +- dom/fetch/InternalHeaders.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'dom/fetch') diff --git a/dom/fetch/Headers.h b/dom/fetch/Headers.h index 38b0fc68f..1dd92f779 100644 --- a/dom/fetch/Headers.h +++ b/dom/fetch/Headers.h @@ -20,7 +20,7 @@ class ErrorResult; namespace dom { -template class MozMap; +template class Record; class HeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord; class OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord; diff --git a/dom/fetch/InternalHeaders.cpp b/dom/fetch/InternalHeaders.cpp index 83a686785..7bf5703dc 100644 --- a/dom/fetch/InternalHeaders.cpp +++ b/dom/fetch/InternalHeaders.cpp @@ -314,7 +314,7 @@ InternalHeaders::Fill(const Sequence>& aInit, ErrorResult& a } void -InternalHeaders::Fill(const MozMap& aInit, ErrorResult& aRv) +InternalHeaders::Fill(const Record& aInit, ErrorResult& aRv) { for (auto& entry : aInit.Entries()) { Append(NS_ConvertUTF16toUTF8(entry.mKey), entry.mValue, aRv); diff --git a/dom/fetch/InternalHeaders.h b/dom/fetch/InternalHeaders.h index 9a6d6dae7..98046f0ef 100644 --- a/dom/fetch/InternalHeaders.h +++ b/dom/fetch/InternalHeaders.h @@ -20,7 +20,7 @@ class ErrorResult; namespace dom { -template class MozMap; +template class Record; class HeadersEntry; class InternalHeaders final @@ -113,7 +113,7 @@ public: void Fill(const InternalHeaders& aInit, ErrorResult& aRv); void Fill(const Sequence>& aInit, ErrorResult& aRv); - void Fill(const MozMap& aInit, ErrorResult& aRv); + void Fill(const Record& aInit, ErrorResult& aRv); bool HasOnlySimpleHeaders() const; -- cgit v1.2.3 From e7c9fa3e1505aeb90385e0a4e90fe5e0b137d4ab Mon Sep 17 00:00:00 2001 From: JustOff Date: Wed, 13 Mar 2019 20:17:36 +0200 Subject: Actually change the key type of a record, and its corresponding conversion behavior, depending on what the IDL says --- dom/fetch/InternalHeaders.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dom/fetch') diff --git a/dom/fetch/InternalHeaders.cpp b/dom/fetch/InternalHeaders.cpp index 7bf5703dc..f66221d42 100644 --- a/dom/fetch/InternalHeaders.cpp +++ b/dom/fetch/InternalHeaders.cpp @@ -317,7 +317,7 @@ void InternalHeaders::Fill(const Record& aInit, ErrorResult& aRv) { for (auto& entry : aInit.Entries()) { - Append(NS_ConvertUTF16toUTF8(entry.mKey), entry.mValue, aRv); + Append(entry.mKey, entry.mValue, aRv); if (aRv.Failed()) { return; } -- cgit v1.2.3