From 5335681cd2ab05ad47e81be7722c9eee19d54065 Mon Sep 17 00:00:00 2001 From: adeshkp Date: Sat, 12 Jan 2019 06:20:31 -0500 Subject: Telemetry: Remove stubs and related code --- netwerk/base/BackgroundFileSaver.cpp | 13 ---- netwerk/base/BackgroundFileSaver.h | 9 --- netwerk/base/nsIOService.cpp | 14 ---- netwerk/base/nsIOService.h | 13 ---- netwerk/base/nsLoadGroup.cpp | 94 ------------------------- netwerk/base/nsLoadGroup.h | 11 --- netwerk/base/nsSocketTransport2.cpp | 90 ++---------------------- netwerk/base/nsSocketTransport2.h | 9 +-- netwerk/base/nsSocketTransportService2.cpp | 68 ++----------------- netwerk/base/nsSocketTransportService2.h | 17 +---- netwerk/base/nsUDPSocket.cpp | 11 --- netwerk/base/nsUDPSocket.h | 2 - netwerk/cache2/CacheStorageService.cpp | 98 --------------------------- netwerk/cache2/CacheStorageService.h | 12 ---- netwerk/cookie/nsCookieService.cpp | 20 ------ netwerk/cookie/nsCookieService.h | 1 - netwerk/dns/nsHostResolver.cpp | 2 - netwerk/protocol/http/Http2Stream.cpp | 10 +-- netwerk/protocol/http/HttpBaseChannel.cpp | 10 --- netwerk/protocol/http/nsHttpChannel.cpp | 55 --------------- netwerk/protocol/http/nsHttpChannel.h | 3 - netwerk/protocol/http/nsHttpConnectionMgr.cpp | 48 ------------- netwerk/protocol/http/nsHttpConnectionMgr.h | 1 - netwerk/protocol/http/nsHttpHandler.cpp | 16 ----- netwerk/protocol/http/nsHttpHandler.h | 6 +- 25 files changed, 17 insertions(+), 616 deletions(-) (limited to 'netwerk') diff --git a/netwerk/base/BackgroundFileSaver.cpp b/netwerk/base/BackgroundFileSaver.cpp index cfe94e35b..b338c2a08 100644 --- a/netwerk/base/BackgroundFileSaver.cpp +++ b/netwerk/base/BackgroundFileSaver.cpp @@ -9,7 +9,6 @@ #include "ScopedNSSTypes.h" #include "mozilla/Casting.h" #include "mozilla/Logging.h" -#include "mozilla/Telemetry.h" #include "nsCOMArray.h" #include "nsIAsyncInputStream.h" #include "nsIFile.h" @@ -85,7 +84,6 @@ private: //// BackgroundFileSaver uint32_t BackgroundFileSaver::sThreadCount = 0; -uint32_t BackgroundFileSaver::sTelemetryMaxThreadCount = 0; BackgroundFileSaver::BackgroundFileSaver() : mControlThread(nullptr) @@ -156,9 +154,6 @@ BackgroundFileSaver::Init() NS_ENSURE_SUCCESS(rv, rv); sThreadCount++; - if (sThreadCount > sTelemetryMaxThreadCount) { - sTelemetryMaxThreadCount = sThreadCount; - } return NS_OK; } @@ -793,14 +788,6 @@ BackgroundFileSaver::NotifySaveComplete() sThreadCount--; - // When there are no more active downloads, we consider the download session - // finished. We record the maximum number of concurrent downloads reached - // during the session in a telemetry histogram, and we reset the maximum - // thread counter for the next download session - if (sThreadCount == 0) { - sTelemetryMaxThreadCount = 0; - } - return NS_OK; } diff --git a/netwerk/base/BackgroundFileSaver.h b/netwerk/base/BackgroundFileSaver.h index 1fa9268f8..86d3a1ba7 100644 --- a/netwerk/base/BackgroundFileSaver.h +++ b/netwerk/base/BackgroundFileSaver.h @@ -61,15 +61,6 @@ public: */ static uint32_t sThreadCount; - /** - * Maximum number of worker threads reached during the current download session, - * used for telemetry. - * - * When there are no more worker threads running, we consider the download - * session finished, and this counter is reset. - */ - static uint32_t sTelemetryMaxThreadCount; - protected: virtual ~BackgroundFileSaver(); diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 435294315..e0dc7d8e8 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -48,7 +48,6 @@ #include "mozilla/LoadInfo.h" #include "mozilla/net/NeckoCommon.h" #include "mozilla/Services.h" -#include "mozilla/Telemetry.h" #include "mozilla/net/DNS.h" #include "mozilla/ipc/URIUtils.h" #include "mozilla/net/NeckoChild.h" @@ -166,8 +165,6 @@ static const char kProfileDoChange[] = "profile-do-change"; uint32_t nsIOService::gDefaultSegmentSize = 4096; uint32_t nsIOService::gDefaultSegmentCount = 24; -bool nsIOService::sTelemetryEnabled = false; - bool nsIOService::sBlockToplevelDataUriNavigations = false; //////////////////////////////////////////////////////////////////////////////// @@ -185,9 +182,6 @@ nsIOService::nsIOService() , mNetworkLinkServiceInitialized(false) , mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY) , mNetworkNotifyChanged(true) - , mLastOfflineStateChange(PR_IntervalNow()) - , mLastConnectivityChange(PR_IntervalNow()) - , mLastNetworkLinkChange(PR_IntervalNow()) , mNetTearingDownStarted(0) { } @@ -247,7 +241,6 @@ nsIOService::Init() else NS_WARNING("failed to get observer service"); - Preferences::AddBoolVarCache(&sTelemetryEnabled, "toolkit.telemetry.enabled", false); Preferences::AddBoolVarCache(&sBlockToplevelDataUriNavigations, "security.data_uri.block_toplevel_data_uri_navigations", false); Preferences::AddBoolVarCache(&mOfflineMirrorsConnectivity, OFFLINE_MIRRORS_CONNECTIVITY, true); @@ -1068,7 +1061,6 @@ nsIOService::SetOffline(bool offline) if (mSocketTransportService) mSocketTransportService->SetOffline(true); - mLastOfflineStateChange = PR_IntervalNow(); if (observerService) observerService->NotifyObservers(subject, NS_IOSERVICE_OFFLINE_STATUS_TOPIC, @@ -1088,7 +1080,6 @@ nsIOService::SetOffline(bool offline) if (mProxyService) mProxyService->ReloadPAC(); - mLastOfflineStateChange = PR_IntervalNow(); // don't care if notification fails // Only send the ONLINE notification if there is connectivity if (observerService && mConnectivity) { @@ -1147,10 +1138,6 @@ nsIOService::SetConnectivityInternal(bool aConnectivity) } mConnectivity = aConnectivity; - // This is used for PR_Connect PR_Close telemetry so it is important that - // we have statistic about network change event even if we are offline. - mLastConnectivityChange = PR_IntervalNow(); - if (mCaptivePortalService) { if (aConnectivity && !xpc::AreNonLocalConnectionsDisabled()) { // This will also trigger a captive portal check for the new network @@ -1621,7 +1608,6 @@ nsIOService::OnNetworkLinkEvent(const char *data) bool isUp = true; if (!strcmp(data, NS_NETWORK_LINK_DATA_CHANGED)) { - mLastNetworkLinkChange = PR_IntervalNow(); // CHANGED means UP/DOWN didn't change // but the status of the captive portal may have changed. RecheckCaptivePortal(); diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h index e592c4d1c..19eed743a 100644 --- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -79,9 +79,6 @@ public: nsAsyncRedirectVerifyHelper *helper); bool IsOffline() { return mOffline; } - PRIntervalTime LastOfflineStateChange() { return mLastOfflineStateChange; } - PRIntervalTime LastConnectivityChange() { return mLastConnectivityChange; } - PRIntervalTime LastNetworkLinkChange() { return mLastNetworkLinkChange; } bool IsNetTearingDown() { return mShutdown || mOfflineForProfileChange || mHttpHandlerAlreadyShutingDown; } PRIntervalTime NetTearingDownStarted() { return mNetTearingDownStarted; } @@ -176,18 +173,8 @@ private: bool mNetworkNotifyChanged; - static bool sTelemetryEnabled; - static bool sBlockToplevelDataUriNavigations; - // These timestamps are needed for collecting telemetry on PR_Connect, - // PR_ConnectContinue and PR_Close blocking time. If we spend very long - // time in any of these functions we want to know if and what network - // change has happened shortly before. - mozilla::Atomic mLastOfflineStateChange; - mozilla::Atomic mLastConnectivityChange; - mozilla::Atomic mLastNetworkLinkChange; - // Time a network tearing down started. mozilla::Atomic mNetTearingDownStarted; public: diff --git a/netwerk/base/nsLoadGroup.cpp b/netwerk/base/nsLoadGroup.cpp index 9981bd698..48d9a6621 100644 --- a/netwerk/base/nsLoadGroup.cpp +++ b/netwerk/base/nsLoadGroup.cpp @@ -108,9 +108,6 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer) , mStatus(NS_OK) , mPriority(PRIORITY_NORMAL) , mIsCanceling(false) - , mDefaultLoadIsTimed(false) - , mTimedRequests(0) - , mCachedRequests(0) , mTimedNonCachedRequestsUntilOnEndPageLoad(0) { NS_INIT_AGGREGATED(outer); @@ -431,13 +428,6 @@ nsLoadGroup::SetDefaultLoadRequest(nsIRequest *aRequest) // in particular, nsIChannel::LOAD_DOCUMENT_URI... // mLoadFlags &= nsIRequest::LOAD_REQUESTMASK; - - nsCOMPtr timedChannel = do_QueryInterface(aRequest); - mDefaultLoadIsTimed = timedChannel != nullptr; - if (mDefaultLoadIsTimed) { - timedChannel->GetChannelCreation(&mDefaultRequestCreationTime); - timedChannel->SetTimingEnabled(true); - } } // Else, do not change the group's load flags (see bug 95981) return NS_OK; @@ -492,10 +482,6 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt) if (mPriority != 0) RescheduleRequest(request, mPriority); - nsCOMPtr timedChannel = do_QueryInterface(request); - if (timedChannel) - timedChannel->SetTimingEnabled(true); - if (!(flags & nsIRequest::LOAD_BACKGROUND)) { // Update the count of foreground URIs.. mForegroundCount += 1; @@ -573,10 +559,6 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt, mRequests.RemoveEntry(entry); - if (mRequests.EntryCount() == 0) { - TelemetryReport(); - } - // Undo any group priority delta... if (mPriority != 0) RescheduleRequest(request, -mPriority); @@ -777,82 +759,6 @@ nsLoadGroup::SetDefaultLoadFlags(uint32_t aFlags) //////////////////////////////////////////////////////////////////////////////// -void -nsLoadGroup::TelemetryReport() -{ - /* STUB */ - mTimedRequests = 0; - mCachedRequests = 0; - mDefaultLoadIsTimed = false; -} - -void -nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel, - bool aDefaultRequest) -{ - nsresult rv; - bool timingEnabled; - rv = aTimedChannel->GetTimingEnabled(&timingEnabled); - if (NS_FAILED(rv) || !timingEnabled) - return; - - TimeStamp asyncOpen; - rv = aTimedChannel->GetAsyncOpen(&asyncOpen); - // We do not check !asyncOpen.IsNull() bellow, prevent ASSERTIONs this way - if (NS_FAILED(rv) || asyncOpen.IsNull()) - return; - - TimeStamp cacheReadStart; - rv = aTimedChannel->GetCacheReadStart(&cacheReadStart); - if (NS_FAILED(rv)) - return; - - TimeStamp cacheReadEnd; - rv = aTimedChannel->GetCacheReadEnd(&cacheReadEnd); - if (NS_FAILED(rv)) - return; - - TimeStamp domainLookupStart; - rv = aTimedChannel->GetDomainLookupStart(&domainLookupStart); - if (NS_FAILED(rv)) - return; - - TimeStamp domainLookupEnd; - rv = aTimedChannel->GetDomainLookupEnd(&domainLookupEnd); - if (NS_FAILED(rv)) - return; - - TimeStamp connectStart; - rv = aTimedChannel->GetConnectStart(&connectStart); - if (NS_FAILED(rv)) - return; - - TimeStamp secureConnectionStart; - rv = aTimedChannel->GetSecureConnectionStart(&secureConnectionStart); - if (NS_FAILED(rv)) - return; - - TimeStamp connectEnd; - rv = aTimedChannel->GetConnectEnd(&connectEnd); - if (NS_FAILED(rv)) - return; - - TimeStamp requestStart; - rv = aTimedChannel->GetRequestStart(&requestStart); - if (NS_FAILED(rv)) - return; - - TimeStamp responseStart; - rv = aTimedChannel->GetResponseStart(&responseStart); - if (NS_FAILED(rv)) - return; - - TimeStamp responseEnd; - rv = aTimedChannel->GetResponseEnd(&responseEnd); - if (NS_FAILED(rv)) - return; -} - nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& outFlags) { diff --git a/netwerk/base/nsLoadGroup.h b/netwerk/base/nsLoadGroup.h index 20dd94cf9..9b5e70868 100644 --- a/netwerk/base/nsLoadGroup.h +++ b/netwerk/base/nsLoadGroup.h @@ -62,11 +62,6 @@ protected: nsresult MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags); nsresult MergeDefaultLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags); -private: - void TelemetryReport(); - void TelemetryReportChannel(nsITimedChannel *timedChannel, - bool defaultRequest); - protected: uint32_t mForegroundCount; uint32_t mLoadFlags; @@ -87,12 +82,6 @@ protected: int32_t mPriority; bool mIsCanceling; - /* Telemetry */ - mozilla::TimeStamp mDefaultRequestCreationTime; - bool mDefaultLoadIsTimed; - uint32_t mTimedRequests; - uint32_t mCachedRequests; - /* For nsPILoadGroupInternal */ uint32_t mTimedNonCachedRequestsUntilOnEndPageLoad; }; diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp index f9b55ead4..0c8434813 100644 --- a/netwerk/base/nsSocketTransport2.cpp +++ b/netwerk/base/nsSocketTransport2.cpp @@ -7,7 +7,6 @@ #include "nsSocketTransport2.h" #include "mozilla/Attributes.h" -#include "mozilla/Telemetry.h" #include "nsIOService.h" #include "nsStreamUtils.h" #include "nsNetSegmentUtils.h" @@ -1226,8 +1225,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us if (NS_FAILED(rv)) { SOCKET_LOG((" error pushing io layer [%u:%s rv=%x]\n", i, mTypes[i], rv)); if (fd) { - CloseSocket(fd, - mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()); + CloseSocket(fd); } } } @@ -1395,8 +1393,7 @@ nsSocketTransport::InitiateSocket() // inform socket transport about this newly created socket... rv = mSocketTransportService->AttachSocket(fd, this); if (NS_FAILED(rv)) { - CloseSocket(fd, - mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()); + CloseSocket(fd); return rv; } mAttached = true; @@ -1453,26 +1450,8 @@ nsSocketTransport::InitiateSocket() } #endif - // We use PRIntervalTime here because we need - // nsIOService::LastOfflineStateChange time and - // nsIOService::LastConectivityChange time to be atomic. - PRIntervalTime connectStarted = 0; - if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) { - connectStarted = PR_IntervalNow(); - } - status = PR_Connect(fd, &prAddr, NS_SOCKET_CONNECT_TIMEOUT); - if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() && - connectStarted) { - SendPRBlockingTelemetry(connectStarted, - Telemetry::PRCONNECT_BLOCKING_TIME_NORMAL, - Telemetry::PRCONNECT_BLOCKING_TIME_SHUTDOWN, - Telemetry::PRCONNECT_BLOCKING_TIME_CONNECTIVITY_CHANGE, - Telemetry::PRCONNECT_BLOCKING_TIME_LINK_CHANGE, - Telemetry::PRCONNECT_BLOCKING_TIME_OFFLINE); - } - if (status == PR_SUCCESS) { // // we are connected! @@ -1531,16 +1510,6 @@ nsSocketTransport::InitiateSocket() // The connection was refused... // else { - if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() && - connectStarted) { - SendPRBlockingTelemetry(connectStarted, - Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_NORMAL, - Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_SHUTDOWN, - Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_CONNECTIVITY_CHANGE, - Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_LINK_CHANGE, - Telemetry::PRCONNECT_FAIL_BLOCKING_TIME_OFFLINE); - } - rv = ErrorAccordingToNSPR(code); if ((rv == NS_ERROR_CONNECTION_REFUSED) && !mProxyHost.IsEmpty()) rv = NS_ERROR_PROXY_CONNECTION_REFUSED; @@ -1763,8 +1732,7 @@ public: NS_IMETHOD Run() override { - nsSocketTransport::CloseSocket(mFD, - gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()); + nsSocketTransport::CloseSocket(mFD); return NS_OK; } private: @@ -1801,8 +1769,7 @@ nsSocketTransport::ReleaseFD_Locked(PRFileDesc *fd) SOCKET_LOG(("Intentional leak")); } else if (PR_GetCurrentThread() == gSocketThread) { SOCKET_LOG(("nsSocketTransport: calling PR_Close [this=%p]\n", this)); - CloseSocket(mFD, - mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()); + CloseSocket(mFD); } else { // Can't PR_Close() a socket off STS thread. Thunk it to STS to die STS_PRCloseOnSocketTransport(mFD); @@ -1960,26 +1927,7 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags) // We do not need to do PR_ConnectContinue when we are already // shutting down. - // We use PRIntervalTime here because we need - // nsIOService::LastOfflineStateChange time and - // nsIOService::LastConectivityChange time to be atomic. - PRIntervalTime connectStarted = 0; - if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) { - connectStarted = PR_IntervalNow(); - } - PRStatus status = PR_ConnectContinue(fd, outFlags); - - if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() && - connectStarted) { - SendPRBlockingTelemetry(connectStarted, - Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_NORMAL, - Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_SHUTDOWN, - Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_CONNECTIVITY_CHANGE, - Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_LINK_CHANGE, - Telemetry::PRCONNECTCONTINUE_BLOCKING_TIME_OFFLINE); - } - if (status == PR_SUCCESS) { // // we are connected! @@ -3144,41 +3092,13 @@ nsSocketTransport::PRFileDescAutoLock::SetKeepaliveVals(bool aEnabled, } void -nsSocketTransport::CloseSocket(PRFileDesc *aFd, bool aTelemetryEnabled) +nsSocketTransport::CloseSocket(PRFileDesc *aFd) { #if defined(XP_WIN) AttachShutdownLayer(aFd); #endif - // We use PRIntervalTime here because we need - // nsIOService::LastOfflineStateChange time and - // nsIOService::LastConectivityChange time to be atomic. - PRIntervalTime closeStarted; - if (aTelemetryEnabled) { - closeStarted = PR_IntervalNow(); - } - PR_Close(aFd); - - if (aTelemetryEnabled) { - SendPRBlockingTelemetry(closeStarted, - Telemetry::PRCLOSE_TCP_BLOCKING_TIME_NORMAL, - Telemetry::PRCLOSE_TCP_BLOCKING_TIME_SHUTDOWN, - Telemetry::PRCLOSE_TCP_BLOCKING_TIME_CONNECTIVITY_CHANGE, - Telemetry::PRCLOSE_TCP_BLOCKING_TIME_LINK_CHANGE, - Telemetry::PRCLOSE_TCP_BLOCKING_TIME_OFFLINE); - } -} - -void -nsSocketTransport::SendPRBlockingTelemetry(PRIntervalTime aStart, - Telemetry::ID aIDNormal, - Telemetry::ID aIDShutdown, - Telemetry::ID aIDConnectivityChange, - Telemetry::ID aIDLinkChange, - Telemetry::ID aIDOffline) -{ - /* STUB */ } } // namespace net diff --git a/netwerk/base/nsSocketTransport2.h b/netwerk/base/nsSocketTransport2.h index 7c85ccdc4..310cc58d3 100644 --- a/netwerk/base/nsSocketTransport2.h +++ b/netwerk/base/nsSocketTransport2.h @@ -22,7 +22,6 @@ #include "nsIClassInfo.h" #include "mozilla/net/DNS.h" #include "nsASocketHandler.h" -#include "mozilla/Telemetry.h" #include "prerror.h" #include "nsAutoPtr.h" @@ -169,13 +168,7 @@ public: uint64_t ByteCountReceived() override { return mInput.ByteCount(); } uint64_t ByteCountSent() override { return mOutput.ByteCount(); } - static void CloseSocket(PRFileDesc *aFd, bool aTelemetryEnabled); - static void SendPRBlockingTelemetry(PRIntervalTime aStart, - Telemetry::ID aIDNormal, - Telemetry::ID aIDShutdown, - Telemetry::ID aIDConnectivityChange, - Telemetry::ID aIDLinkChange, - Telemetry::ID aIDOffline); + static void CloseSocket(PRFileDesc *aFd); protected: virtual ~nsSocketTransport(); diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 739388b0f..af5742564 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -22,7 +22,6 @@ #include "mozilla/PublicSSL.h" #include "mozilla/ChaosMode.h" #include "mozilla/PodOperations.h" -#include "mozilla/Telemetry.h" #include "nsThreadUtils.h" #include "nsIFile.h" #include "nsIWidget.h" @@ -47,7 +46,6 @@ Atomic gSocketThread; #define SOCKET_LIMIT_MIN 50U #define BLIP_INTERVAL_PREF "network.activity.blipIntervalMilliseconds" #define MAX_TIME_BETWEEN_TWO_POLLS "network.sts.max_time_for_events_between_two_polls" -#define TELEMETRY_PREF "toolkit.telemetry.enabled" #define MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN "network.sts.max_time_for_pr_close_during_shutdown" #define REPAIR_POLLABLE_EVENT_TIME 10 @@ -79,9 +77,7 @@ nsSocketTransportService::nsSocketTransportService() , mKeepaliveEnabledPref(false) , mServingPendingQueue(false) , mMaxTimePerPollIter(100) - , mTelemetryEnabledPref(false) , mMaxTimeForPrClosePref(PR_SecondsToInterval(5)) - , mSleepPhase(false) , mProbedMaxCount(false) #if defined(XP_WIN) , mPolling(false) @@ -211,16 +207,9 @@ nsSocketTransportService::AttachSocket(PRFileDesc *fd, nsASocketHandler *handler bool nsSocketTransportService::CanAttachSocket() { - static bool reported900FDLimit = false; - uint32_t total = mActiveCount + mIdleCount; bool rv = total < gMaxCount; - if (mTelemetryEnabledPref && - (((total >= 900) || !rv) && !reported900FDLimit)) { - reported900FDLimit = true; - } - return rv; } @@ -438,13 +427,11 @@ nsSocketTransportService::PollTimeout() } int32_t -nsSocketTransportService::Poll(uint32_t *interval, - TimeDuration *pollDuration) +nsSocketTransportService::Poll(uint32_t *interval) { PRPollDesc *pollList; uint32_t pollCount; PRIntervalTime pollTimeout; - *pollDuration = 0; // If there are pending events for this thread then // DoPollIteration() should service the network without blocking. @@ -470,8 +457,6 @@ nsSocketTransportService::Poll(uint32_t *interval, PRIntervalTime ts = PR_IntervalNow(); - TimeStamp pollStart; - SOCKET_LOG((" timeout = %i milliseconds\n", PR_IntervalToMilliseconds(pollTimeout))); int32_t rv = PR_Poll(pollList, pollCount, pollTimeout); @@ -530,7 +515,6 @@ nsSocketTransportService::Init() tmpPrefService->AddObserver(KEEPALIVE_RETRY_INTERVAL_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_PROBE_COUNT_PREF, this, false); tmpPrefService->AddObserver(MAX_TIME_BETWEEN_TWO_POLLS, this, false); - tmpPrefService->AddObserver(TELEMETRY_PREF, this, false); tmpPrefService->AddObserver(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN, this, false); } UpdatePrefs(); @@ -539,8 +523,6 @@ nsSocketTransportService::Init() if (obsSvc) { obsSvc->AddObserver(this, "profile-initial-state", false); obsSvc->AddObserver(this, "last-pb-context-exited", false); - obsSvc->AddObserver(this, NS_WIDGET_SLEEP_OBSERVER_TOPIC, true); - obsSvc->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, true); obsSvc->AddObserver(this, "xpcom-shutdown-threads", false); } @@ -607,16 +589,9 @@ nsSocketTransportService::ShutdownThread() if (obsSvc) { obsSvc->RemoveObserver(this, "profile-initial-state"); obsSvc->RemoveObserver(this, "last-pb-context-exited"); - obsSvc->RemoveObserver(this, NS_WIDGET_SLEEP_OBSERVER_TOPIC); - obsSvc->RemoveObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC); obsSvc->RemoveObserver(this, "xpcom-shutdown-threads"); } - if (mAfterWakeUpTimer) { - mAfterWakeUpTimer->Cancel(); - mAfterWakeUpTimer = nullptr; - } - NetworkActivityMonitor::Shutdown(); mInitialized = false; @@ -851,24 +826,16 @@ nsSocketTransportService::Run() // make sure the pseudo random number generator is seeded on this thread srand(static_cast(PR_Now())); - // Time blocked in poll(). - TimeDuration singlePollDuration; - int numberOfPendingEvents; // If there is too many pending events queued, we will run some poll() - // between them and the following variable is cumulative time spent - // blocking in poll(). - TimeDuration pollDuration; - + // between them. for (;;) { bool pendingEvents = false; - numberOfPendingEvents = 0; - pollDuration = 0; do { - DoPollIteration(&singlePollDuration); + DoPollIteration(); mRawThread->HasPendingEvents(&pendingEvents); if (pendingEvents) { @@ -959,7 +926,7 @@ nsSocketTransportService::Reset(bool aGuardLocals) } nsresult -nsSocketTransportService::DoPollIteration(TimeDuration *pollDuration) +nsSocketTransportService::DoPollIteration() { SOCKET_LOG(("STS poll iter\n")); @@ -1019,13 +986,12 @@ nsSocketTransportService::DoPollIteration(TimeDuration *pollDuration) // Measures seconds spent while blocked on PR_Poll uint32_t pollInterval = 0; int32_t n = 0; - *pollDuration = 0; if (!gIOService->IsNetTearingDown()) { // Let's not do polling during shutdown. #if defined(XP_WIN) StartPolling(); #endif - n = Poll(&pollInterval, pollDuration); + n = Poll(&pollInterval); #if defined(XP_WIN) EndPolling(); #endif @@ -1171,13 +1137,6 @@ nsSocketTransportService::UpdatePrefs() mMaxTimePerPollIter = maxTimePref; } - bool telemetryPref = false; - rv = tmpPrefService->GetBoolPref(TELEMETRY_PREF, - &telemetryPref); - if (NS_SUCCEEDED(rv)) { - mTelemetryEnabledPref = telemetryPref; - } - int32_t maxTimeForPrClosePref; rv = tmpPrefService->GetIntPref(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN, &maxTimeForPrClosePref); @@ -1255,10 +1214,6 @@ nsSocketTransportService::Observe(nsISupports *subject, if (!strcmp(topic, NS_TIMER_CALLBACK_TOPIC)) { nsCOMPtr timer = do_QueryInterface(subject); - if (timer == mAfterWakeUpTimer) { - mAfterWakeUpTimer = nullptr; - mSleepPhase = false; - } #if defined(XP_WIN) if (timer == mPollRepairTimer) { @@ -1266,19 +1221,6 @@ nsSocketTransportService::Observe(nsISupports *subject, } #endif - } else if (!strcmp(topic, NS_WIDGET_SLEEP_OBSERVER_TOPIC)) { - mSleepPhase = true; - if (mAfterWakeUpTimer) { - mAfterWakeUpTimer->Cancel(); - mAfterWakeUpTimer = nullptr; - } - } else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) { - if (mSleepPhase && !mAfterWakeUpTimer) { - mAfterWakeUpTimer = do_CreateInstance("@mozilla.org/timer;1"); - if (mAfterWakeUpTimer) { - mAfterWakeUpTimer->Init(this, 2000, nsITimer::TYPE_ONE_SHOT); - } - } } else if (!strcmp(topic, "xpcom-shutdown-threads")) { ShutdownThread(); } diff --git a/netwerk/base/nsSocketTransportService2.h b/netwerk/base/nsSocketTransportService2.h index 81c806793..0b88a6535 100644 --- a/netwerk/base/nsSocketTransportService2.h +++ b/netwerk/base/nsSocketTransportService2.h @@ -118,8 +118,6 @@ public: // Returns true if keepalives are enabled in prefs. bool IsKeepaliveEnabled() { return mKeepaliveEnabledPref; } - bool IsTelemetryEnabledAndNotSleepPhase() { return mTelemetryEnabledPref && - !mSleepPhase; } PRIntervalTime MaxTimeForPrClosePref() {return mMaxTimeForPrClosePref; } protected: @@ -191,7 +189,7 @@ private: bool GrowActiveList(); bool GrowIdleList(); - void InitMaxCount(); + void InitMaxCount(); // Total bytes number transfered through all the sockets except active ones uint64_t mSentBytesCount; @@ -206,15 +204,12 @@ private: PRPollDesc *mPollList; /* mListSize + 1 entries */ PRIntervalTime PollTimeout(); // computes ideal poll timeout - nsresult DoPollIteration(TimeDuration *pollDuration); + nsresult DoPollIteration(); // perfoms a single poll iteration - int32_t Poll(uint32_t *interval, - TimeDuration *pollDuration); + int32_t Poll(uint32_t *interval); // calls PR_Poll. the out param // interval indicates the poll // duration in seconds. - // pollDuration is used only for - // telemetry //------------------------------------------------------------------------- // pending socket queue - see NotifyWhenCanAttachSocket @@ -236,14 +231,8 @@ private: Atomic mServingPendingQueue; Atomic mMaxTimePerPollIter; - Atomic mTelemetryEnabledPref; Atomic mMaxTimeForPrClosePref; - // Between a computer going to sleep and waking up the PR_*** telemetry - // will be corrupted - so do not record it. - Atomic mSleepPhase; - nsCOMPtr mAfterWakeUpTimer; - void OnKeepaliveEnabledPrefChange(); void NotifyKeepaliveEnabledPrefChange(SocketContext *sock); diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp index 445b62d9c..06ecbf9ee 100644 --- a/netwerk/base/nsUDPSocket.cpp +++ b/netwerk/base/nsUDPSocket.cpp @@ -7,7 +7,6 @@ #include "mozilla/EndianUtils.h" #include "mozilla/dom/TypedArray.h" #include "mozilla/HoldDropJSObjects.h" -#include "mozilla/Telemetry.h" #include "nsSocketTransport2.h" #include "nsUDPSocket.h" @@ -275,7 +274,6 @@ void nsUDPSocket::AddOutputBytes(uint64_t aBytes) { mByteWriteCount += aBytes; - SaveNetworkStats(false); } void @@ -465,7 +463,6 @@ nsUDPSocket::OnSocketReady(PRFileDesc *fd, int16_t outFlags) return; } mByteReadCount += count; - SaveNetworkStats(false); FallibleTArray data; if (!data.AppendElements(buff, count, fallible)) { @@ -512,7 +509,6 @@ nsUDPSocket::OnSocketDetached(PRFileDesc *fd) NS_ASSERTION(mFD == fd, "wrong file descriptor"); CloseSocket(); } - SaveNetworkStats(true); if (mListener) { @@ -726,7 +722,6 @@ nsUDPSocket::Close() // expects this happen synchronously. CloseSocket(); - SaveNetworkStats(true); return NS_OK; } } @@ -754,12 +749,6 @@ nsUDPSocket::GetLocalAddr(nsINetAddr * *aResult) return NS_OK; } -void -nsUDPSocket::SaveNetworkStats(bool aEnforce) -{ - /*** STUB ***/ -} - void nsUDPSocket::CloseSocket() { diff --git a/netwerk/base/nsUDPSocket.h b/netwerk/base/nsUDPSocket.h index f8ae87cee..2910a49dd 100644 --- a/netwerk/base/nsUDPSocket.h +++ b/netwerk/base/nsUDPSocket.h @@ -53,8 +53,6 @@ private: const PRNetAddr& aIface); nsresult SetMulticastInterfaceInternal(const PRNetAddr& aIface); - void SaveNetworkStats(bool aEnforce); - void CloseSocket(); // lock protects access to mListener; diff --git a/netwerk/cache2/CacheStorageService.cpp b/netwerk/cache2/CacheStorageService.cpp index 85f364e4e..3ee1e15cd 100644 --- a/netwerk/cache2/CacheStorageService.cpp +++ b/netwerk/cache2/CacheStorageService.cpp @@ -964,8 +964,6 @@ CacheStorageService::RegisterEntry(CacheEntry* aEntry) if (mShutdown || !aEntry->CanRegister()) return; - TelemetryRecordEntryCreation(aEntry); - LOG(("CacheStorageService::RegisterEntry [entry=%p]", aEntry)); MemoryPool& pool = Pool(aEntry->IsUsingDisk()); @@ -983,8 +981,6 @@ CacheStorageService::UnregisterEntry(CacheEntry* aEntry) if (!aEntry->IsRegistered()) return; - TelemetryRecordEntryRemoval(aEntry); - LOG(("CacheStorageService::UnregisterEntry [entry=%p]", aEntry)); MemoryPool& pool = Pool(aEntry->IsUsingDisk()); @@ -2018,100 +2014,6 @@ uint32_t CacheStorageService::CacheQueueSize(bool highPriority) return thread->QueueSize(highPriority); } -// Telementry collection - -namespace { - -bool TelemetryEntryKey(CacheEntry const* entry, nsAutoCString& key) -{ - nsAutoCString entryKey; - nsresult rv = entry->HashingKey(entryKey); - if (NS_FAILED(rv)) - return false; - - if (entry->GetStorageID().IsEmpty()) { - // Hopefully this will be const-copied, saves some memory - key = entryKey; - } else { - key.Assign(entry->GetStorageID()); - key.Append(':'); - key.Append(entryKey); - } - - return true; -} - -} // namespace - -void -CacheStorageService::TelemetryPrune(TimeStamp &now) -{ - static TimeDuration const oneMinute = TimeDuration::FromSeconds(60); - static TimeStamp dontPruneUntil = now + oneMinute; - if (now < dontPruneUntil) - return; - - static TimeDuration const fifteenMinutes = TimeDuration::FromSeconds(900); - for (auto iter = mPurgeTimeStamps.Iter(); !iter.Done(); iter.Next()) { - if (now - iter.Data() > fifteenMinutes) { - // We are not interested in resurrection of entries after 15 minutes - // of time. This is also the limit for the telemetry. - iter.Remove(); - } - } - dontPruneUntil = now + oneMinute; -} - -void -CacheStorageService::TelemetryRecordEntryCreation(CacheEntry const* entry) -{ - MOZ_ASSERT(CacheStorageService::IsOnManagementThread()); - - nsAutoCString key; - if (!TelemetryEntryKey(entry, key)) - return; - - TimeStamp now = TimeStamp::NowLoRes(); - TelemetryPrune(now); - - // When an entry is craeted (registered actually) we check if there is - // a timestamp marked when this very same cache entry has been removed - // (deregistered) because of over-memory-limit purging. If there is such - // a timestamp found accumulate telemetry on how long the entry was away. - TimeStamp timeStamp; - if (!mPurgeTimeStamps.Get(key, &timeStamp)) - return; - - mPurgeTimeStamps.Remove(key); - -} - -void -CacheStorageService::TelemetryRecordEntryRemoval(CacheEntry const* entry) -{ - MOZ_ASSERT(CacheStorageService::IsOnManagementThread()); - - // Doomed entries must not be considered, we are only interested in purged - // entries. Note that the mIsDoomed flag is always set before deregistration - // happens. - if (entry->IsDoomed()) - return; - - nsAutoCString key; - if (!TelemetryEntryKey(entry, key)) - return; - - // When an entry is removed (deregistered actually) we put a timestamp for this - // entry to the hashtable so that when the entry is created (registered) again - // we know how long it was away. Also accumulate number of AsyncOpen calls on - // the entry, this tells us how efficiently the pool actually works. - - TimeStamp now = TimeStamp::NowLoRes(); - TelemetryPrune(now); - mPurgeTimeStamps.Put(key, now); - -} - // nsIMemoryReporter size_t diff --git a/netwerk/cache2/CacheStorageService.h b/netwerk/cache2/CacheStorageService.h index f40459d84..7e968e359 100644 --- a/netwerk/cache2/CacheStorageService.h +++ b/netwerk/cache2/CacheStorageService.h @@ -187,12 +187,6 @@ private: */ bool IsForcedValidEntry(nsACString const &aEntryKeyWithContext); -private: - // These are helpers for telemetry monitoring of the memory pools. - void TelemetryPrune(TimeStamp &now); - void TelemetryRecordEntryCreation(CacheEntry const* entry); - void TelemetryRecordEntryRemoval(CacheEntry const* entry); - private: // Following methods are thread safe to call. friend class CacheStorage; @@ -370,12 +364,6 @@ private: uint32_t mWhat; }; - // Used just for telemetry purposes, accessed only on the management thread. - // Note: not included in the memory reporter, this is not expected to be huge - // and also would be complicated to report since reporting happens on the main - // thread but this table is manipulated on the management thread. - nsDataHashtable mPurgeTimeStamps; - // nsICacheTesting class IOThreadSuspender : public Runnable { diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index 7bc5abcd1..6740f7310 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -49,7 +49,6 @@ #include "mozilla/storage.h" #include "mozilla/AutoRestore.h" #include "mozilla/FileUtils.h" -#include "mozilla/Telemetry.h" #include "nsIAppsService.h" #include "mozIApplication.h" #include "mozIApplicationClearPrivateDataParams.h" @@ -120,15 +119,6 @@ static const char kPrefCookiePurgeAge[] = "network.cookie.purgeAge"; static const char kPrefThirdPartySession[] = "network.cookie.thirdparty.sessionOnly"; static const char kCookieLeaveSecurityAlone[] = "network.cookie.leave-secure-alone"; -// For telemetry COOKIE_LEAVE_SECURE_ALONE -#define BLOCKED_SECURE_SET_FROM_HTTP 0 -#define BLOCKED_DOWNGRADE_SECURE 1 -#define DOWNGRADE_SECURE_FROM_SECURE 2 -#define EVICTED_NEWER_INSECURE 3 -#define EVICTED_OLDEST_COOKIE 4 -#define EVICTED_PREFERRED_COOKIE 5 -#define EVICTING_SECURE_BLOCKED 6 - static void bindCookieParameters(mozIStorageBindingParamsArray *aParamsArray, const nsCookieKey &aKey, @@ -3592,9 +3582,6 @@ nsCookieService::AddInternal(const nsCookieKey &aKey, MOZ_ASSERT(iter.entry); oldCookie = iter.Cookie(); - if (oldestCookieTime > 0 && mLeaveSecureAlone) { - TelemetryForEvictingStaleCookie(oldCookie, oldestCookieTime); - } // remove the oldest cookie from the domain RemoveCookieFromList(iter); @@ -4619,13 +4606,6 @@ nsCookieService::FindStaleCookie(nsCookieEntry *aEntry, return actualOldestCookieTime; } -void -nsCookieService::TelemetryForEvictingStaleCookie(nsCookie *aEvicted, - int64_t oldestCookieTime) -{ - /* STUB */ -} - // count the number of cookies stored by a particular host. this is provided by the // nsICookieManager2 interface. NS_IMETHODIMP diff --git a/netwerk/cookie/nsCookieService.h b/netwerk/cookie/nsCookieService.h index e3b2d3e8a..185f0b492 100644 --- a/netwerk/cookie/nsCookieService.h +++ b/netwerk/cookie/nsCookieService.h @@ -314,7 +314,6 @@ class nsCookieService final : public nsICookieService bool FindCookie(const nsCookieKey& aKey, const nsAFlatCString &aHost, const nsAFlatCString &aName, const nsAFlatCString &aPath, nsListIter &aIter); bool FindSecureCookie(const nsCookieKey& aKey, nsCookie* aCookie); int64_t FindStaleCookie(nsCookieEntry *aEntry, int64_t aCurrentTime, nsIURI* aSource, mozilla::Maybe aIsSecure, nsListIter &aIter); - void TelemetryForEvictingStaleCookie(nsCookie* aEvicted, int64_t oldestCookieTime); void NotifyRejected(nsIURI *aHostURI); void NotifyThirdParty(nsIURI *aHostURI, bool aAccepted, nsIChannel *aChannel); void NotifyChanged(nsISupports *aSubject, const char16_t *aData); diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index c4883ab29..323470c34 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -32,7 +32,6 @@ #include "mozilla/HashFunctions.h" #include "mozilla/TimeStamp.h" -#include "mozilla/Telemetry.h" #include "mozilla/DebugOnly.h" #include "mozilla/Preferences.h" @@ -1419,7 +1418,6 @@ nsHostResolver::ThreadFunc(void *arg) LOG(("DNS lookup thread - Calling getaddrinfo for host [%s%s%s].\n", LOG_HOST(rec->host, rec->netInterface))); - TimeStamp startTime = TimeStamp::Now(); #if TTL_AVAILABLE bool getTtl = rec->mGetTtl; #else diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp index 3471985dd..581ebe016 100644 --- a/netwerk/protocol/http/Http2Stream.cpp +++ b/netwerk/protocol/http/Http2Stream.cpp @@ -657,12 +657,6 @@ Http2Stream::GenerateOpen() outputOffset += frameLen; } - // The size of the input headers is approximate - uint32_t ratio = - compressedData.Length() * 100 / - (11 + requestURI.Length() + - mFlatHttpRequestHeaders.Length()); - mFlatHttpRequestHeaders.Truncate(); return NS_OK; } @@ -980,7 +974,7 @@ Http2Stream::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame) } // ConvertResponseHeaders is used to convert the response headers -// into HTTP/1 format and report some telemetry +// into HTTP/1 format nsresult Http2Stream::ConvertResponseHeaders(Http2Decompressor *decompressor, nsACString &aHeadersIn, @@ -1036,7 +1030,7 @@ Http2Stream::ConvertResponseHeaders(Http2Decompressor *decompressor, } // ConvertPushHeaders is used to convert the pushed request headers -// into HTTP/1 format and report some telemetry +// into HTTP/1 format nsresult Http2Stream::ConvertPushHeaders(Http2Decompressor *decompressor, nsACString &aHeadersIn, diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index 21b661c2b..9e43d89e0 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -996,16 +996,6 @@ HttpBaseChannel::DoApplyContentConversions(nsIStreamListener* aNextListener, } LOG(("converter removed '%s' content-encoding\n", val)); - if (gHttpHandler->IsTelemetryEnabled()) { - int mode = 0; - if (from.Equals("gzip") || from.Equals("x-gzip")) { - mode = 1; - } else if (from.Equals("deflate") || from.Equals("x-deflate")) { - mode = 2; - } else if (from.Equals("br")) { - mode = 3; - } - } nextListener = converter; } else { diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index be5539a02..a890c51b3 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -83,7 +83,6 @@ #include "nsCRT.h" #include "CacheObserver.h" #include "mozilla/dom/Performance.h" -#include "mozilla/Telemetry.h" #include "AlternateServices.h" #include "InterceptedChannel.h" #include "nsIHttpPushListener.h" @@ -123,19 +122,6 @@ static NS_DEFINE_CID(kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID); static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID); -enum CacheDisposition { - kCacheHit = 1, - kCacheHitViaReval = 2, - kCacheMissedViaReval = 3, - kCacheMissed = 4 -}; - -void -AccumulateCacheHitTelemetry(CacheDisposition hitOrMiss) -{ - /* STUB */ -} - // Computes and returns a SHA1 hash of the input buffer. The input buffer // must be a null-terminated string. nsresult @@ -494,11 +480,6 @@ nsHttpChannel::ContinueConnect() event->Revoke(); } - // Don't accumulate the cache hit telemetry for intercepted channels. - if (mInterceptCache != INTERCEPTED) { - AccumulateCacheHitTelemetry(kCacheHit); - } - return rv; } else if (mLoadFlags & LOAD_ONLY_FROM_CACHE) { @@ -1085,10 +1066,8 @@ ProcessXCTO(nsIURI* aURI, nsHttpResponseHead* aResponseHead, nsILoadInfo* aLoadI if (aLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_IMAGE) { if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("image/"))) { - Accumulate(Telemetry::XCTO_NOSNIFF_BLOCK_IMAGE, 0); return NS_OK; } - Accumulate(Telemetry::XCTO_NOSNIFF_BLOCK_IMAGE, 1); // Instead of consulting Preferences::GetBool() all the time we // can cache the result to speed things up. static bool sXCTONosniffBlockImages = false; @@ -2116,29 +2095,6 @@ nsHttpChannel::ContinueProcessResponse2(nsresult rv) break; } - if (gHttpHandler->IsTelemetryEnabled()) { - CacheDisposition cacheDisposition; - if (!mDidReval) { - cacheDisposition = kCacheMissed; - } else if (successfulReval) { - cacheDisposition = kCacheHitViaReval; - } else { - cacheDisposition = kCacheMissedViaReval; - } - AccumulateCacheHitTelemetry(cacheDisposition); - - if (mResponseHead->Version() == NS_HTTP_VERSION_0_9) { - // DefaultPortTopLevel = 0, DefaultPortSubResource = 1, - // NonDefaultPortTopLevel = 2, NonDefaultPortSubResource = 3 - uint32_t v09Info = 0; - if (!(mLoadFlags & LOAD_INITIAL_DOCUMENT_URI)) { - v09Info += 1; - } - if (mConnectionInfo->OriginPort() != mConnectionInfo->DefaultPort()) { - v09Info += 2; - } - } - } return rv; } @@ -3784,8 +3740,6 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC (!mCachedResponseHead->ExpiresInPast() || !mCachedResponseHead->MustValidateIfExpired())) { LOG(("NOT validating based on isForcedValid being true.\n")); - Telemetry::AutoCounter used; - ++used; doValidation = false; } // If the LOAD_FROM_CACHE flag is set, any cached data can simply be used @@ -6546,8 +6500,6 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st if (mTimingEnabled && request == mCachePump) { mCacheReadEnd = TimeStamp::Now(); - - ReportNetVSCacheTelemetry(); } // allow content to be cached if it was loaded successfully (bug #482935) @@ -8104,12 +8056,5 @@ nsHttpChannel::SetDoNotTrack() } } - -void -nsHttpChannel::ReportNetVSCacheTelemetry() -{ - /* STUB */ -} - } // namespace net } // namespace mozilla diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index 152cf1503..554875b1c 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -431,9 +431,6 @@ private: rv == NS_ERROR_MALFORMED_URI; } - // Report net vs cache time telemetry - void ReportNetVSCacheTelemetry(); - // Create a aggregate set of the current notification callbacks // and ensure the transaction is updated to use it. void UpdateAggregateCallbacks(); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 731cdff39..907f33436 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -35,8 +35,6 @@ #include "mozilla/Unused.h" #include "nsIURI.h" -#include "mozilla/Telemetry.h" - namespace mozilla { namespace net { @@ -1186,14 +1184,6 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent, transport->SetConnectionFlags(flags); } - Telemetry::AutoCounter usedSpeculativeConn; - ++usedSpeculativeConn; - - if (ent->mHalfOpens[i]->IsFromPredictor()) { - Telemetry::AutoCounter totalPreconnectsUsed; - ++totalPreconnectsUsed; - } - // return OK because we have essentially opened a new connection // by converting a speculative half-open to general use return NS_OK; @@ -1387,14 +1377,6 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent, ent->SetYellowConnection(bestConn); if (!trans->GetPendingTime().IsNull()) { - if (trans->UsesPipelining()) - AccumulateTimeDelta( - Telemetry::TRANSACTION_WAIT_TIME_HTTP_PIPELINES, - trans->GetPendingTime(), TimeStamp::Now()); - else - AccumulateTimeDelta( - Telemetry::TRANSACTION_WAIT_TIME_HTTP, - trans->GetPendingTime(), TimeStamp::Now()); trans->SetPendingTime(false); } return true; @@ -1677,8 +1659,6 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent, rv = conn->Activate(trans, caps, priority); MOZ_ASSERT(NS_SUCCEEDED(rv), "SPDY Cannot Fail Dispatch"); if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) { - AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_SPDY, - trans->GetPendingTime(), TimeStamp::Now()); trans->SetPendingTime(false); } return rv; @@ -1695,12 +1675,6 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent, rv = DispatchAbstractTransaction(ent, trans, caps, conn, priority); if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) { - if (trans->UsesPipelining()) - AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_HTTP_PIPELINES, - trans->GetPendingTime(), TimeStamp::Now()); - else - AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_HTTP, - trans->GetPendingTime(), TimeStamp::Now()); trans->SetPendingTime(false); } return rv; @@ -1829,12 +1803,6 @@ nsHttpConnectionMgr::BuildPipeline(nsConnectionEntry *ent, return NS_OK; } -void -nsHttpConnectionMgr::ReportProxyTelemetry(nsConnectionEntry *ent) -{ - /* STUB */ -} - nsresult nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans) { @@ -1878,8 +1846,6 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans) ent = preferredEntry; } - ReportProxyTelemetry(ent); - // Check if the transaction already has a sticky reference to a connection. // If so, then we can just use it directly by transferring its reference // to the new connection variable instead of searching for a new one @@ -1976,13 +1942,9 @@ nsHttpConnectionMgr::CreateTransport(nsConnectionEntry *ent, if (speculative) { sock->SetSpeculative(true); sock->SetAllow1918(allow1918); - Telemetry::AutoCounter totalSpeculativeConn; - ++totalSpeculativeConn; if (isFromPredictor) { sock->SetIsFromPredictor(true); - Telemetry::AutoCounter totalPreconnectsCreated; - ++totalPreconnectsCreated; } } @@ -3894,16 +3856,6 @@ nsConnectionEntry::RemoveHalfOpen(nsHalfOpenSocket *halfOpen) // will result in it not being present in the halfopen table. That's expected. if (mHalfOpens.RemoveElement(halfOpen)) { - if (halfOpen->IsSpeculative()) { - Telemetry::AutoCounter unusedSpeculativeConn; - ++unusedSpeculativeConn; - - if (halfOpen->IsFromPredictor()) { - Telemetry::AutoCounter totalPreconnectsUnused; - ++totalPreconnectsUnused; - } - } - MOZ_ASSERT(gHttpHandler->ConnMgr()->mNumHalfOpenConns); if (gHttpHandler->ConnMgr()->mNumHalfOpenConns) { // just in case gHttpHandler->ConnMgr()->mNumHalfOpenConns--; diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index 7ca2a2b28..a2c88c402 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -529,7 +529,6 @@ private: nsresult ProcessNewTransaction(nsHttpTransaction *); nsresult EnsureSocketThreadTarget(); void ClosePersistentConnections(nsConnectionEntry *ent); - void ReportProxyTelemetry(nsConnectionEntry *ent); nsresult CreateTransport(nsConnectionEntry *, nsAHttpTransaction *, uint32_t, bool, bool, bool); void AddActiveConn(nsHttpConnection *, nsConnectionEntry *); diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 6d58a7004..477961454 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -90,7 +90,6 @@ #define BROWSER_PREF_PREFIX "browser.cache." #define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled" #define H2MANDATORY_SUITE "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256" -#define TELEMETRY_ENABLED "toolkit.telemetry.enabled" #define ALLOW_EXPERIMENTS "network.allow-experiments" #define SAFE_HINT_HEADER_VALUE "safeHint.enabled" #define SECURITY_PREFIX "security." @@ -209,7 +208,6 @@ nsHttpHandler::nsHttpHandler() , mSafeHintEnabled(false) , mParentalControlEnabled(false) , mHandlerActive(false) - , mTelemetryEnabled(false) , mAllowExperiments(true) , mDebugObservations(false) , mEnableSpdy(false) @@ -305,7 +303,6 @@ nsHttpHandler::Init() prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, true); prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true); prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true); - prefBranch->AddObserver(TELEMETRY_ENABLED, this, true); prefBranch->AddObserver(H2MANDATORY_SUITE, this, true); prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.short_lived_connections"), this, true); prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.long_lived_connections"), this, true); @@ -1547,19 +1544,6 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref) // includes telemetry and allow-experiments because of the abtest profile bool requestTokenBucketUpdated = false; - // - // Telemetry - // - - if (PREF_CHANGED(TELEMETRY_ENABLED)) { - cVar = false; - requestTokenBucketUpdated = true; - rv = prefs->GetBoolPref(TELEMETRY_ENABLED, &cVar); - if (NS_SUCCEEDED(rv)) { - mTelemetryEnabled = cVar; - } - } - // "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256" is the required h2 interop // suite. diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index 848dd25b1..983d069af 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -105,8 +105,7 @@ public: bool EnforceAssocReq() { return mEnforceAssocReq; } bool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; } - bool IsTelemetryEnabled() { return mTelemetryEnabled; } - bool AllowExperiments() { return mTelemetryEnabled && mAllowExperiments; } + bool AllowExperiments() { return mAllowExperiments; } bool IsSpdyEnabled() { return mEnableSpdy; } bool IsHttp2Enabled() { return mHttp2Enabled; } @@ -509,9 +508,6 @@ private: // true in between init and shutdown states Atomic mHandlerActive; - // Whether telemetry is reported or not - uint32_t mTelemetryEnabled : 1; - // The value of network.allow-experiments uint32_t mAllowExperiments : 1; -- cgit v1.2.3 From 6335404642a019df481275f4f290ea76b4d8f597 Mon Sep 17 00:00:00 2001 From: adeshkp Date: Mon, 14 Jan 2019 09:37:50 -0500 Subject: Make `AllowExperiments` return `false` as it is not useful without telemetry --- netwerk/protocol/http/nsHttpHandler.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'netwerk') diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index 983d069af..f1ec0f947 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -105,7 +105,10 @@ public: bool EnforceAssocReq() { return mEnforceAssocReq; } bool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; } - bool AllowExperiments() { return mAllowExperiments; } + + // Since telemetry has been removed, experiments should also not be allowed. + // Making this function return `false` for now, it will be cleaned up later. + bool AllowExperiments() { return false; } bool IsSpdyEnabled() { return mEnableSpdy; } bool IsHttp2Enabled() { return mHttp2Enabled; } -- cgit v1.2.3 From 1f9ab3a6e6e3f1e79b482c0540c98859bbc71350 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 18 Jan 2019 22:43:29 +0100 Subject: Remove NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS --- netwerk/base/nsUDPSocket.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'netwerk') diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp index 06ecbf9ee..8b6a81bf5 100644 --- a/netwerk/base/nsUDPSocket.cpp +++ b/netwerk/base/nsUDPSocket.cpp @@ -172,7 +172,6 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsUDPMessage) NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsUDPMessage) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsUDPMessage) -- cgit v1.2.3 From 6567bb631a78033b6b4cc32bc93e07d837652276 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 Feb 2019 12:58:13 +0100 Subject: Never let "localhost" get sent to a proxy. Also make "No proxy for" editable always when usable. --- netwerk/base/nsProtocolProxyService.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'netwerk') diff --git a/netwerk/base/nsProtocolProxyService.cpp b/netwerk/base/nsProtocolProxyService.cpp index 26eca0e88..237a2a3bd 100644 --- a/netwerk/base/nsProtocolProxyService.cpp +++ b/netwerk/base/nsProtocolProxyService.cpp @@ -1841,6 +1841,13 @@ nsProtocolProxyService::Resolve_Internal(nsIChannel *channel, if (mPACMan && mPACMan->IsPACURI(uri)) return NS_OK; + // If proxies are enabled and this host:port combo is supposed to use a + // proxy, check for a proxy. + if ((mProxyConfig == PROXYCONFIG_DIRECT) || + !CanUseProxy(uri, info.defaultPort)) { + return NS_OK; + } + bool mainThreadOnly; if (mSystemProxySettings && mProxyConfig == PROXYCONFIG_SYSTEM && -- cgit v1.2.3 From 6992106dc7894fab3f620263e99b4083b36bf9e8 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 Feb 2019 22:06:24 +0100 Subject: Use existing image decoders to handle clipboard BMP data. This gets rid of the old nsImageClipboard widget code in favor of using the nsBMPDecoder in imglib. --- netwerk/mime/nsMimeTypes.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'netwerk') diff --git a/netwerk/mime/nsMimeTypes.h b/netwerk/mime/nsMimeTypes.h index 215d20507..57a85e9bc 100644 --- a/netwerk/mime/nsMimeTypes.h +++ b/netwerk/mime/nsMimeTypes.h @@ -107,6 +107,9 @@ #define IMAGE_TIFF "image/tiff" #define IMAGE_BMP "image/bmp" #define IMAGE_BMP_MS "image/x-ms-bmp" +// This is used internally to represent Windows clipboard BMPs which remove +// part of the header. +#define IMAGE_BMP_MS_CLIPBOARD "image/x-ms-clipboard-bmp" #define IMAGE_ICO "image/x-icon" #define IMAGE_ICO_MS "image/vnd.microsoft.icon" #define IMAGE_ICON_MS "image/icon" -- cgit v1.2.3 From 8beab28bfff78ccefc8677c5bdddd6f60c544600 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 10 Feb 2019 08:51:40 +0100 Subject: Expose TLS 1.3 cipher suite prefs. --- netwerk/base/security-prefs.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'netwerk') diff --git a/netwerk/base/security-prefs.js b/netwerk/base/security-prefs.js index 7d63267a6..ea0b2236d 100644 --- a/netwerk/base/security-prefs.js +++ b/netwerk/base/security-prefs.js @@ -17,6 +17,11 @@ pref("security.ssl.false_start.require-npn", false); pref("security.ssl.enable_npn", true); pref("security.ssl.enable_alpn", true); +// TLS 1.3 cipher suites +pref("security.tls13.aes_128_gcm_sha256", true); +pref("security.tls13.chacha20_poly1305_sha256", true); +pref("security.tls13.aes_256_gcm_sha384", true); + // TLS 1.0-1.2 cipher suites pref("security.ssl3.ecdhe_rsa_aes_128_gcm_sha256", true); pref("security.ssl3.ecdhe_ecdsa_aes_128_gcm_sha256", true); @@ -36,11 +41,14 @@ pref("security.ssl3.rsa_camellia_128_sha", true); pref("security.ssl3.rsa_camellia_256_sha", true); pref("security.ssl3.rsa_aes_128_sha", true); pref("security.ssl3.rsa_aes_256_sha", true); -// Weak / deprecated + +// Deprecated pref("security.ssl3.dhe_rsa_aes_256_sha", false); pref("security.ssl3.dhe_rsa_aes_128_sha", false); pref("security.ssl3.rsa_aes_128_gcm_sha256", false); pref("security.ssl3.rsa_aes_128_sha256", false); + +// Weak/broken (requires fallback_hosts) pref("security.ssl3.rsa_des_ede3_sha", false); pref("security.ssl3.rsa_rc4_128_sha", false); pref("security.ssl3.rsa_rc4_128_md5", false); -- cgit v1.2.3