diff options
134 files changed, 71 insertions, 3443 deletions
diff --git a/accessible/base/Statistics.h b/accessible/base/Statistics.h deleted file mode 100644 index f5a9a85b8..000000000 --- a/accessible/base/Statistics.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef A11Y_STATISTICS_H_ -#define A11Y_STATISTICS_H_ - -#include "mozilla/Telemetry.h" - -namespace mozilla { -namespace a11y { -namespace statistics { - - inline void A11yInitialized() - { /* STUB */ } - - inline void A11yConsumers(uint32_t aConsumer) - { /* STUB */ } - - /** - * Report that ISimpleDOM* has been used. - */ - inline void ISimpleDOMUsed() - { /* STUB */ } - - /** - * Report that IAccessibleTable has been used. - */ - inline void IAccessibleTableUsed() - { /* STUB */ } - -} // namespace statistics -} // namespace a11y -} // namespace mozilla - -#endif - diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 46d4dde01..90d54e3ab 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -32,7 +32,6 @@ #include "RootAccessibleWrap.h" #endif #include "States.h" -#include "Statistics.h" #include "TextLeafAccessibleWrap.h" #include "TreeWalker.h" #include "xpcAccessibleApplication.h" @@ -1288,8 +1287,6 @@ nsAccessibilityService::Init() if (XRE_IsParentProcess()) PlatformInit(); - statistics::A11yInitialized(); - return true; } diff --git a/accessible/windows/ia2/ia2AccessibleTable.cpp b/accessible/windows/ia2/ia2AccessibleTable.cpp index a99f72def..cf0c0f3e2 100644 --- a/accessible/windows/ia2/ia2AccessibleTable.cpp +++ b/accessible/windows/ia2/ia2AccessibleTable.cpp @@ -13,7 +13,6 @@ #include "AccessibleWrap.h" #include "IUnknownImpl.h" -#include "Statistics.h" #include "TableAccessible.h" #include "nsCOMPtr.h" @@ -32,7 +31,6 @@ ia2AccessibleTable::QueryInterface(REFIID iid, void** ppv) *ppv = nullptr; if (IID_IAccessibleTable == iid) { - statistics::IAccessibleTableUsed(); *ppv = static_cast<IAccessibleTable*>(this); (reinterpret_cast<IUnknown*>(*ppv))->AddRef(); return S_OK; diff --git a/accessible/windows/msaa/Compatibility.cpp b/accessible/windows/msaa/Compatibility.cpp index 31026c586..9500e875d 100644 --- a/accessible/windows/msaa/Compatibility.cpp +++ b/accessible/windows/msaa/Compatibility.cpp @@ -7,7 +7,6 @@ #include "Compatibility.h" #include "nsWinUtils.h" -#include "Statistics.h" #include "mozilla/Preferences.h" @@ -52,8 +51,6 @@ uint32_t Compatibility::sConsumers = Compatibility::UNKNOWN; void Compatibility::Init() { - // Note we collect some AT statistics/telemetry here for convenience. - HMODULE jawsHandle = ::GetModuleHandleW(L"jhook"); if (jawsHandle) sConsumers |= (IsModuleVersionLessThan(jawsHandle, 8, 2173)) ? @@ -92,15 +89,6 @@ Compatibility::Init() if (sConsumers != Compatibility::UNKNOWN) sConsumers ^= Compatibility::UNKNOWN; - // Gather telemetry - uint32_t temp = sConsumers; - for (int i = 0; temp; i++) { - if (temp & 0x1) - statistics::A11yConsumers(i); - - temp >>= 1; - } - // Turn off new tab switching for Jaws and WE. if (sConsumers & (JAWS | OLDJAWS | WE)) { // Check to see if the pref for disallowing CtrlTab is already set. If so, diff --git a/accessible/windows/msaa/DocAccessibleWrap.cpp b/accessible/windows/msaa/DocAccessibleWrap.cpp index 895fe9192..1ef989cff 100644 --- a/accessible/windows/msaa/DocAccessibleWrap.cpp +++ b/accessible/windows/msaa/DocAccessibleWrap.cpp @@ -12,7 +12,6 @@ #include "Role.h" #include "RootAccessible.h" #include "sdnDocAccessible.h" -#include "Statistics.h" #include "nsIDocShell.h" #include "nsIInterfaceRequestorUtils.h" @@ -36,7 +35,6 @@ DocAccessibleWrap::~DocAccessibleWrap() IMPL_IUNKNOWN_QUERY_HEAD(DocAccessibleWrap) if (aIID == IID_ISimpleDOMDocument) { - statistics::ISimpleDOMUsed(); *aInstancePtr = static_cast<ISimpleDOMDocument*>(new sdnDocAccessible(this)); static_cast<IUnknown*>(*aInstancePtr)->AddRef(); return S_OK; diff --git a/accessible/windows/msaa/TextLeafAccessibleWrap.cpp b/accessible/windows/msaa/TextLeafAccessibleWrap.cpp index 6f1d193db..36126cb7a 100644 --- a/accessible/windows/msaa/TextLeafAccessibleWrap.cpp +++ b/accessible/windows/msaa/TextLeafAccessibleWrap.cpp @@ -7,13 +7,11 @@ #include "TextLeafAccessibleWrap.h" #include "sdnTextAccessible.h" -#include "Statistics.h" using namespace mozilla::a11y; IMPL_IUNKNOWN_QUERY_HEAD(TextLeafAccessibleWrap) if (aIID == IID_ISimpleDOMText) { - statistics::ISimpleDOMUsed(); *aInstancePtr = static_cast<ISimpleDOMText*>(new sdnTextAccessible(this)); static_cast<IUnknown*>(*aInstancePtr)->AddRef(); return S_OK; diff --git a/devtools/shared/heapsnapshot/HeapSnapshot.cpp b/devtools/shared/heapsnapshot/HeapSnapshot.cpp index b7b20dc17..299a96a9c 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshot.cpp +++ b/devtools/shared/heapsnapshot/HeapSnapshot.cpp @@ -1351,10 +1351,6 @@ class MOZ_STACK_CLASS HeapSnapshotHandler JS::CompartmentSet* compartments; public: - // For telemetry. - uint32_t nodeCount; - uint32_t edgeCount; - HeapSnapshotHandler(CoreDumpWriter& writer, JS::CompartmentSet* compartments) : writer(writer), @@ -1371,8 +1367,6 @@ public: NodeData*, bool first) { - edgeCount++; - // We're only interested in the first time we reach edge.referent, not in // every edge arriving at that node. "But, don't we want to serialize every // edge in the heap graph?" you ask. Don't worry! This edge is still @@ -1386,8 +1380,6 @@ public: if (!ShouldIncludeEdge(compartments, origin, edge, &policy)) return true; - nodeCount++; - if (policy == CoreDumpWriter::EXCLUDE_EDGES) traversal.abandonReferent(); @@ -1402,9 +1394,7 @@ WriteHeapGraph(JSContext* cx, CoreDumpWriter& writer, bool wantNames, JS::CompartmentSet* compartments, - JS::AutoCheckCannotGC& noGC, - uint32_t& outNodeCount, - uint32_t& outEdgeCount) + JS::AutoCheckCannotGC& noGC) { // Serialize the starting node to the core dump. @@ -1424,11 +1414,6 @@ WriteHeapGraph(JSContext* cx, bool ok = traversal.addStartVisited(node) && traversal.traverse(); - if (ok) { - outNodeCount = handler.nodeCount; - outEdgeCount = handler.edgeCount; - } - return ok; } @@ -1562,8 +1547,6 @@ ThreadSafeChromeUtils::SaveHeapSnapshot(GlobalObject& global, bool wantNames = true; CompartmentSet compartments; - uint32_t nodeCount = 0; - uint32_t edgeCount = 0; nsCOMPtr<nsIOutputStream> outputStream = getCoreDumpOutputStream(rv, start, outFilePath); if (NS_WARN_IF(rv.Failed())) @@ -1599,9 +1582,7 @@ ThreadSafeChromeUtils::SaveHeapSnapshot(GlobalObject& global, writer, wantNames, compartments.initialized() ? &compartments : nullptr, - maybeNoGC.ref(), - nodeCount, - edgeCount)) + maybeNoGC.ref())) { rv.Throw(zeroCopyStream.failed() ? zeroCopyStream.result() diff --git a/devtools/shared/heapsnapshot/HeapSnapshot.h b/devtools/shared/heapsnapshot/HeapSnapshot.h index 0428033f6..12dfa4c2b 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshot.h +++ b/devtools/shared/heapsnapshot/HeapSnapshot.h @@ -213,22 +213,7 @@ WriteHeapGraph(JSContext* cx, CoreDumpWriter& writer, bool wantNames, JS::CompartmentSet* compartments, - JS::AutoCheckCannotGC& noGC, - uint32_t& outNodeCount, - uint32_t& outEdgeCount); -inline bool -WriteHeapGraph(JSContext* cx, - const JS::ubi::Node& node, - CoreDumpWriter& writer, - bool wantNames, - JS::CompartmentSet* compartments, - JS::AutoCheckCannotGC& noGC) -{ - uint32_t ignoreNodeCount; - uint32_t ignoreEdgeCount; - return WriteHeapGraph(cx, node, writer, wantNames, compartments, noGC, - ignoreNodeCount, ignoreEdgeCount); -} + JS::AutoCheckCannotGC& noGC); // Get the mozilla::MallocSizeOf for the current thread's JSRuntime. MallocSizeOf GetCurrentThreadDebuggerMallocSizeOf(); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index e6fa5a200..7f8a693cc 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -27,7 +27,6 @@ #include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "mozilla/StartupTimeline.h" -#include "mozilla/Telemetry.h" #include "mozilla/Unused.h" #include "Navigator.h" #include "URIUtils.h" @@ -194,7 +193,6 @@ #include "nsSandboxFlags.h" #include "nsXULAppAPI.h" #include "nsDOMNavigationTiming.h" -#include "nsISecurityUITelemetry.h" #include "nsIAppsService.h" #include "nsDSURIContentListener.h" #include "nsDocShellLoadTypes.h" @@ -4985,15 +4983,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, cssClass.AssignLiteral("badStsCert"); } - uint32_t bucketId; - if (isStsHost) { - // measuring STS separately allows us to measure click through - // rates easily - bucketId = nsISecurityUITelemetry::WARNING_BAD_CERT_TOP_STS; - } else { - bucketId = nsISecurityUITelemetry::WARNING_BAD_CERT_TOP; - } - // See if an alternate cert error page is registered nsAdoptingCString alternateErrorPage = Preferences::GetCString("security.alternate_certificate_error_page"); @@ -5021,23 +5010,12 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, errorPage.Assign(alternateErrorPage); } - uint32_t bucketId; - bool sendTelemetry = false; if (NS_ERROR_PHISHING_URI == aError) { - sendTelemetry = true; error.AssignLiteral("deceptiveBlocked"); - bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_PHISHING_PAGE_FRAME - : nsISecurityUITelemetry::WARNING_PHISHING_PAGE_TOP; } else if (NS_ERROR_MALWARE_URI == aError) { - sendTelemetry = true; error.AssignLiteral("malwareBlocked"); - bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_MALWARE_PAGE_FRAME - : nsISecurityUITelemetry::WARNING_MALWARE_PAGE_TOP; } else if (NS_ERROR_UNWANTED_URI == aError) { - sendTelemetry = true; error.AssignLiteral("unwantedBlocked"); - bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_UNWANTED_PAGE_FRAME - : nsISecurityUITelemetry::WARNING_UNWANTED_PAGE_TOP; } cssClass.AssignLiteral("blacklist"); diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 291df5f27..2ab5937ac 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -4033,8 +4033,6 @@ nsDOMWindowUtils::ForceUseCounterFlush(nsIDOMNode *aNode) if (nsCOMPtr<nsIDocument> doc = do_QueryInterface(aNode)) { mozilla::css::ImageLoader* loader = doc->StyleImageLoader(); loader->FlushUseCounters(); - - static_cast<nsDocument*>(doc.get())->ReportUseCounters(); return NS_OK; } diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index e779c060c..14de65cbd 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1395,63 +1395,6 @@ nsDocument::~nsDocument() NS_ASSERTION(!mIsShowing, "Destroying a currently-showing document"); - if (IsTopLevelContentDocument()) { - //don't report for about: pages - if (!IsAboutPage()) { - // Record the page load - uint32_t pageLoaded = 1; - Accumulate(Telemetry::MIXED_CONTENT_UNBLOCK_COUNTER, pageLoaded); - // Record the mixed content status of the docshell in Telemetry - enum { - NO_MIXED_CONTENT = 0, // There is no Mixed Content on the page - MIXED_DISPLAY_CONTENT = 1, // The page attempted to load Mixed Display Content - MIXED_ACTIVE_CONTENT = 2, // The page attempted to load Mixed Active Content - MIXED_DISPLAY_AND_ACTIVE_CONTENT = 3 // The page attempted to load Mixed Display & Mixed Active Content - }; - - bool mixedActiveLoaded = GetHasMixedActiveContentLoaded(); - bool mixedActiveBlocked = GetHasMixedActiveContentBlocked(); - - bool mixedDisplayLoaded = GetHasMixedDisplayContentLoaded(); - bool mixedDisplayBlocked = GetHasMixedDisplayContentBlocked(); - - bool hasMixedDisplay = (mixedDisplayBlocked || mixedDisplayLoaded); - bool hasMixedActive = (mixedActiveBlocked || mixedActiveLoaded); - - uint32_t mixedContentLevel = NO_MIXED_CONTENT; - if (hasMixedDisplay && hasMixedActive) { - mixedContentLevel = MIXED_DISPLAY_AND_ACTIVE_CONTENT; - } else if (hasMixedActive){ - mixedContentLevel = MIXED_ACTIVE_CONTENT; - } else if (hasMixedDisplay) { - mixedContentLevel = MIXED_DISPLAY_CONTENT; - } - Accumulate(Telemetry::MIXED_CONTENT_PAGE_LOAD, mixedContentLevel); - - // record mixed object subrequest telemetry - if (mHasMixedContentObjectSubrequest) { - /* mixed object subrequest loaded on page*/ - Accumulate(Telemetry::MIXED_CONTENT_OBJECT_SUBREQUEST, 1); - } else { - /* no mixed object subrequests loaded on page*/ - Accumulate(Telemetry::MIXED_CONTENT_OBJECT_SUBREQUEST, 0); - } - - // record CSP telemetry on this document - if (mHasCSP) { - Accumulate(Telemetry::CSP_DOCUMENTS_COUNT, 1); - } - if (mHasUnsafeInlineCSP) { - Accumulate(Telemetry::CSP_UNSAFE_INLINE_DOCUMENTS_COUNT, 1); - } - if (mHasUnsafeEvalCSP) { - Accumulate(Telemetry::CSP_UNSAFE_EVAL_DOCUMENTS_COUNT, 1); - } - } - } - - ReportUseCounters(); - mInDestructor = true; mInUnlinkOrDeletion = true; @@ -12353,23 +12296,6 @@ nsIDocument::InlineScriptAllowedByCSP() return allowsInlineScript; } -static bool -MightBeAboutOrChromeScheme(nsIURI* aURI) -{ - MOZ_ASSERT(aURI); - bool isAbout = true; - bool isChrome = true; - aURI->SchemeIs("about", &isAbout); - aURI->SchemeIs("chrome", &isChrome); - return isAbout || isChrome; -} - -void -nsDocument::ReportUseCounters() -{ -/* STUB */ -} - void nsDocument::AddIntersectionObserver(DOMIntersectionObserver* aObserver) { diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index d2f97a33e..95fd57545 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -774,8 +774,6 @@ public: virtual nsViewportInfo GetViewportInfo(const mozilla::ScreenIntSize& aDisplaySize) override; - void ReportUseCounters(); - virtual void AddIntersectionObserver( mozilla::dom::DOMIntersectionObserver* aObserver) override; virtual void RemoveIntersectionObserver( @@ -1449,14 +1447,6 @@ public: // 'style-sheet-applicable-state-changed' notification. bool mSSApplicableStateNotificationPending:1; - // Whether we have reported use counters for this document with Telemetry yet. - // Normally this is only done at document destruction time, but for image - // documents (SVG documents) that are not guaranteed to be destroyed, we - // report use counters when the image cache no longer has any imgRequestProxys - // pointing to them. We track whether we ever reported use counters so - // that we only report them once for the document. - bool mReportedUseCounters:1; - // Whether we have filled our pres shell's style set with the document's // additional sheets and sheets from the nsStyleSheetService. bool mStyleSetFilled:1; diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index f173678b7..f4c4ca0f1 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -706,12 +706,6 @@ nsFrameMessageManager::SendRpcMessage(const nsAString& aMessageName, static bool AllowMessage(size_t aDataLength, const nsAString& aMessageName) { - static const size_t kMinTelemetryMessageSize = 8192; - - if (aDataLength < kMinTelemetryMessageSize) { - return true; - } - NS_ConvertUTF16toUTF8 messageName(aMessageName); messageName.StripChars("0123456789"); diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 677e1a0ea..de2ebdefe 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -288,7 +288,6 @@ static bool gMouseDown = false; static bool gDragServiceDisabled = false; static FILE *gDumpFile = nullptr; static uint32_t gSerialCounter = 0; -static TimeStamp gLastRecordedRecentTimeouts; #define STATISTICS_INTERVAL (30 * PR_MSEC_PER_SEC) #ifdef DEBUG_jst @@ -1518,7 +1517,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow) mIsPopupSpam(false), mBlockScriptedClosingFlag(false), mWasOffline(false), - mHasHadSlowScript(false), mNotifyIdleObserversIdleOnThaw(false), mNotifyIdleObserversActiveOnThaw(false), mCreatingInnerWindow(false), @@ -11542,8 +11540,6 @@ nsGlobalWindow::ShowSlowScriptDialog() unsigned lineno; bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno); - mHasHadSlowScript = true; - if (XRE_IsContentProcess() && ProcessHangMonitor::Get()) { ProcessHangMonitor::SlowScriptAction action; @@ -13399,13 +13395,6 @@ nsGlobalWindow::RunTimeout(Timeout* aTimeout) return; } - // Record telemetry information about timers set recently. - TimeDuration recordingInterval = TimeDuration::FromMilliseconds(STATISTICS_INTERVAL); - if (gLastRecordedRecentTimeouts.IsNull() || - now - gLastRecordedRecentTimeouts > recordingInterval) { - gLastRecordedRecentTimeouts = now; - } - // Insert a dummy timeout into the list of timeouts between the // portion of the list that we are about to process now and those // timeouts that will be processed in a future call to diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 1cb825a77..1f420895c 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1780,11 +1780,6 @@ protected: // Window offline status. Checked to see if we need to fire offline event bool mWasOffline : 1; - // Represents whether the inner window's page has had a slow script notice. - // Only used by inner windows; will always be false for outer windows. - // This is used to implement Telemetry measures such as SLOW_SCRIPT_PAGE_COUNT. - bool mHasHadSlowScript : 1; - // Track what sorts of events we need to fire when thawed bool mNotifyIdleObserversIdleOnThaw : 1; bool mNotifyIdleObserversActiveOnThaw : 1; diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 709c7aa56..c1b732258 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -1582,7 +1582,6 @@ nsObjectLoadingContent::MaybeRewriteYoutubeEmbed(nsIURI* aURI, nsIURI* aBaseURI, } } - // If we're pref'd off, return after telemetry has been logged. if (!Preferences::GetBool(kPrefYoutubeRewrite)) { return; } diff --git a/dom/geolocation/nsGeolocation.cpp b/dom/geolocation/nsGeolocation.cpp index 244018ee8..846e7fff4 100644 --- a/dom/geolocation/nsGeolocation.cpp +++ b/dom/geolocation/nsGeolocation.cpp @@ -7,7 +7,6 @@ #include "nsXULAppAPI.h" #include "mozilla/dom/ContentChild.h" -#include "mozilla/Telemetry.h" #include "mozilla/UniquePtr.h" #include "nsGeolocation.h" @@ -70,7 +69,6 @@ class nsGeolocationRequest final GeoPositionCallback aCallback, GeoPositionErrorCallback aErrorCallback, UniquePtr<PositionOptions>&& aOptions, - uint8_t aProtocolType, bool aWatchPositionRequest = false, int32_t aWatchId = 0); @@ -119,7 +117,6 @@ class nsGeolocationRequest final int32_t mWatchId; bool mShutdown; nsCOMPtr<nsIContentPermissionRequester> mRequester; - uint8_t mProtocolType; }; static UniquePtr<PositionOptions> @@ -287,7 +284,6 @@ nsGeolocationRequest::nsGeolocationRequest(Geolocation* aLocator, GeoPositionCallback aCallback, GeoPositionErrorCallback aErrorCallback, UniquePtr<PositionOptions>&& aOptions, - uint8_t aProtocolType, bool aWatchPositionRequest, int32_t aWatchId) : mIsWatchPositionRequest(aWatchPositionRequest), @@ -296,8 +292,7 @@ nsGeolocationRequest::nsGeolocationRequest(Geolocation* aLocator, mOptions(Move(aOptions)), mLocator(aLocator), mWatchId(aWatchId), - mShutdown(false), - mProtocolType(aProtocolType) + mShutdown(false) { if (nsCOMPtr<nsPIDOMWindowInner> win = do_QueryReferent(mLocator->GetOwner())) { @@ -949,8 +944,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Geolocation, mPendingRequests) Geolocation::Geolocation() -: mProtocolType(ProtocolType::OTHER) -, mLastWatchId(0) +: mLastWatchId(0) { } @@ -982,23 +976,6 @@ Geolocation::Init(nsPIDOMWindowInner* aContentDom) nsCOMPtr<nsIURI> uri; nsresult rv = mPrincipal->GetURI(getter_AddRefs(uri)); NS_ENSURE_SUCCESS(rv, rv); - - if (uri) { - bool isHttp; - rv = uri->SchemeIs("http", &isHttp); - NS_ENSURE_SUCCESS(rv, rv); - - bool isHttps; - rv = uri->SchemeIs("https", &isHttps); - NS_ENSURE_SUCCESS(rv, rv); - - // Store the protocol to send via telemetry later. - if (isHttp) { - mProtocolType = ProtocolType::HTTP; - } else if (isHttps) { - mProtocolType = ProtocolType::HTTPS; - } - } } // If no aContentDom was passed into us, we are being used @@ -1185,7 +1162,7 @@ Geolocation::GetCurrentPosition(GeoPositionCallback callback, RefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this, Move(callback), Move(errorCallback), - Move(options), static_cast<uint8_t>(mProtocolType), + Move(options), false); if (!sGeoEnabled) { @@ -1263,7 +1240,7 @@ Geolocation::WatchPosition(GeoPositionCallback aCallback, RefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this, Move(aCallback), Move(aErrorCallback), Move(aOptions), - static_cast<uint8_t>(mProtocolType), true, *aRv); + true, *aRv); if (!sGeoEnabled) { nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(false, request); diff --git a/dom/geolocation/nsGeolocation.h b/dom/geolocation/nsGeolocation.h index 0bc527e34..0bcc587e4 100644 --- a/dom/geolocation/nsGeolocation.h +++ b/dom/geolocation/nsGeolocation.h @@ -202,12 +202,6 @@ private: // where the content was loaded from nsCOMPtr<nsIPrincipal> mPrincipal; - // the protocols we want to measure - enum class ProtocolType: uint8_t { OTHER, HTTP, HTTPS }; - - // the protocol used to load the content - ProtocolType mProtocolType; - // owning back pointer. RefPtr<nsGeolocationService> mService; diff --git a/dom/html/HTMLFormElement.cpp b/dom/html/HTMLFormElement.cpp index 0393ed3e0..6bea19a2b 100644 --- a/dom/html/HTMLFormElement.cpp +++ b/dom/html/HTMLFormElement.cpp @@ -51,7 +51,6 @@ #include "nsIWebProgress.h" #include "nsIDocShell.h" #include "nsIPrompt.h" -#include "nsISecurityUITelemetry.h" #include "nsIStringBundle.h" // radio buttons @@ -954,8 +953,6 @@ HTMLFormElement::DoSecureToInsecureSubmitCheck(nsIURI* aActionURL, return rv; } *aCancelSubmit = (buttonPressed == 1); - uint32_t telemetryBucket = - nsISecurityUITelemetry::WARNING_CONFIRM_POST_TO_INSECURE_FROM_SECURE; return NS_OK; } diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index 4b2e7a07b..fab1cdef4 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -1345,8 +1345,6 @@ HTMLImageElement::FlushUseCounters() nsCOMPtr<imgIContainer> container; request->GetImage(getter_AddRefs(container)); - - static_cast<image::Image*>(container.get())->ReportUseCounters(); } } // namespace dom diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 6171e1766..050d1ac69 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -1037,14 +1037,6 @@ void HTMLMediaElement::ShutdownDecoder() void HTMLMediaElement::AbortExistingLoads() { -#ifdef MOZ_EME - // If there is no existing decoder then we don't have anything to - // report. This prevents reporting the initial load from an - // empty video element as a failed EME load. - if (mDecoder) { - ReportEMETelemetry(); - } -#endif // Abort any already-running instance of the resource selection algorithm. mLoadWaitStatus = NOT_WAITING; @@ -1900,7 +1892,6 @@ NS_IMETHODIMP HTMLMediaElement::GetCurrentTime(double* aCurrentTime) void HTMLMediaElement::FastSeek(double aTime, ErrorResult& aRv) { - LOG(LogLevel::Debug, ("Reporting telemetry VIDEO_FASTSEEK_USED")); RefPtr<Promise> tobeDropped = Seek(aTime, SeekTarget::PrevSyncPoint, aRv); } @@ -3154,10 +3145,6 @@ HTMLMediaElement::~HTMLMediaElement() if (mProgressTimer) { StopProgress(); } - if (mVideoDecodeSuspendTimer) { - mVideoDecodeSuspendTimer->Cancel(); - mVideoDecodeSuspendTimer = nullptr; - } if (mSrcStream) { EndSrcMediaStreamPlayback(); } @@ -3648,191 +3635,6 @@ nsresult HTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParen return rv; } -/* static */ -void HTMLMediaElement::VideoDecodeSuspendTimerCallback(nsITimer* aTimer, void* aClosure) -{ - MOZ_ASSERT(NS_IsMainThread()); - auto element = static_cast<HTMLMediaElement*>(aClosure); - element->mVideoDecodeSuspendTime.Start(); - element->mVideoDecodeSuspendTimer = nullptr; -} - -void HTMLMediaElement::HiddenVideoStart() -{ - MOZ_ASSERT(NS_IsMainThread()); - mHiddenPlayTime.Start(); - if (mVideoDecodeSuspendTimer) { - // Already started, just keep it running. - return; - } - mVideoDecodeSuspendTimer = do_CreateInstance("@mozilla.org/timer;1"); - mVideoDecodeSuspendTimer->InitWithNamedFuncCallback( - VideoDecodeSuspendTimerCallback, this, - MediaPrefs::MDSMSuspendBackgroundVideoDelay(), nsITimer::TYPE_ONE_SHOT, - "HTMLMediaElement::VideoDecodeSuspendTimerCallback"); -} - -void HTMLMediaElement::HiddenVideoStop() -{ - MOZ_ASSERT(NS_IsMainThread()); - mHiddenPlayTime.Pause(); - mVideoDecodeSuspendTime.Pause(); - if (!mVideoDecodeSuspendTimer) { - return; - } - mVideoDecodeSuspendTimer->Cancel(); - mVideoDecodeSuspendTimer = nullptr; -} - -#ifdef MOZ_EME -void -HTMLMediaElement::ReportEMETelemetry() -{ - // Report telemetry for EME videos when a page is unloaded. - NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); - if (mIsEncrypted && Preferences::GetBool("media.eme.enabled")) { - LOG(LogLevel::Debug, ("%p VIDEO_EME_PLAY_SUCCESS = %s", - this, mLoadedDataFired ? "true" : "false")); - } -} -#endif - -void -HTMLMediaElement::ReportTelemetry() -{ - // Report telemetry for videos when a page is unloaded. We - // want to know data on what state the video is at when - // the user has exited. - enum UnloadedState { - ENDED = 0, - PAUSED = 1, - STALLED = 2, - SEEKING = 3, - OTHER = 4 - }; - - UnloadedState state = OTHER; - if (Seeking()) { - state = SEEKING; - } - else if (Ended()) { - state = ENDED; - } - else if (Paused()) { - state = PAUSED; - } - else { - // For buffering we check if the current playback position is at the end - // of a buffered range, within a margin of error. We also consider to be - // buffering if the last frame status was buffering and the ready state is - // HAVE_CURRENT_DATA to account for times where we are in a buffering state - // regardless of what actual data we have buffered. - bool stalled = false; - RefPtr<TimeRanges> ranges = Buffered(); - const double errorMargin = 0.05; - double t = CurrentTime(); - TimeRanges::index_type index = ranges->Find(t, errorMargin); - ErrorResult ignore; - stalled = index != TimeRanges::NoIndex && - (ranges->End(index, ignore) - t) < errorMargin; - stalled |= mDecoder && NextFrameStatus() == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING && - mReadyState == HTMLMediaElement::HAVE_CURRENT_DATA; - if (stalled) { - state = STALLED; - } - } - - LOG(LogLevel::Debug, ("%p VIDEO_UNLOAD_STATE = %d", this, state)); - - FrameStatisticsData data; - - if (HTMLVideoElement* vid = HTMLVideoElement::FromContentOrNull(this)) { - FrameStatistics* stats = vid->GetFrameStatistics(); - if (stats) { - data = stats->GetFrameStatisticsData(); - if (data.mParsedFrames) { - MOZ_ASSERT(data.mDroppedFrames <= data.mParsedFrames); - // Dropped frames <= total frames, so 'percentage' cannot be higher than - // 100 and therefore can fit in a uint32_t (that Telemetry takes). - uint32_t percentage = 100 * data.mDroppedFrames / data.mParsedFrames; - LOG(LogLevel::Debug, - ("Reporting telemetry DROPPED_FRAMES_IN_VIDEO_PLAYBACK")); - } - } - } - - if (mMediaInfo.HasVideo() && - mMediaInfo.mVideo.mImage.height > 0) { - // We have a valid video. - double playTime = mPlayTime.Total(); - double hiddenPlayTime = mHiddenPlayTime.Total(); - double videoDecodeSuspendTime = mVideoDecodeSuspendTime.Total(); - - LOG(LogLevel::Debug, ("%p VIDEO_PLAY_TIME_MS = %f", this, playTime)); - - LOG(LogLevel::Debug, ("%p VIDEO_HIDDEN_PLAY_TIME_MS = %f", this, hiddenPlayTime)); - - if (playTime > 0.0) { - // We have actually played something -> Report some valid-video telemetry. - - // Keyed by audio+video or video alone, and by a resolution range. - nsCString key(mMediaInfo.HasAudio() ? "AV," : "V,"); - static const struct { int32_t mH; const char* mRes; } sResolutions[] = { - { 240, "0<h<=240" }, - { 480, "240<h<=480" }, - { 576, "480<h<=576" }, - { 720, "576<h<=720" }, - { 1080, "720<h<=1080" }, - { 2160, "1080<h<=2160" } - }; - const char* resolution = "h>2160"; - int32_t height = mMediaInfo.mVideo.mImage.height; - for (const auto& res : sResolutions) { - if (height <= res.mH) { - resolution = res.mRes; - break; - } - } - key.AppendASCII(resolution); - - uint32_t hiddenPercentage = uint32_t(hiddenPlayTime / playTime * 100.0 + 0.5); - LOG(LogLevel::Debug, ("%p VIDEO_HIDDEN_PLAY_TIME_PERCENTAGE = %u, keys: '%s' and 'All'", - this, hiddenPercentage, key.get())); - - uint32_t videoDecodeSuspendPercentage = - uint32_t(videoDecodeSuspendTime / playTime * 100.0 + 0.5); - LOG(LogLevel::Debug, ("%p VIDEO_INFERRED_DECODE_SUSPEND_PERCENTAGE = %u, keys: '%s' and 'All'", - this, videoDecodeSuspendPercentage, key.get())); - - if (data.mInterKeyframeCount != 0) { - uint32_t average_ms = - uint32_t(std::min<uint64_t>(double(data.mInterKeyframeSum_us) - / double(data.mInterKeyframeCount) - / 1000.0 - + 0.5, - UINT32_MAX)); - LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_AVERAGE_MS = %u, keys: '%s' and 'All'", - this, average_ms, key.get())); - - uint32_t max_ms = - uint32_t(std::min<uint64_t>((data.mInterKeyFrameMax_us + 500) / 1000, - UINT32_MAX)); - LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = %u, keys: '%s' and 'All'", - this, max_ms, key.get())); - } else { - // Here, we have played *some* of the video, but didn't get more than 1 - // keyframe. Report '0' if we have played for longer than the video- - // decode-suspend delay (showing recovery would be difficult). - uint32_t suspendDelay_ms = MediaPrefs::MDSMSuspendBackgroundVideoDelay(); - if (uint32_t(playTime * 1000.0) > suspendDelay_ms) { - LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = 0 (only 1 keyframe), keys: '%s' and 'All'", - this, key.get())); - } - } - } - } -} - void HTMLMediaElement::UnbindFromTree(bool aDeep, bool aNullParent) { @@ -5312,19 +5114,6 @@ nsresult HTMLMediaElement::DispatchAsyncEvent(const nsAString& aName) nsCOMPtr<nsIRunnable> event = new nsAsyncEventRunner(aName, this); NS_DispatchToMainThread(event); - if ((aName.EqualsLiteral("play") || aName.EqualsLiteral("playing"))) { - mPlayTime.Start(); - if (IsHidden()) { - HiddenVideoStart(); - } - } else if (aName.EqualsLiteral("waiting")) { - mPlayTime.Pause(); - HiddenVideoStop(); - } else if (aName.EqualsLiteral("pause")) { - mPlayTime.Pause(); - HiddenVideoStop(); - } - return NS_OK; } @@ -5450,11 +5239,6 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE UpdateSrcMediaStreamPlaying(); UpdateAudioChannelPlayingState(); if (aPauseElement) { - ReportTelemetry(); -#ifdef MOZ_EME - ReportEMETelemetry(); -#endif - #ifdef MOZ_EME // For EME content, we may force destruction of the CDM client (and CDM // instance if this is the last client for that CDM instance) and @@ -5506,13 +5290,6 @@ bool HTMLMediaElement::IsBeingDestroyed() void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() { bool visible = !IsHidden(); - if (visible) { - // Visible -> Just pause hidden play time (no-op if already paused). - HiddenVideoStop(); - } else if (mPlayTime.IsStarted()) { - // Not visible, play time is running -> Start hidden play time if needed. - HiddenVideoStart(); - } if (mDecoder && !IsBeingDestroyed()) { mDecoder->NotifyOwnerActivityChanged(visible); @@ -6288,18 +6065,10 @@ HTMLMediaElement::OnVisibilityChange(Visibility aNewVisibility) break; } case Visibility::APPROXIMATELY_NONVISIBLE: { - if (mPlayTime.IsStarted()) { - // Not visible, play time is running -> Start hidden play time if needed. - HiddenVideoStart(); - } - mDecoder->NotifyOwnerActivityChanged(false); break; } case Visibility::APPROXIMATELY_VISIBLE: { - // Visible -> Just pause hidden play time (no-op if already paused). - HiddenVideoStop(); - mDecoder->NotifyOwnerActivityChanged(true); break; } diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h index af944a318..899e8449a 100644 --- a/dom/html/HTMLMediaElement.h +++ b/dom/html/HTMLMediaElement.h @@ -1195,29 +1195,6 @@ protected: return isPaused; } - /** - * Video has been playing while hidden and, if feature was enabled, would - * trigger suspending decoder. - * Used to track hidden-video-decode-suspend telemetry. - */ - static void VideoDecodeSuspendTimerCallback(nsITimer* aTimer, void* aClosure); - /** - * Video is now both: playing and hidden. - * Used to track hidden-video telemetry. - */ - void HiddenVideoStart(); - /** - * Video is not playing anymore and/or has become visible. - * Used to track hidden-video telemetry. - */ - void HiddenVideoStop(); - -#ifdef MOZ_EME - void ReportEMETelemetry(); -#endif - - void ReportTelemetry(); - // Check the permissions for audiochannel. bool CheckAudioChannelPermissions(const nsAString& aType); @@ -1484,9 +1461,6 @@ protected: // Timer used for updating progress events. nsCOMPtr<nsITimer> mProgressTimer; - // Timer used to simulate video-suspend. - nsCOMPtr<nsITimer> mVideoDecodeSuspendTimer; - #ifdef MOZ_EME // Encrypted Media Extension media keys. RefPtr<MediaKeys> mMediaKeys; @@ -1688,65 +1662,7 @@ protected: // before attaching to the DOM tree. bool mUnboundFromTree = false; -public: - // Helper class to measure times for MSE telemetry stats - class TimeDurationAccumulator - { - public: - TimeDurationAccumulator() - : mCount(0) - {} - void Start() - { - if (IsStarted()) { - return; - } - mStartTime = TimeStamp::Now(); - } - void Pause() - { - if (!IsStarted()) { - return; - } - mSum += (TimeStamp::Now() - mStartTime); - mCount++; - mStartTime = TimeStamp(); - } - bool IsStarted() const - { - return !mStartTime.IsNull(); - } - double Total() const - { - if (!IsStarted()) { - return mSum.ToSeconds(); - } - // Add current running time until now, but keep it running. - return (mSum + (TimeStamp::Now() - mStartTime)).ToSeconds(); - } - uint32_t Count() const - { - if (!IsStarted()) { - return mCount; - } - // Count current run in this report, without increasing the stored count. - return mCount + 1; - } - private: - TimeStamp mStartTime; - TimeDuration mSum; - uint32_t mCount; - }; private: - // Total time a video has spent playing. - TimeDurationAccumulator mPlayTime; - - // Total time a video has spent playing while hidden. - TimeDurationAccumulator mHiddenPlayTime; - - // Total time a video has (or would have) spent in video-decode-suspend mode. - TimeDurationAccumulator mVideoDecodeSuspendTime; - // Indicates if user has interacted with the element. // Used to block autoplay when disabled. bool mHasUserInteraction; diff --git a/dom/html/TextTrackManager.cpp b/dom/html/TextTrackManager.cpp index cc14858b6..7f9d32794 100644 --- a/dom/html/TextTrackManager.cpp +++ b/dom/html/TextTrackManager.cpp @@ -118,7 +118,6 @@ TextTrackManager::TextTrackManager(HTMLMediaElement *aMediaElement) , mTimeMarchesOnDispatched(false) , mUpdateCueDisplayDispatched(false) , performedTrackSelection(false) - , mCueTelemetryReported(false) , mShutdown(false) { nsISupports* parentObject = @@ -170,7 +169,6 @@ TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel, mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aReadyState, aTextTrackSource, CompareTextTracks(mMediaElement)); AddCues(track); - ReportTelemetryForTrack(track); if (aTextTrackSource == TextTrackSource::Track) { RefPtr<nsIRunnable> task = @@ -190,7 +188,6 @@ TextTrackManager::AddTextTrack(TextTrack* aTextTrack) WEBVTT_LOG("%p AddTextTrack TextTrack %p",this, aTextTrack); mTextTracks->AddTextTrack(aTextTrack, CompareTextTracks(mMediaElement)); AddCues(aTextTrack); - ReportTelemetryForTrack(aTextTrack); if (aTextTrack->GetTextTrackSource() == TextTrackSource::Track) { RefPtr<nsIRunnable> task = @@ -309,7 +306,6 @@ TextTrackManager::NotifyCueAdded(TextTrackCue& aCue) mNewCues->AddCue(aCue); } DispatchTimeMarchesOn(); - ReportTelemetryForCue(); } void @@ -827,17 +823,5 @@ TextTrackManager::NotifyReset() mLastTimeMarchesOnCalled = 0.0; } -void -TextTrackManager::ReportTelemetryForTrack(TextTrack* aTextTrack) const -{ -/* STUB */ -} - -void -TextTrackManager::ReportTelemetryForCue() -{ -/* STUB */ -} - } // namespace dom } // namespace mozilla diff --git a/dom/html/TextTrackManager.h b/dom/html/TextTrackManager.h index 4ad1a57a7..2375aa4bb 100644 --- a/dom/html/TextTrackManager.h +++ b/dom/html/TextTrackManager.h @@ -148,13 +148,6 @@ private: nsTArray<TextTrack*>& aTextTracks); bool TrackIsDefault(TextTrack* aTextTrack); - void ReportTelemetryForTrack(TextTrack* aTextTrack) const; - void ReportTelemetryForCue(); - - // If there is at least one cue has been added to the cue list once, we would - // report the usage of cue to Telemetry. - bool mCueTelemetryReported; - class ShutdownObserverProxy final : public nsIObserver { NS_DECL_ISUPPORTS diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 58c113058..38621cee3 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -4129,7 +4129,6 @@ GetDatabaseFileURL(nsIFile* aDatabaseFile, PersistenceType aPersistenceType, const nsACString& aGroup, const nsACString& aOrigin, - uint32_t aTelemetryId, nsIFileURL** aResult) { MOZ_ASSERT(aDatabaseFile); @@ -4161,18 +4160,10 @@ GetDatabaseFileURL(nsIFile* aDatabaseFile, nsAutoCString type; PersistenceTypeToText(aPersistenceType, type); - nsAutoCString telemetryFilenameClause; - if (aTelemetryId) { - telemetryFilenameClause.AssignLiteral("&telemetryFilename=indexedDB-"); - telemetryFilenameClause.AppendInt(aTelemetryId); - telemetryFilenameClause.AppendLiteral(".sqlite"); - } - rv = fileUrl->SetQuery(NS_LITERAL_CSTRING("persistenceType=") + type + NS_LITERAL_CSTRING("&group=") + aGroup + NS_LITERAL_CSTRING("&origin=") + aOrigin + - NS_LITERAL_CSTRING("&cache=private") + - telemetryFilenameClause); + NS_LITERAL_CSTRING("&cache=private")); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -4422,7 +4413,6 @@ CreateStorageConnection(nsIFile* aDBFile, PersistenceType aPersistenceType, const nsACString& aGroup, const nsACString& aOrigin, - uint32_t aTelemetryId, mozIStorageConnection** aConnection) { AssertIsOnIOThread(); @@ -4454,7 +4444,6 @@ CreateStorageConnection(nsIFile* aDBFile, aPersistenceType, aGroup, aOrigin, - aTelemetryId, getter_AddRefs(dbFileUrl)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -4890,7 +4879,6 @@ GetStorageConnection(nsIFile* aDatabaseFile, PersistenceType aPersistenceType, const nsACString& aGroup, const nsACString& aOrigin, - uint32_t aTelemetryId, mozIStorageConnection** aConnection) { MOZ_ASSERT(!NS_IsMainThread()); @@ -4918,7 +4906,6 @@ GetStorageConnection(nsIFile* aDatabaseFile, aPersistenceType, aGroup, aOrigin, - aTelemetryId, getter_AddRefs(dbFileUrl)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -4955,7 +4942,6 @@ GetStorageConnection(const nsAString& aDatabaseFilePath, PersistenceType aPersistenceType, const nsACString& aGroup, const nsACString& aOrigin, - uint32_t aTelemetryId, mozIStorageConnection** aConnection) { MOZ_ASSERT(!NS_IsMainThread()); @@ -4974,7 +4960,6 @@ GetStorageConnection(const nsAString& aDatabaseFilePath, aPersistenceType, aGroup, aOrigin, - aTelemetryId, aConnection); } @@ -6296,7 +6281,6 @@ private: const nsCString mId; const nsString mFilePath; uint32_t mActiveMutableFileCount; - const uint32_t mTelemetryId; const PersistenceType mPersistenceType; const bool mFileHandleDisabled; const bool mChromeWriteAccessAllowed; @@ -6313,7 +6297,6 @@ public: const Maybe<ContentParentId>& aOptionalContentParentId, const nsACString& aGroup, const nsACString& aOrigin, - uint32_t aTelemetryId, FullDatabaseMetadata* aMetadata, FileManager* aFileManager, already_AddRefed<DirectoryLock> aDirectoryLock, @@ -6372,12 +6355,6 @@ public: return mId; } - uint32_t - TelemetryId() const - { - return mTelemetryId; - } - PersistenceType Type() const { @@ -7673,8 +7650,6 @@ class OpenDatabaseOp final // cycles. VersionChangeOp* mVersionChangeOp; - uint32_t mTelemetryId; - public: OpenDatabaseOp(Factory* aFactory, already_AddRefed<ContentParent> aContentParent, @@ -10302,13 +10277,6 @@ typedef nsDataHashtable<nsIDHashKey, DatabaseLoggingInfo*> StaticAutoPtr<DatabaseLoggingInfoHashtable> gLoggingInfoHashtable; -typedef nsDataHashtable<nsUint32HashKey, uint32_t> TelemetryIdHashtable; - -StaticAutoPtr<TelemetryIdHashtable> gTelemetryIdHashtable; - -// Protects all reads and writes to gTelemetryIdHashtable. -StaticAutoPtr<Mutex> gTelemetryIdMutex; - #ifdef DEBUG StaticRefPtr<DEBUGThreadSlower> gDEBUGThreadSlower; @@ -10404,88 +10372,6 @@ DecreaseBusyCount() } } -uint32_t -TelemetryIdForFile(nsIFile* aFile) -{ - // May be called on any thread! - - MOZ_ASSERT(aFile); - MOZ_ASSERT(gTelemetryIdMutex); - - // The storage directory is structured like this: - // - // <profile>/storage/<persistence>/<origin>/idb/<filename>.sqlite - // - // For the purposes of this function we're only concerned with the - // <persistence>, <origin>, and <filename> pieces. - - nsString filename; - MOZ_ALWAYS_SUCCEEDS(aFile->GetLeafName(filename)); - - // Make sure we were given a database file. - NS_NAMED_LITERAL_STRING(sqliteExtension, ".sqlite"); - - MOZ_ASSERT(StringEndsWith(filename, sqliteExtension)); - - filename.Truncate(filename.Length() - sqliteExtension.Length()); - - // Get the "idb" directory. - nsCOMPtr<nsIFile> idbDirectory; - MOZ_ALWAYS_SUCCEEDS(aFile->GetParent(getter_AddRefs(idbDirectory))); - - DebugOnly<nsString> idbLeafName; - MOZ_ASSERT(NS_SUCCEEDED(idbDirectory->GetLeafName(idbLeafName))); - MOZ_ASSERT(static_cast<nsString&>(idbLeafName).EqualsLiteral("idb")); - - // Get the <origin> directory. - nsCOMPtr<nsIFile> originDirectory; - MOZ_ALWAYS_SUCCEEDS( - idbDirectory->GetParent(getter_AddRefs(originDirectory))); - - nsString origin; - MOZ_ALWAYS_SUCCEEDS(originDirectory->GetLeafName(origin)); - - // Any databases in these directories are owned by the application and should - // not have their filenames masked. Hopefully they also appear in the - // Telemetry.cpp whitelist. - if (origin.EqualsLiteral("chrome") || - origin.EqualsLiteral("moz-safe-about+home")) { - return 0; - } - - // Get the <persistence> directory. - nsCOMPtr<nsIFile> persistenceDirectory; - MOZ_ALWAYS_SUCCEEDS( - originDirectory->GetParent(getter_AddRefs(persistenceDirectory))); - - nsString persistence; - MOZ_ALWAYS_SUCCEEDS(persistenceDirectory->GetLeafName(persistence)); - - NS_NAMED_LITERAL_STRING(separator, "*"); - - uint32_t hashValue = HashString(persistence + separator + - origin + separator + - filename); - - MutexAutoLock lock(*gTelemetryIdMutex); - - if (!gTelemetryIdHashtable) { - gTelemetryIdHashtable = new TelemetryIdHashtable(); - } - - uint32_t id; - if (!gTelemetryIdHashtable->Get(hashValue, &id)) { - static uint32_t sNextId = 1; - - // We're locked, no need for atomics. - id = sNextId++; - - gTelemetryIdHashtable->Put(hashValue, id); - } - - return id; -} - } // namespace /******************************************************************************* @@ -12265,7 +12151,6 @@ ConnectionPool::GetOrCreateConnection(const Database* aDatabase, aDatabase->Type(), aDatabase->Group(), aDatabase->Origin(), - aDatabase->TelemetryId(), getter_AddRefs(storageConnection)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -14134,7 +14019,6 @@ Database::Database(Factory* aFactory, const Maybe<ContentParentId>& aOptionalContentParentId, const nsACString& aGroup, const nsACString& aOrigin, - uint32_t aTelemetryId, FullDatabaseMetadata* aMetadata, FileManager* aFileManager, already_AddRefed<DirectoryLock> aDirectoryLock, @@ -14151,7 +14035,6 @@ Database::Database(Factory* aFactory, , mId(aMetadata->mDatabaseId) , mFilePath(aMetadata->mFilePath) , mActiveMutableFileCount(0) - , mTelemetryId(aTelemetryId) , mPersistenceType(aMetadata->mCommonMetadata.persistenceType()) , mFileHandleDisabled(aFileHandleDisabled) , mChromeWriteAccessAllowed(aChromeWriteAccessAllowed) @@ -17391,8 +17274,7 @@ FileManager::InitDirectory(nsIFile* aDirectory, nsIFile* aDatabaseFile, PersistenceType aPersistenceType, const nsACString& aGroup, - const nsACString& aOrigin, - uint32_t aTelemetryId) + const nsACString& aOrigin) { AssertIsOnIOThread(); MOZ_ASSERT(aDirectory); @@ -17464,7 +17346,6 @@ FileManager::InitDirectory(nsIFile* aDirectory, aPersistenceType, aGroup, aOrigin, - aTelemetryId, getter_AddRefs(connection)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -17648,11 +17529,6 @@ QuotaClient::QuotaClient() { AssertIsOnBackgroundThread(); MOZ_ASSERT(!sInstance, "We expect this to be a singleton!"); - MOZ_ASSERT(!gTelemetryIdMutex); - - // Always create this so that later access to gTelemetryIdHashtable can be - // properly synchronized. - gTelemetryIdMutex = new Mutex("IndexedDB gTelemetryIdMutex"); sInstance = this; } @@ -17661,14 +17537,8 @@ QuotaClient::~QuotaClient() { AssertIsOnBackgroundThread(); MOZ_ASSERT(sInstance == this, "We expect this to be a singleton!"); - MOZ_ASSERT(gTelemetryIdMutex); MOZ_ASSERT(!mMaintenanceThreadPool); - // No one else should be able to touch gTelemetryIdHashtable now that the - // QuotaClient has gone away. - gTelemetryIdHashtable = nullptr; - gTelemetryIdMutex = nullptr; - sInstance = nullptr; } @@ -17942,8 +17812,7 @@ QuotaClient::InitOrigin(PersistenceType aPersistenceType, initInfo.mDatabaseFile, aPersistenceType, aGroup, - aOrigin, - TelemetryIdForFile(initInfo.mDatabaseFile)); + aOrigin); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -19036,7 +18905,6 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase() mPersistenceType, mGroup, mOrigin, - TelemetryIdForFile(databaseFile), getter_AddRefs(connection)); if (NS_WARN_IF(NS_FAILED(rv))) { return; @@ -21653,7 +21521,6 @@ OpenDatabaseOp::OpenDatabaseOp(Factory* aFactory, , mMetadata(new FullDatabaseMetadata(aParams.metadata())) , mRequestedVersion(aParams.metadata().version()) , mVersionChangeOp(nullptr) - , mTelemetryId(0) { if (mContentParent) { // This is a little scary but it looks safe to call this off the main thread @@ -21762,8 +21629,6 @@ OpenDatabaseOp::DoDatabaseWork() return rv; } - mTelemetryId = TelemetryIdForFile(dbFile); - #ifdef DEBUG nsString databaseFilePath; rv = dbFile->GetPath(databaseFilePath); @@ -21794,7 +21659,6 @@ OpenDatabaseOp::DoDatabaseWork() persistenceType, mGroup, mOrigin, - mTelemetryId, getter_AddRefs(connection)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -22677,7 +22541,6 @@ OpenDatabaseOp::EnsureDatabaseActor() mOptionalContentParentId, mGroup, mOrigin, - mTelemetryId, mMetadata, mFileManager, mDirectoryLock.forget(), diff --git a/dom/indexedDB/FileManager.h b/dom/indexedDB/FileManager.h index da917f431..0fba46ec0 100644 --- a/dom/indexedDB/FileManager.h +++ b/dom/indexedDB/FileManager.h @@ -58,8 +58,7 @@ public: nsIFile* aDatabaseFile, PersistenceType aPersistenceType, const nsACString& aGroup, - const nsACString& aOrigin, - uint32_t aTelemetryId); + const nsACString& aOrigin); static nsresult GetUsage(nsIFile* aDirectory, uint64_t* aUsage); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 417420ecb..79446151c 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -84,7 +84,6 @@ #include "mozilla/ScopeExit.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" -#include "mozilla/Telemetry.h" #include "mozilla/WebBrowserPersistDocumentParent.h" #include "mozilla/Unused.h" #include "nsAnonymousTemporaryFile.h" @@ -3364,17 +3363,6 @@ ContentParent::RecvIsSecureURI(const uint32_t& type, } bool -ContentParent::RecvAccumulateMixedContentHSTS(const URIParams& aURI, const bool& aActive) -{ - nsCOMPtr<nsIURI> ourURI = DeserializeURI(aURI); - if (!ourURI) { - return false; - } - nsMixedContentBlocker::AccumulateMixedContentHSTS(ourURI, aActive); - return true; -} - -bool ContentParent::RecvLoadURIExternal(const URIParams& uri, PBrowserParent* windowContext) { @@ -4764,19 +4752,3 @@ ContentParent::ForceTabPaint(TabParent* aTabParent, uint64_t aLayerObserverEpoch } ProcessHangMonitor::ForcePaint(mHangMonitorActor, aTabParent, aLayerObserverEpoch); } - -bool -ContentParent::RecvAccumulateChildHistogram( - InfallibleTArray<Accumulation>&& aAccumulations) -{ - /* STUB */ - return true; -} - -bool -ContentParent::RecvAccumulateChildKeyedHistogram( - InfallibleTArray<KeyedAccumulation>&& aAccumulations) -{ - /* STUB */ - return true; -} diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index abcea0b65..26b5c44ac 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -741,9 +741,6 @@ private: virtual bool RecvIsSecureURI(const uint32_t& aType, const URIParams& aURI, const uint32_t& aFlags, bool* aIsSecureURI) override; - virtual bool RecvAccumulateMixedContentHSTS(const URIParams& aURI, - const bool& aActive) override; - virtual bool DeallocPHalParent(PHalParent*) override; virtual bool @@ -1044,10 +1041,6 @@ private: virtual bool RecvDeleteGetFilesRequest(const nsID& aID) override; - virtual bool RecvAccumulateChildHistogram( - InfallibleTArray<Accumulation>&& aAccumulations) override; - virtual bool RecvAccumulateChildKeyedHistogram( - InfallibleTArray<KeyedAccumulation>&& aAccumulations) override; public: void SendGetFilesResponseAndForget(const nsID& aID, const GetFilesResponseResult& aResult); diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 9298f9d02..e8fb25aec 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -89,8 +89,6 @@ using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h"; using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h"; using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; using struct mozilla::dom::FlyWebPublishOptions from "mozilla/dom/FlyWebPublishOptionsIPCSerializer.h"; -using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h"; -using mozilla::Telemetry::KeyedAccumulation from "mozilla/TelemetryComms.h"; union ChromeRegistryItem { @@ -658,8 +656,6 @@ parent: sync IsSecureURI(uint32_t type, URIParams uri, uint32_t flags) returns (bool isSecureURI); - async AccumulateMixedContentHSTS(URIParams uri, bool active); - sync GetLookAndFeelCache() returns (LookAndFeelInt[] lookAndFeelIntCache); @@ -1022,12 +1018,6 @@ parent: async UnstoreAndBroadcastBlobURLUnregistration(nsCString url); - /** - * Messages for communicating child Telemetry to the parent process - */ - async AccumulateChildHistogram(Accumulation[] accumulations); - async AccumulateChildKeyedHistogram(KeyedAccumulation[] accumulations); - sync GetA11yContentId() returns (uint32_t aContentId); both: diff --git a/dom/media/DecoderTraits.cpp b/dom/media/DecoderTraits.cpp index f8cb4fd0e..6aa44f3e5 100644 --- a/dom/media/DecoderTraits.cpp +++ b/dom/media/DecoderTraits.cpp @@ -10,7 +10,6 @@ #include "nsCharSeparatedTokenizer.h" #include "nsMimeTypes.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "OggDecoder.h" #include "OggDemuxer.h" @@ -85,22 +84,6 @@ DecoderTraits::IsWebMAudioType(const nsACString& aType) return aType.EqualsASCII("audio/webm"); } -static char const *const gHttpLiveStreamingTypes[] = { - // For m3u8. - // https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-10 - "application/vnd.apple.mpegurl", - // Some sites serve these as the informal m3u type. - "application/x-mpegurl", - "audio/x-mpegurl", - nullptr -}; - -static bool -IsHttpLiveStreamingType(const nsACString& aType) -{ - return CodecListContains(gHttpLiveStreamingTypes, aType); -} - #ifdef MOZ_FMP4 static bool IsMP4SupportedType(const MediaContentType& aParsedType, @@ -247,10 +230,6 @@ CanHandleMediaType(const MediaContentType& aType, { MOZ_ASSERT(NS_IsMainThread()); - if (IsHttpLiveStreamingType(aType.GetMIMEType())) { - /* Telemetry STUB */ - } - if (aType.HaveCodecs()) { CanPlayStatus result = CanHandleCodecsType(aType, aDiagnostics); if (result == CANPLAY_NO || result == CANPLAY_YES) { diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index b60dfee9d..37c692a4b 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -629,7 +629,6 @@ AudioCallbackDriver::Init() cubeb_stream_params output; cubeb_stream_params input; uint32_t latency_frames; - bool firstStream = CubebUtils::GetFirstStream(); MOZ_ASSERT(!NS_IsMainThread(), "This is blocking and should never run on the main thread."); diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index cf2266bf6..223c59c3b 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -30,7 +30,6 @@ #include "mozilla/dom/VideoTrack.h" #include "mozilla/dom/VideoTrackList.h" #include "nsPrintfCString.h" -#include "mozilla/Telemetry.h" #include "GMPService.h" #include "Layers.h" #include "mozilla/layers/ShadowLayers.h" @@ -421,7 +420,6 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner) , INIT_CANONICAL(mPlaybackRateReliable, true) , INIT_CANONICAL(mDecoderPosition, 0) , INIT_CANONICAL(mIsVisible, !aOwner->IsHidden()) - , mTelemetryReported(false) { MOZ_COUNT_CTOR(MediaDecoder); MOZ_ASSERT(NS_IsMainThread()); @@ -841,41 +839,6 @@ MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, // So we call Invalidate() after calling mOwner->MetadataLoaded to ensure // the media element has the latest dimensions. Invalidate(); - - EnsureTelemetryReported(); -} - -void -MediaDecoder::EnsureTelemetryReported() -{ - MOZ_ASSERT(NS_IsMainThread()); - - if (mTelemetryReported || !mInfo) { - // Note: sometimes we get multiple MetadataLoaded calls (for example - // for chained ogg). So we ensure we don't report duplicate results for - // these resources. - return; - } - - nsTArray<nsCString> codecs; - if (mInfo->HasAudio() && !mInfo->mAudio.GetAsAudioInfo()->mMimeType.IsEmpty()) { - codecs.AppendElement(mInfo->mAudio.GetAsAudioInfo()->mMimeType); - } - if (mInfo->HasVideo() && !mInfo->mVideo.GetAsVideoInfo()->mMimeType.IsEmpty()) { - codecs.AppendElement(mInfo->mVideo.GetAsVideoInfo()->mMimeType); - } - if (codecs.IsEmpty()) { - if (mResource->GetContentType().IsEmpty()) { - NS_WARNING("Somehow the resource's content type is empty"); - return; - } - codecs.AppendElement(nsPrintfCString("resource; %s", mResource->GetContentType().get())); - } - for (const nsCString& codec : codecs) { - DECODER_LOG("Telemetry MEDIA_CODEC_USED= '%s'", codec.get()); - } - - mTelemetryReported = true; } const char* diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 7e93de044..05e88db8b 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -440,8 +440,6 @@ private: void SetCDMProxy(CDMProxy* aProxy); - void EnsureTelemetryReported(); - static bool IsOggEnabled(); static bool IsOpusEnabled(); static bool IsWaveEnabled(); @@ -852,8 +850,6 @@ private: // download has ended. Called on the main thread only. aStatus is // the result from OnStopRequest. void NotifyDownloadEnded(nsresult aStatus); - - bool mTelemetryReported; }; } // namespace mozilla diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 5bc1d95ef..2ed1956c9 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1173,27 +1173,12 @@ StateObject::HandleShutdown() return SetState<ShutdownState>(); } -static void -ReportRecoveryTelemetry(const TimeStamp& aRecoveryStart, - const MediaInfo& aMediaInfo, - bool aIsHardwareAccelerated) -{ -/* STUB */ -} - void MediaDecoderStateMachine:: StateObject::HandleResumeVideoDecoding() { MOZ_ASSERT(mMaster->mVideoDecodeSuspended); - // Start counting recovery time from right now. - TimeStamp start = TimeStamp::Now(); - - // Local reference to mInfo, so that it will be copied in the lambda below. - auto& info = Info(); - bool hw = Reader()->VideoIsHardwareAccelerated(); - // Start video-only seek to the current time. SeekJob seekJob; @@ -1205,10 +1190,7 @@ StateObject::HandleResumeVideoDecoding() type, true /* aVideoOnly */); - SetState<SeekingState>(Move(seekJob), EventVisibility::Suppressed)->Then( - AbstractThread::MainThread(), __func__, - [start, info, hw](){ ReportRecoveryTelemetry(start, info, hw); }, - [](){}); + SetState<SeekingState>(Move(seekJob), EventVisibility::Suppressed); } void diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index baaf45416..288f2e74d 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -2033,7 +2033,6 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow, } // Determine permissions early (while we still have a stack). - nsIURI* docURI = aWindow->GetDocumentURI(); if (!docURI) { return NS_ERROR_UNEXPECTED; @@ -2043,22 +2042,9 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow, Preferences::GetBool("media.navigator.permission.disabled", false); bool isHTTPS = false; docURI->SchemeIs("https", &isHTTPS); - nsCString host; - nsresult rv = docURI->GetHost(host); - // Test for some other schemes that ServiceWorker recognizes - bool isFile; - docURI->SchemeIs("file", &isFile); - bool isApp; - docURI->SchemeIs("app", &isApp); - // Same localhost check as ServiceWorkers uses - // (see IsOriginPotentiallyTrustworthy()) - bool isLocalhost = NS_SUCCEEDED(rv) && - (host.LowerCaseEqualsLiteral("localhost") || - host.LowerCaseEqualsLiteral("127.0.0.1") || - host.LowerCaseEqualsLiteral("::1")); nsCString origin; - rv = nsPrincipal::GetOriginForURI(docURI, origin); + nsresult rv = nsPrincipal::GetOriginForURI(docURI, origin); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/dom/media/fmp4/MP4Demuxer.cpp b/dom/media/fmp4/MP4Demuxer.cpp index 5a637b003..ef68d5dca 100644 --- a/dom/media/fmp4/MP4Demuxer.cpp +++ b/dom/media/fmp4/MP4Demuxer.cpp @@ -16,9 +16,6 @@ #include "mp4_demuxer/Index.h" #include "nsPrintfCString.h" -// Used for telemetry -#include "mozilla/Telemetry.h" -#include "mp4_demuxer/AnnexB.h" #include "mp4_demuxer/H264.h" #include "nsAutoPtr.h" @@ -72,23 +69,10 @@ private: // Queued samples extracted by the demuxer, but not yet returned. RefPtr<MediaRawData> mQueuedSample; bool mNeedReIndex; - bool mNeedSPSForTelemetry; bool mIsH264 = false; }; -// Returns true if no SPS was found and search for it should continue. -bool -AccumulateSPSTelemetry(const MediaByteBuffer* aExtradata) -{ - // XXX: Do we still need this without telemetry? - mp4_demuxer::SPSData spsdata; - if (mp4_demuxer::H264::DecodeSPSFromExtraData(aExtradata, spsdata)) { - return false; - } - return true; -} - MP4Demuxer::MP4Demuxer(MediaResource* aResource) : mResource(aResource) , mStream(new mp4_demuxer::ResourceStream(aResource)) @@ -219,25 +203,10 @@ MP4TrackDemuxer::MP4TrackDemuxer(MP4Demuxer* aParent, EnsureUpToDateIndex(); // Force update of index VideoInfo* videoInfo = mInfo->GetAsVideoInfo(); - // Collect telemetry from h264 AVCC SPS. if (videoInfo && (mInfo->mMimeType.EqualsLiteral("video/mp4") || mInfo->mMimeType.EqualsLiteral("video/avc"))) { mIsH264 = true; - RefPtr<MediaByteBuffer> extraData = videoInfo->mExtraData; - mNeedSPSForTelemetry = AccumulateSPSTelemetry(extraData); - mp4_demuxer::SPSData spsdata; - if (mp4_demuxer::H264::DecodeSPSFromExtraData(extraData, spsdata) && - spsdata.pic_width > 0 && spsdata.pic_height > 0 && - mp4_demuxer::H264::EnsureSPSIsSane(spsdata)) { - videoInfo->mImage.width = spsdata.pic_width; - videoInfo->mImage.height = spsdata.pic_height; - videoInfo->mDisplay.width = spsdata.display_width; - videoInfo->mDisplay.height = spsdata.display_height; - } - } else { - // No SPS to be found. - mNeedSPSForTelemetry = false; } } @@ -364,15 +333,6 @@ MP4TrackDemuxer::GetSamples(int32_t aNumSamples) if (samples->mSamples.IsEmpty()) { return SamplesPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__); } else { - for (const auto& sample : samples->mSamples) { - // Collect telemetry from h264 Annex B SPS. - if (mNeedSPSForTelemetry && mp4_demuxer::AnnexB::HasSPS(sample)) { - RefPtr<MediaByteBuffer> extradata = - mp4_demuxer::AnnexB::ExtractExtraData(sample); - mNeedSPSForTelemetry = AccumulateSPSTelemetry(extradata); - } - } - if (mNextKeyframeTime.isNothing() || samples->mSamples.LastElement()->mTime >= mNextKeyframeTime.value().ToMicroseconds()) { SetNextKeyFrameTime(); diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp index 15e2e1097..e6dd29c6d 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp @@ -38,39 +38,6 @@ WMFMediaDataDecoder::Init() return InitPromise::CreateAndResolve(mMFTManager->GetType(), __func__); } -// A single telemetry sample is reported for each MediaDataDecoder object -// that has detected error or produced output successfully. -static void -SendTelemetry(unsigned long hr) -{ - // Collapse the error codes into a range of 0-0xff that can be viewed in - // telemetry histograms. For most MF_E_* errors, unique samples are used, - // retaining the least significant 7 or 8 bits. Other error codes are - // bucketed. - uint32_t sample; - if (SUCCEEDED(hr)) { - sample = 0; - } else if (hr < 0xc00d36b0) { - sample = 1; // low bucket - } else if (hr < 0xc00d3700) { - sample = hr & 0xffU; // MF_E_* - } else if (hr <= 0xc00d3705) { - sample = 0x80 + (hr & 0xfU); // more MF_E_* - } else if (hr < 0xc00d6d60) { - sample = 2; // mid bucket - } else if (hr <= 0xc00d6d78) { - sample = hr & 0xffU; // MF_E_TRANSFORM_* - } else { - sample = 3; // high bucket - } - - nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction( - [sample] { - /* Telemetry STUB */ - }); - NS_DispatchToMainThread(runnable); -} - void WMFMediaDataDecoder::Shutdown() { @@ -90,9 +57,6 @@ WMFMediaDataDecoder::ProcessShutdown() if (mMFTManager) { mMFTManager->Shutdown(); mMFTManager = nullptr; - if (!mRecordedError && mHasSuccessfulOutput) { - SendTelemetry(S_OK); - } } } @@ -124,10 +88,6 @@ WMFMediaDataDecoder::ProcessDecode(MediaRawData* aSample) NS_WARNING("MFTManager rejected sample"); mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, RESULT_DETAIL("MFTManager::Input:%x", hr))); - if (!mRecordedError) { - SendTelemetry(hr); - mRecordedError = true; - } return; } @@ -143,7 +103,6 @@ WMFMediaDataDecoder::ProcessOutput() HRESULT hr = S_OK; while (SUCCEEDED(hr = mMFTManager->Output(mLastStreamOffset, output)) && output) { - mHasSuccessfulOutput = true; mCallback->Output(output); } if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { @@ -152,10 +111,6 @@ WMFMediaDataDecoder::ProcessOutput() NS_WARNING("WMFMediaDataDecoder failed to output data"); mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, RESULT_DETAIL("MFTManager::Output:%x", hr))); - if (!mRecordedError) { - SendTelemetry(hr); - mRecordedError = true; - } } } diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.h b/dom/media/platforms/wmf/WMFMediaDataDecoder.h index 75571d61e..f869012e7 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.h +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.h @@ -136,10 +136,6 @@ private: Atomic<bool> mIsFlushing; bool mIsShutDown; - - // For telemetry - bool mHasSuccessfulOutput = false; - bool mRecordedError = false; }; } // namespace mozilla diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp index 71c4916b9..a5aa48b00 100644 --- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -11,7 +11,6 @@ #include "mozilla/OwningNonNull.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" -#include "mozilla/Telemetry.h" #include "mozilla/Unused.h" #include "mozilla/dom/AppNotificationServiceOptionsBinding.h" @@ -656,172 +655,6 @@ NotificationPermissionRequest::GetTypes(nsIArray** aTypes) aTypes); } -NS_IMPL_ISUPPORTS(NotificationTelemetryService, nsIObserver) - -NotificationTelemetryService::NotificationTelemetryService() - : mDNDRecorded(false) -{} - -NotificationTelemetryService::~NotificationTelemetryService() -{ - Unused << NS_WARN_IF(NS_FAILED(RemovePermissionChangeObserver())); -} - -/* static */ already_AddRefed<NotificationTelemetryService> -NotificationTelemetryService::GetInstance() -{ - nsCOMPtr<nsISupports> telemetrySupports = - do_GetService(NOTIFICATIONTELEMETRYSERVICE_CONTRACTID); - if (!telemetrySupports) { - return nullptr; - } - RefPtr<NotificationTelemetryService> telemetry = - static_cast<NotificationTelemetryService*>(telemetrySupports.get()); - return telemetry.forget(); -} - -nsresult -NotificationTelemetryService::Init() -{ - nsresult rv = AddPermissionChangeObserver(); - NS_ENSURE_SUCCESS(rv, rv); - - RecordPermissions(); - - return NS_OK; -} - -nsresult -NotificationTelemetryService::RemovePermissionChangeObserver() -{ - nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); - if (!obs) { - return NS_ERROR_OUT_OF_MEMORY; - } - return obs->RemoveObserver(this, "perm-changed"); -} - -nsresult -NotificationTelemetryService::AddPermissionChangeObserver() -{ - nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); - if (!obs) { - return NS_ERROR_OUT_OF_MEMORY; - } - return obs->AddObserver(this, "perm-changed", false); -} - -void -NotificationTelemetryService::RecordPermissions() -{ - if (!Telemetry::CanRecordBase() || !Telemetry::CanRecordExtended()) { - return; - } - - nsCOMPtr<nsIPermissionManager> permissionManager = - services::GetPermissionManager(); - if (!permissionManager) { - return; - } - - nsCOMPtr<nsISimpleEnumerator> enumerator; - nsresult rv = permissionManager->GetEnumerator(getter_AddRefs(enumerator)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } - - for (;;) { - bool hasMoreElements; - nsresult rv = enumerator->HasMoreElements(&hasMoreElements); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } - if (!hasMoreElements) { - break; - } - nsCOMPtr<nsISupports> supportsPermission; - rv = enumerator->GetNext(getter_AddRefs(supportsPermission)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } - uint32_t capability; - if (!GetNotificationPermission(supportsPermission, &capability)) { - continue; - } - } -} - -bool -NotificationTelemetryService::GetNotificationPermission(nsISupports* aSupports, - uint32_t* aCapability) -{ - nsCOMPtr<nsIPermission> permission = do_QueryInterface(aSupports); - if (!permission) { - return false; - } - nsAutoCString type; - permission->GetType(type); - if (!type.Equals("desktop-notification")) { - return false; - } - permission->GetCapability(aCapability); - return true; -} - -void -NotificationTelemetryService::RecordDNDSupported() -{ - if (mDNDRecorded) { - return; - } - - nsCOMPtr<nsIAlertsService> alertService = - do_GetService(NS_ALERTSERVICE_CONTRACTID); - if (!alertService) { - return; - } - - nsCOMPtr<nsIAlertsDoNotDisturb> alertServiceDND = - do_QueryInterface(alertService); - if (!alertServiceDND) { - return; - } - - mDNDRecorded = true; - bool isEnabled; - nsresult rv = alertServiceDND->GetManualDoNotDisturb(&isEnabled); - if (NS_FAILED(rv)) { - return; - } -} - -nsresult -NotificationTelemetryService::RecordSender(nsIPrincipal* aPrincipal) -{ - if (!Telemetry::CanRecordBase() || !Telemetry::CanRecordExtended() || - !nsAlertsUtils::IsActionablePrincipal(aPrincipal)) { - return NS_OK; - } - nsAutoString origin; - nsresult rv = Notification::GetOrigin(aPrincipal, origin); - if (NS_FAILED(rv)) { - return rv; - } - if (!mOrigins.Contains(origin)) { - mOrigins.PutEntry(origin); - } - return NS_OK; -} - -NS_IMETHODIMP -NotificationTelemetryService::Observe(nsISupports* aSubject, - const char* aTopic, - const char16_t* aData) -{ - /* STUB */ - return NS_OK; -} - // Observer that the alert service calls to do common tasks and/or dispatch to the // specific observer for the context e.g. main thread, worker, or service worker. class NotificationObserver final : public nsIObserver @@ -1402,8 +1235,6 @@ NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic, return NS_OK; } else if (!strcmp("alertshow", aTopic) || !strcmp("alertfinished", aTopic)) { - RefPtr<NotificationTelemetryService> telemetry = - NotificationTelemetryService::GetInstance(); Unused << NS_WARN_IF(NS_FAILED(AdjustPushQuota(aTopic))); } diff --git a/dom/notification/Notification.h b/dom/notification/Notification.h index a2c4b5c68..11958f6ad 100644 --- a/dom/notification/Notification.h +++ b/dom/notification/Notification.h @@ -18,9 +18,6 @@ #include "nsTHashtable.h" #include "nsWeakReference.h" -#define NOTIFICATIONTELEMETRYSERVICE_CONTRACTID \ - "@mozilla.org/notificationTelemetryService;1" - class nsIPrincipal; class nsIVariant; @@ -49,36 +46,6 @@ public: Notify(workers::Status aStatus) override; }; -// Records telemetry probes at application startup, when a notification is -// shown, and when the notification permission is revoked for a site. -class NotificationTelemetryService final : public nsIObserver -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIOBSERVER - - NotificationTelemetryService(); - - static already_AddRefed<NotificationTelemetryService> GetInstance(); - - nsresult Init(); - void RecordDNDSupported(); - void RecordPermissions(); - nsresult RecordSender(nsIPrincipal* aPrincipal); - -private: - virtual ~NotificationTelemetryService(); - - nsresult AddPermissionChangeObserver(); - nsresult RemovePermissionChangeObserver(); - - bool GetNotificationPermission(nsISupports* aSupports, - uint32_t* aCapability); - - bool mDNDRecorded; - nsTHashtable<nsStringHashKey> mOrigins; -}; - /* * Notifications on workers introduce some lifetime issues. The property we * are trying to satisfy is: @@ -143,7 +110,6 @@ class Notification : public DOMEventTargetHelper friend class ServiceWorkerNotificationObserver; friend class WorkerGetRunnable; friend class WorkerNotificationObserver; - friend class NotificationTelemetryService; public: IMPL_EVENT_HANDLER(click) diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 300c4f621..4a509676d 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -92,11 +92,6 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId, return true; } PluginModuleChromeParent* chromeParent = static_cast<PluginModuleChromeParent*>(plugin->GetLibrary()); - /* - * We can't accumulate BLOCKED_ON_PLUGIN_MODULE_INIT_MS until here because - * its histogram key is not available until *after* NP_Initialize. - */ - chromeParent->AccumulateModuleInitBlockedTime(); *rv = chromeParent->GetRunID(runID); if (NS_FAILED(*rv)) { return true; @@ -335,16 +330,13 @@ PluginModuleContentParent::LoadModule(uint32_t aPluginId, dom::ContentChild* cp = dom::ContentChild::GetSingleton(); nsresult rv; uint32_t runID; - TimeStamp sendLoadPluginStart = TimeStamp::Now(); if (!cp->SendLoadPlugin(aPluginId, &rv, &runID) || NS_FAILED(rv)) { return nullptr; } - TimeStamp sendLoadPluginEnd = TimeStamp::Now(); PluginModuleContentParent* parent = mapping->GetModule(); MOZ_ASSERT(parent); - parent->mTimeBlocked += (sendLoadPluginEnd - sendLoadPluginStart); if (!mapping->IsChannelOpened()) { // mapping is linked into PluginModuleMapping::sModuleListHead and is @@ -440,7 +432,6 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId, aPluginTag->mSupportsAsyncInit)); UniquePtr<LaunchCompleteTask> onLaunchedRunnable(new LaunchedTask(parent)); parent->mSubprocess->SetCallRunnableImmediately(!parent->mIsStartingAsync); - TimeStamp launchStart = TimeStamp::Now(); bool launched = parent->mSubprocess->Launch(Move(onLaunchedRunnable), aPluginTag->mSandboxLevel); if (!launched) { @@ -459,8 +450,6 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId, return nullptr; } } - TimeStamp launchEnd = TimeStamp::Now(); - parent->mTimeBlocked = (launchEnd - launchStart); return parent.forget(); } @@ -1758,15 +1747,12 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* PluginSettings settings; GetSettings(&settings); - TimeStamp callNpInitStart = TimeStamp::Now(); // Asynchronous case if (mIsStartingAsync) { if (!SendAsyncNP_Initialize(settings)) { Close(); return NS_ERROR_FAILURE; } - TimeStamp callNpInitEnd = TimeStamp::Now(); - mTimeBlocked += (callNpInitEnd - callNpInitStart); return NS_OK; } @@ -1779,8 +1765,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* Close(); return NS_ERROR_FAILURE; } - TimeStamp callNpInitEnd = TimeStamp::Now(); - mTimeBlocked += (callNpInitEnd - callNpInitStart); RecvNP_InitializeResult(*error); @@ -1882,13 +1866,10 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) PluginSettings settings; GetSettings(&settings); - TimeStamp callNpInitStart = TimeStamp::Now(); if (mIsStartingAsync) { if (!SendAsyncNP_Initialize(settings)) { return NS_ERROR_FAILURE; } - TimeStamp callNpInitEnd = TimeStamp::Now(); - mTimeBlocked += (callNpInitEnd - callNpInitStart); return NS_OK; } @@ -1896,8 +1877,6 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) Close(); return NS_ERROR_FAILURE; } - TimeStamp callNpInitEnd = TimeStamp::Now(); - mTimeBlocked += (callNpInitEnd - callNpInitStart); RecvNP_InitializeResult(*error); return NS_OK; } @@ -2194,14 +2173,6 @@ public: } }; -void -PluginModuleParent::AccumulateModuleInitBlockedTime() -{ - // XXX: mTimeBlocked can probably go if not used for anything besides - // telemetry. - mTimeBlocked = TimeDuration(); -} - nsresult PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance, uint16_t mode, @@ -2213,13 +2184,6 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance, if (mPluginName.IsEmpty()) { GetPluginDetails(); InitQuirksModes(nsDependentCString(pluginType)); - /** mTimeBlocked measures the time that the main thread has been blocked - * on plugin module initialization. As implemented, this is the sum of - * plugin-container launch + toolhelp32 snapshot + NP_Initialize. - * We don't accumulate its value until here because the plugin info - * for its histogram key is not available until *after* NP_Initialize. - */ - AccumulateModuleInitBlockedTime(); } nsCaseInsensitiveUTF8StringArrayComparator comparator; diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index 0ceed6efd..909e8fe35 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -115,8 +115,6 @@ public: return mPluginName + mPluginVersion; } - void AccumulateModuleInitBlockedTime(); - virtual nsresult GetRunID(uint32_t* aRunID) override; virtual void SetHasLocalInstance() override { mHadLocalInstance = true; @@ -315,7 +313,6 @@ protected: nsString mBrowserDumpID; nsString mHangID; RefPtr<nsIObserver> mProfilerObserver; - TimeDuration mTimeBlocked; nsCString mPluginName; nsCString mPluginVersion; int32_t mSandboxLevel; diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index 5f41f414d..543429aff 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -35,7 +35,6 @@ #include "nsISiteSecurityService.h" #include "mozilla/Logging.h" -#include "mozilla/Telemetry.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/ipc/URIUtils.h" @@ -814,17 +813,13 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, // // We do not count requests aHadInsecureImageRedirect=true, since these are // just an artifact of the image caching system. - bool active = (classification == eMixedScript); if (!aHadInsecureImageRedirect) { - if (XRE_IsParentProcess()) { - AccumulateMixedContentHSTS(innerContentLocation, active); - } else { + if (!XRE_IsParentProcess()) { // Ask the parent process to do the same call mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton(); if (cc) { mozilla::ipc::URIParams uri; SerializeURI(innerContentLocation, uri); - cc->SendAccumulateMixedContentHSTS(uri, active); } } } @@ -977,11 +972,3 @@ enum MixedContentHSTSState { MCB_HSTS_ACTIVE_NO_HSTS = 2, MCB_HSTS_ACTIVE_WITH_HSTS = 3 }; - -// Record information on when HSTS would have made mixed content not mixed -// content (regardless of whether it was actually blocked) -void -nsMixedContentBlocker::AccumulateMixedContentHSTS(nsIURI* aURI, bool aActive) -{ -/* STUB */ -}
\ No newline at end of file diff --git a/dom/security/nsMixedContentBlocker.h b/dom/security/nsMixedContentBlocker.h index 56ab9621f..068068b25 100644 --- a/dom/security/nsMixedContentBlocker.h +++ b/dom/security/nsMixedContentBlocker.h @@ -61,9 +61,6 @@ public: nsISupports* aExtra, nsIPrincipal* aRequestPrincipal, int16_t* aDecision); - static void AccumulateMixedContentHSTS(nsIURI* aURI, - bool aActive); - static bool sBlockMixedScript; static bool sBlockMixedDisplay; diff --git a/dom/storage/DOMStorageCache.cpp b/dom/storage/DOMStorageCache.cpp index a6aa17424..a2b5a6f73 100644 --- a/dom/storage/DOMStorageCache.cpp +++ b/dom/storage/DOMStorageCache.cpp @@ -85,7 +85,6 @@ DOMStorageCache::DOMStorageCache(const nsACString* aOriginNoSuffix) , mInitialized(false) , mPersistent(false) , mSessionOnlyDataSetActive(false) -, mPreloadTelemetryRecorded(false) { MOZ_COUNT_CTOR(DOMStorageCache); } @@ -178,7 +177,7 @@ DOMStorageCache::DataSet(const DOMStorage* aStorage) // Session only data set is demanded but not filled with // current data set, copy to session only set now. - WaitForPreload(Telemetry::LOCALDOMSTORAGE_SESSIONONLY_PRELOAD_BLOCKING_MS); + WaitForPreload(); Data& defaultSet = mData[kDefaultSet]; Data& sessionSet = mData[kSessionSet]; @@ -298,46 +297,18 @@ DOMStorageCache::KeepAlive() mKeepAliveTimer.swap(timer); } -namespace { - -// The AutoTimer provided by telemetry headers is only using static, -// i.e. compile time known ID, but here we know the ID only at run time. -// Hence a new class. -class TelemetryAutoTimer -{ -public: - explicit TelemetryAutoTimer(Telemetry::ID aId) - : id(aId), start(TimeStamp::Now()) {} - ~TelemetryAutoTimer() - { /* STUB */ } -private: - Telemetry::ID id; - const TimeStamp start; -}; - -} // namespace - void -DOMStorageCache::WaitForPreload(Telemetry::ID aTelemetryID) +DOMStorageCache::WaitForPreload() { if (!mPersistent) { return; } bool loaded = mLoaded; - - // Telemetry of rates of pending preloads - if (!mPreloadTelemetryRecorded) { - mPreloadTelemetryRecorded = true; - } - if (loaded) { return; } - // Measure which operation blocks and for how long - TelemetryAutoTimer timer(aTelemetryID); - // If preload already started (i.e. we got some first data, but not all) // SyncPreload will just wait for it to finish rather then synchronously // read from the database. It seems to me more optimal. @@ -354,7 +325,7 @@ nsresult DOMStorageCache::GetLength(const DOMStorage* aStorage, uint32_t* aRetval) { if (Persist(aStorage)) { - WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETLENGTH_BLOCKING_MS); + WaitForPreload(); if (NS_FAILED(mLoadResult)) { return mLoadResult; } @@ -372,7 +343,7 @@ DOMStorageCache::GetKey(const DOMStorage* aStorage, uint32_t aIndex, nsAString& // maybe we need to have a lazily populated key array here or // something? if (Persist(aStorage)) { - WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETKEY_BLOCKING_MS); + WaitForPreload(); if (NS_FAILED(mLoadResult)) { return mLoadResult; } @@ -394,7 +365,7 @@ void DOMStorageCache::GetKeys(const DOMStorage* aStorage, nsTArray<nsString>& aKeys) { if (Persist(aStorage)) { - WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETALLKEYS_BLOCKING_MS); + WaitForPreload(); } if (NS_FAILED(mLoadResult)) { @@ -411,7 +382,7 @@ DOMStorageCache::GetItem(const DOMStorage* aStorage, const nsAString& aKey, nsAString& aRetval) { if (Persist(aStorage)) { - WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETVALUE_BLOCKING_MS); + WaitForPreload(); if (NS_FAILED(mLoadResult)) { return mLoadResult; } @@ -436,7 +407,7 @@ DOMStorageCache::SetItem(const DOMStorage* aStorage, const nsAString& aKey, int64_t delta = 0; if (Persist(aStorage)) { - WaitForPreload(Telemetry::LOCALDOMSTORAGE_SETVALUE_BLOCKING_MS); + WaitForPreload(); if (NS_FAILED(mLoadResult)) { return mLoadResult; } @@ -485,7 +456,7 @@ DOMStorageCache::RemoveItem(const DOMStorage* aStorage, const nsAString& aKey, nsString& aOld) { if (Persist(aStorage)) { - WaitForPreload(Telemetry::LOCALDOMSTORAGE_REMOVEKEY_BLOCKING_MS); + WaitForPreload(); if (NS_FAILED(mLoadResult)) { return mLoadResult; } @@ -524,9 +495,8 @@ DOMStorageCache::Clear(const DOMStorage* aStorage) // We need to preload all data (know the size) before we can proceeed // to correctly decrease cached usage number. // XXX as in case of unload, this is not technically needed now, but - // after super-scope quota introduction we have to do this. Get telemetry - // right now. - WaitForPreload(Telemetry::LOCALDOMSTORAGE_CLEAR_BLOCKING_MS); + // after super-scope quota introduction we have to do this. + WaitForPreload(); if (NS_FAILED(mLoadResult)) { // When we failed to load data from the database, force delete of the // scope data and make use of the storage possible again. @@ -596,9 +566,8 @@ DOMStorageCache::UnloadItems(uint32_t aUnloadFlags) // Must wait for preload to pass correct usage to ProcessUsageDelta // XXX this is not technically needed right now since there is just // per-origin isolated quota handling, but when we introduce super- - // -scope quotas, we have to do this. Better to start getting - // telemetry right now. - WaitForPreload(Telemetry::LOCALDOMSTORAGE_UNLOAD_BLOCKING_MS); + // -scope quotas, we have to do this. + WaitForPreload(); mData[kDefaultSet].mKeys.Clear(); ProcessUsageDelta(kDefaultSet, -mData[kDefaultSet].mOriginQuotaUsage); @@ -617,7 +586,7 @@ DOMStorageCache::UnloadItems(uint32_t aUnloadFlags) #ifdef DOM_STORAGE_TESTS if (aUnloadFlags & kTestReload) { - WaitForPreload(Telemetry::LOCALDOMSTORAGE_UNLOAD_BLOCKING_MS); + WaitForPreload(); mData[kDefaultSet].mKeys.Clear(); mLoaded = false; // This is only used in testing code diff --git a/dom/storage/DOMStorageCache.h b/dom/storage/DOMStorageCache.h index 01cf6b3ea..4469152a2 100644 --- a/dom/storage/DOMStorageCache.h +++ b/dom/storage/DOMStorageCache.h @@ -14,7 +14,6 @@ #include "nsDataHashtable.h" #include "nsHashKeys.h" #include "mozilla/Monitor.h" -#include "mozilla/Telemetry.h" #include "mozilla/Atomics.h" namespace mozilla { @@ -168,7 +167,7 @@ private: private: // Synchronously blocks until the cache is fully loaded from the database - void WaitForPreload(mozilla::Telemetry::ID aTelemetryID); + void WaitForPreload(); // Helper to get one of the 3 data sets (regular, private, session) Data& DataSet(const DOMStorage* aStorage); @@ -241,9 +240,6 @@ private: // Drops back to false when session-only data are cleared from chrome. bool mSessionOnlyDataSetActive : 1; - // Whether we have already captured state of the cache preload on our first access. - bool mPreloadTelemetryRecorded : 1; - // DOMStorageDBThread on the parent or single process, // DOMStorageDBChild on the child process. static DOMStorageDBBridge* sDatabase; diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index 1f49e16dd..21f6d8ddf 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -1530,7 +1530,6 @@ RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate) const bool isServiceWorker = aWorkerPrivate->IsServiceWorker(); const bool isSharedWorker = aWorkerPrivate->IsSharedWorker(); - const bool isDedicatedWorker = aWorkerPrivate->IsDedicatedWorker(); if (isServiceWorker) { AssertIsOnMainThread(); } diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 2c2e2d79c..afdaea63f 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -37,7 +37,6 @@ #include "mozilla/net/NeckoMessageUtils.h" #include "mozilla/Preferences.h" #include "nsReadLine.h" -#include "mozilla/Telemetry.h" #include "nsIConsoleService.h" #include "nsINavHistoryService.h" #include "nsToolkitCompsCID.h" @@ -1167,21 +1166,7 @@ nsPermissionManager::InitDB(bool aRemoveFile) mDBConn->TableExists(NS_LITERAL_CSTRING("moz_perms"), &permsTableExists); if (permsTableExists) { // The user already had a moz_perms table, and we are performing a - // re-migration. We count the rows in the old table for telemetry, - // and then back up their old database as moz_perms_v6 - - nsCOMPtr<mozIStorageStatement> countStmt; - rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING("SELECT COUNT(*) FROM moz_perms"), - getter_AddRefs(countStmt)); - bool hasResult = false; - if (NS_SUCCEEDED(rv) && - NS_SUCCEEDED(countStmt->ExecuteStep(&hasResult)) && - hasResult) { - // Telemetry STUB (count rows and report) - } else { - NS_WARNING("Could not count the rows in moz_perms"); - } - + // re-migration. // Back up the old moz_perms database as moz_perms_v6 before we // move the new table into its position rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING( diff --git a/gfx/ipc/GPUChild.cpp b/gfx/ipc/GPUChild.cpp index bfe2d56f7..ba6053f43 100644 --- a/gfx/ipc/GPUChild.cpp +++ b/gfx/ipc/GPUChild.cpp @@ -126,20 +126,6 @@ GPUChild::RecvNotifyUiObservers(const nsCString& aTopic) } bool -GPUChild::RecvAccumulateChildHistogram(InfallibleTArray<Accumulation>&& aAccumulations) -{ - /* Telemetry STUB */ - return true; -} - -bool -GPUChild::RecvAccumulateChildKeyedHistogram(InfallibleTArray<KeyedAccumulation>&& aAccumulations) -{ - /* Telemetry STUB */ - return true; -} - -bool GPUChild::RecvNotifyDeviceReset() { mHost->mListener->OnProcessDeviceReset(mHost); diff --git a/gfx/ipc/GPUChild.h b/gfx/ipc/GPUChild.h index 888884ddf..fdb3931f7 100644 --- a/gfx/ipc/GPUChild.h +++ b/gfx/ipc/GPUChild.h @@ -34,8 +34,6 @@ public: // PGPUChild overrides. bool RecvInitComplete(const GPUDeviceData& aData) override; bool RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog) override; - bool RecvAccumulateChildHistogram(InfallibleTArray<Accumulation>&& aAccumulations) override; - bool RecvAccumulateChildKeyedHistogram(InfallibleTArray<KeyedAccumulation>&& aAccumulations) override; void ActorDestroy(ActorDestroyReason aWhy) override; bool RecvGraphicsError(const nsCString& aError) override; bool RecvNotifyUiObservers(const nsCString& aTopic) override; diff --git a/gfx/ipc/PGPU.ipdl b/gfx/ipc/PGPU.ipdl index a2c035c75..db3f6e503 100644 --- a/gfx/ipc/PGPU.ipdl +++ b/gfx/ipc/PGPU.ipdl @@ -13,8 +13,6 @@ using base::ProcessId from "base/process.h"; using mozilla::TimeDuration from "mozilla/TimeStamp.h"; using mozilla::CSSToLayoutDeviceScale from "Units.h"; using mozilla::gfx::IntSize from "mozilla/gfx/2D.h"; -using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h"; -using mozilla::Telemetry::KeyedAccumulation from "mozilla/TelemetryComms.h"; namespace mozilla { namespace gfx { @@ -90,10 +88,6 @@ child: // observer service. async NotifyUiObservers(nsCString aTopic); - // Messages for reporting telemetry to the UI process. - async AccumulateChildHistogram(Accumulation[] accumulations); - async AccumulateChildKeyedHistogram(KeyedAccumulation[] accumulations); - async NotifyDeviceReset(); }; diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index e7574eeb7..3d4112395 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -38,7 +38,6 @@ #include "mozilla/ReentrantMonitor.h" // for ReentrantMonitorAutoEnter, etc #include "mozilla/RefPtr.h" // for RefPtr #include "mozilla/StaticPtr.h" // for StaticAutoPtr -#include "mozilla/Telemetry.h" // for Telemetry #include "mozilla/TimeStamp.h" // for TimeDuration, TimeStamp #include "mozilla/dom/CheckerboardReportService.h" // for CheckerboardEventStorage // note: CheckerboardReportService.h actually lives in gfx/layers/apz/util/ @@ -1686,25 +1685,6 @@ void AsyncPanZoomController::DoDelayedRequestContentRepaint() mPinchPaintTimerSet = false; } -static ScrollInputMethod -ScrollInputMethodForWheelDeltaType(ScrollWheelInput::ScrollDeltaType aDeltaType) -{ - switch (aDeltaType) { - case ScrollWheelInput::SCROLLDELTA_LINE: { - return ScrollInputMethod::ApzWheelLine; - } - case ScrollWheelInput::SCROLLDELTA_PAGE: { - return ScrollInputMethod::ApzWheelPage; - } - case ScrollWheelInput::SCROLLDELTA_PIXEL: { - return ScrollInputMethod::ApzWheelPixel; - } - default: - MOZ_ASSERT_UNREACHABLE("unexpected scroll delta type"); - return ScrollInputMethod::ApzWheelLine; - } -} - nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEvent) { ParentLayerPoint delta = GetScrollWheelDelta(aEvent); @@ -3229,11 +3209,10 @@ AsyncPanZoomController::ReportCheckerboard(const TimeStamp& aSampleTime) mLastCheckerboardReport = aSampleTime; bool recordTrace = gfxPrefs::APZRecordCheckerboarding(); - bool forTelemetry = Telemetry::CanRecordExtended(); uint32_t magnitude = GetCheckerboardMagnitude(); MutexAutoLock lock(mCheckerboardEventLock); - if (!mCheckerboardEvent && (recordTrace || forTelemetry)) { + if (!mCheckerboardEvent && recordTrace) { mCheckerboardEvent = MakeUnique<CheckerboardEvent>(recordTrace); } mPotentialCheckerboardTracker.InTransform(IsTransformingState(mState)); diff --git a/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.cpp b/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.cpp index e469421ad..3c62a1101 100644 --- a/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.cpp +++ b/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.cpp @@ -6,8 +6,6 @@ #include "PotentialCheckerboardDurationTracker.h" -#include "mozilla/Telemetry.h" // for Telemetry - namespace mozilla { namespace layers { @@ -20,10 +18,6 @@ PotentialCheckerboardDurationTracker::PotentialCheckerboardDurationTracker() void PotentialCheckerboardDurationTracker::CheckerboardSeen() { - // This might get called while mInCheckerboard is already true - if (!Tracking()) { - mCurrentPeriodStart = TimeStamp::Now(); - } mInCheckerboard = true; } @@ -32,9 +26,6 @@ PotentialCheckerboardDurationTracker::CheckerboardDone() { MOZ_ASSERT(Tracking()); mInCheckerboard = false; - if (!Tracking()) { - /* Telemetry STUB */ - } } void @@ -50,19 +41,10 @@ PotentialCheckerboardDurationTracker::InTransform(bool aInTransform) // must be true (or we would have early-exited this function already). // Therefore, we are starting a potential checkerboard period. mInTransform = aInTransform; - mCurrentPeriodStart = TimeStamp::Now(); return; } mInTransform = aInTransform; - - if (!Tracking()) { - // Tracking() must have been true at the start of this function, or we - // would have taken the other !Tracking branch above. If it's false now, - // it means we just stopped tracking, so we are ending a potential - // checkerboard period. - /* Telemetry STUB */ - } } bool diff --git a/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.h b/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.h index 6154003ad..bcba113d3 100644 --- a/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.h +++ b/gfx/layers/apz/src/PotentialCheckerboardDurationTracker.h @@ -50,8 +50,6 @@ private: private: bool mInCheckerboard; bool mInTransform; - - TimeStamp mCurrentPeriodStart; }; } // namespace layers diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 074807e8c..1e4369bce 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -289,8 +289,6 @@ ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback, void* aCallbackData, EndTransactionFlags) { - PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Rasterization); - PROFILER_LABEL("ClientLayerManager", "EndTransactionInternal", js::ProfileEntry::Category::GRAPHICS); diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 87a19f5c0..97ea984db 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -51,7 +51,6 @@ #include "mozilla/layout/RenderFrameParent.h" #include "mozilla/media/MediaSystemResourceService.h" // for MediaSystemResourceService #include "mozilla/mozalloc.h" // for operator new, etc -#include "mozilla/Telemetry.h" #ifdef MOZ_WIDGET_GTK #include "basic/X11BasicCompositor.h" // for X11BasicCompositor #endif @@ -72,7 +71,6 @@ #include "mozilla/Hal.h" #include "mozilla/HalTypes.h" #include "mozilla/StaticPtr.h" -#include "mozilla/Telemetry.h" #include "mozilla/VsyncDispatcher.h" #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) #include "VsyncSource.h" diff --git a/gfx/src/DriverCrashGuard.cpp b/gfx/src/DriverCrashGuard.cpp index fd616575b..2303e9d66 100644 --- a/gfx/src/DriverCrashGuard.cpp +++ b/gfx/src/DriverCrashGuard.cpp @@ -411,10 +411,6 @@ D3D11LayersCrashGuard::Initialize() }
DriverCrashGuard::Initialize();
-
- // If no telemetry states have been recorded, this will set the state to okay.
- // Otherwise, it will have no effect.
- RecordTelemetry(TelemetryState::Okay);
}
bool
@@ -447,30 +443,21 @@ D3D11LayersCrashGuard::UpdateEnvironment() return false;
}
- RecordTelemetry(TelemetryState::EnvironmentChanged);
return true;
}
void
D3D11LayersCrashGuard::LogCrashRecovery()
{
- RecordTelemetry(TelemetryState::RecoveredFromCrash);
gfxCriticalNote << "D3D11 layers just crashed; D3D11 will be disabled.";
}
void
D3D11LayersCrashGuard::LogFeatureDisabled()
{
- RecordTelemetry(TelemetryState::FeatureDisabled);
gfxCriticalNote << "D3D11 layers disabled due to a prior crash.";
}
-void
-D3D11LayersCrashGuard::RecordTelemetry(TelemetryState aState)
-{
- /* STUB */
-}
-
D3D9VideoCrashGuard::D3D9VideoCrashGuard(dom::ContentParent* aContentParent)
: DriverCrashGuard(CrashGuardType::D3D9Video, aContentParent)
{
diff --git a/gfx/src/DriverCrashGuard.h b/gfx/src/DriverCrashGuard.h index 9a0c5851a..8db9287c9 100644 --- a/gfx/src/DriverCrashGuard.h +++ b/gfx/src/DriverCrashGuard.h @@ -66,15 +66,6 @@ public: bool Crashed();
void NotifyCrashed();
- // These are the values reported to Telemetry (GRAPHICS_DRIVER_STARTUP_TEST).
- // Values should not change; add new values to the end.
- enum class TelemetryState {
- Okay = 0,
- EnvironmentChanged = 1,
- RecoveredFromCrash = 2,
- FeatureDisabled = 3
- };
-
enum class Mode {
// Normal operation.
Normal,
@@ -136,9 +127,6 @@ class D3D11LayersCrashGuard final : public DriverCrashGuard bool UpdateEnvironment() override;
void LogCrashRecovery() override;
void LogFeatureDisabled() override;
-
- private:
- void RecordTelemetry(TelemetryState aState);
};
class D3D9VideoCrashGuard final : public DriverCrashGuard
diff --git a/gfx/thebes/DeviceManagerDx.cpp b/gfx/thebes/DeviceManagerDx.cpp index e1cfc5763..9f42974c3 100644 --- a/gfx/thebes/DeviceManagerDx.cpp +++ b/gfx/thebes/DeviceManagerDx.cpp @@ -455,13 +455,11 @@ DeviceManagerDx::CreateContentDevice() : D3D_DRIVER_TYPE_UNKNOWN; if (!CreateDevice(adapter, type, flags, hr, device)) { gfxCriticalNote << "Recovered from crash while creating a D3D11 content device"; - gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode::Content); return FeatureStatus::CrashedInHandler; } if (FAILED(hr) || !device) { gfxCriticalNote << "Failed to create a D3D11 content device: " << hexa(hr); - gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode::Content); return FeatureStatus::Failed; } diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 8ccd721f8..490a866db 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -36,7 +36,6 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" -#include "mozilla/Telemetry.h" #include "gfxMathTable.h" #include "gfxSVGGlyphs.h" #include "gfx2DGlue.h" @@ -2573,8 +2572,6 @@ gfxFont::GetShapedWord(DrawTarget *aDrawTarget, } gfxShapedWord* sw = entry->mShapedWord.get(); - bool isContent = !mStyle.systemFont; - if (sw) { sw->ResetAge(); #ifndef RELEASE_OR_BETA diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 70ba2fe6a..50d1fcb46 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -11,7 +11,6 @@ #include "mozilla/gfx/GPUProcessManager.h" #include "mozilla/gfx/GraphicsMessages.h" #include "mozilla/ClearOnShutdown.h" -#include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/Unused.h" @@ -349,25 +348,6 @@ void CrashStatsLogForwarder::Log(const std::string& aString) } } -class CrashTelemetryEvent : public Runnable -{ - virtual ~CrashTelemetryEvent() {} - - NS_DECL_ISUPPORTS_INHERITED - - explicit CrashTelemetryEvent(uint32_t aReason) : mReason(aReason) {} - - NS_IMETHOD Run() override { - MOZ_ASSERT(NS_IsMainThread()); - return NS_OK; - } - -protected: - uint32_t mReason; -}; - -NS_IMPL_ISUPPORTS_INHERITED0(CrashTelemetryEvent, Runnable); - void CrashStatsLogForwarder::CrashAction(LogReason aReason) { @@ -2435,13 +2415,6 @@ gfxPlatform::NotifyCompositorCreated(LayersBackend aBackend) // Set the backend before we notify so it's available immediately. mCompositorBackend = aBackend; - - // Notify that we created a compositor, so telemetry can update. - NS_DispatchToMainThread(NS_NewRunnableFunction([] { - if (nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService()) { - obsvc->NotifyObservers(nullptr, "compositor:created", nullptr); - } - })); } void diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index 59df40666..5f7bbb832 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -21,7 +21,6 @@ #include "mozilla/Likely.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/gfx/2D.h" @@ -322,7 +321,6 @@ gfxPlatformFontList::InitOtherFamilyNames() mOtherFamilyNamesInitialized = true; } TimeStamp end = TimeStamp::Now(); - if (LOG_FONTINIT_ENABLED()) { TimeDuration elapsed = end - start; LOG_FONTINIT(("(fontinit) InitOtherFamilyNames took %8.2f ms %s", @@ -470,7 +468,7 @@ gfxPlatformFontList::GetFontList(nsIAtom *aLangGroup, { for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) { RefPtr<gfxFontFamily>& family = iter.Data(); - // use the first variation for now. This data should be the same + // use the first variation for now. This data should be the same // for all the variations and should probably be moved up to // the Family gfxFontStyle style; @@ -578,12 +576,6 @@ gfxPlatformFontList::SystemFindFontForChar(uint32_t aCh, uint32_t aNextCh, } else if (aCh == 0xFFFD && fontEntry && fallbackFamily) { mReplacementCharFallbackFamily = fallbackFamily; } - - // track system fallback time - static bool first = true; - int32_t intElapsed = int32_t(first ? elapsed.ToMilliseconds() : - elapsed.ToMicroseconds()); - first = false; return fontEntry; } diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index b1ede7ad2..82e36efe2 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -22,7 +22,6 @@ #include "nsIGfxInfo.h" #include "nsServiceManagerUtils.h" #include "nsTArray.h" -#include "mozilla/Telemetry.h" #include "GeckoProfiler.h" #include "nsIWindowsRegKey.h" @@ -1435,12 +1434,6 @@ gfxWindowsPlatform::InitializeD3D11Config() } } -/* static */ void -gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode aDevice) -{ - /* STUB */ -} - void gfxWindowsPlatform::InitializeDevices() { @@ -1478,18 +1471,9 @@ gfxWindowsPlatform::InitializeDevices() return; } - bool shouldUseD2D = gfxConfig::IsEnabled(Feature::DIRECT2D); - // First, initialize D3D11. If this succeeds we attempt to use Direct2D. InitializeD3D11(); InitializeD2D(); - - if (!gfxConfig::IsEnabled(Feature::DIRECT2D) && - XRE_IsContentProcess() && - shouldUseD2D) - { - RecordContentDeviceFailure(TelemetryDeviceCode::D2D1); - } } void diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index f401038fc..129365f82 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -225,8 +225,6 @@ public: } bool SupportsPluginDirectDXGIDrawing(); - static void RecordContentDeviceFailure(mozilla::gfx::TelemetryDeviceCode aDevice); - protected: bool AccelerateLayersByDefault() override { return true; diff --git a/image/Image.h b/image/Image.h index bcabd1cc7..98c5e8ca5 100644 --- a/image/Image.h +++ b/image/Image.h @@ -220,8 +220,6 @@ public: virtual void SetHasError() = 0; virtual ImageURL* GetURI() = 0; - - virtual void ReportUseCounters() { } }; class ImageResource : public Image diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp index 1e59b13fa..3028c1c2e 100644 --- a/image/VectorImage.cpp +++ b/image/VectorImage.cpp @@ -1337,15 +1337,6 @@ VectorImage::PropagateUseCounters(nsIDocument* aParentDocument) } } -void -VectorImage::ReportUseCounters() -{ - nsIDocument* doc = mSVGDocumentWrapper->GetDocument(); - if (doc) { - static_cast<nsDocument*>(doc)->ReportUseCounters(); - } -} - nsIntSize VectorImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame, diff --git a/image/VectorImage.h b/image/VectorImage.h index e19aa939f..bd4d393ed 100644 --- a/image/VectorImage.h +++ b/image/VectorImage.h @@ -68,8 +68,6 @@ public: void OnSVGDocumentLoaded(); void OnSVGDocumentError(); - virtual void ReportUseCounters() override; - protected: explicit VectorImage(ImageURL* aURI = nullptr); virtual ~VectorImage(); diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index a988fae53..eacb3041b 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -15,7 +15,6 @@ #include "mozilla/Move.h" #include "mozilla/SizePrintfMacros.h" #include "mozilla/Sprintf.h" -#include "mozilla/Telemetry.h" #include "mozilla/Logging.h" #include "nsAutoPtr.h" #include "nsDebug.h" @@ -116,8 +115,6 @@ static MessageChannel* gParentProcessBlocker; namespace mozilla { namespace ipc { -static const uint32_t kMinTelemetryMessageSize = 8192; - const int32_t MessageChannel::kNoTimeout = INT32_MIN; // static @@ -1150,9 +1147,6 @@ MessageChannel::Send(Message* aMsg, Message* aReply) IPC_LOG("Send seqno=%d, xid=%d", seqno, transaction); - // msg will be destroyed soon, but name() is not owned by msg. - const char* msgName = msg->name(); - mLink->SendMessage(msg.forget()); while (true) { diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 30c4a835a..0983f034f 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -6605,10 +6605,6 @@ SetStopwatchIsMonitoringJank(JSContext*, bool); extern JS_PUBLIC_API(bool) GetStopwatchIsMonitoringJank(JSContext*); -// Extract the CPU rescheduling data. -extern JS_PUBLIC_API(void) -GetPerfMonitoringTestCpuRescheduling(JSContext*, uint64_t* stayed, uint64_t* moved); - /** * Add a number of microseconds to the time spent waiting on CPOWs diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 595a21410..f5cd56a9b 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -543,11 +543,6 @@ js::SetPreserveWrapperCallback(JSContext* cx, PreserveWrapperCallback callback) cx->preserveWrapperCallback = callback; } -/* - * The below code is for temporary telemetry use. It can be removed when - * sufficient data has been harvested. - */ - namespace js { // Defined in vm/GlobalObject.cpp. extern size_t sSetProtoCalled; @@ -643,12 +638,6 @@ js::StringToLinearStringSlow(JSContext* cx, JSString* str) return str->ensureLinear(cx); } -JS_FRIEND_API(void) -JS_SetAccumulateTelemetryCallback(JSContext* cx, JSAccumulateTelemetryDataCallback callback) -{ - cx->setTelemetryCallback(cx, callback); -} - JS_FRIEND_API(JSObject*) JS_CloneObject(JSContext* cx, HandleObject obj, HandleObject protoArg) { diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 722085549..a3ae23b10 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -142,9 +142,6 @@ enum { typedef void (*JSAccumulateTelemetryDataCallback)(int id, uint32_t sample, const char* key); -extern JS_FRIEND_API(void) -JS_SetAccumulateTelemetryCallback(JSContext* cx, JSAccumulateTelemetryDataCallback callback); - extern JS_FRIEND_API(bool) JS_GetIsSecureContext(JSCompartment* compartment); diff --git a/js/src/vm/Stopwatch.cpp b/js/src/vm/Stopwatch.cpp index 28632c2a1..7a6acb970 100644 --- a/js/src/vm/Stopwatch.cpp +++ b/js/src/vm/Stopwatch.cpp @@ -638,13 +638,6 @@ GetStopwatchIsMonitoringCPOW(JSContext* cx) } JS_PUBLIC_API(void) -GetPerfMonitoringTestCpuRescheduling(JSContext* cx, uint64_t* stayed, uint64_t* moved) -{ - *stayed = cx->performanceMonitoring.testCpuRescheduling.stayed; - *moved = cx->performanceMonitoring.testCpuRescheduling.moved; -} - -JS_PUBLIC_API(void) AddCPOWPerformanceDelta(JSContext* cx, uint64_t delta) { cx->performanceMonitoring.totalCPOWTime += delta; diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index 82af64520..0243d80e3 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -132,7 +132,6 @@ class AsyncFreeSnowWhite : public Runnable public: NS_IMETHOD Run() override { - TimeStamp start = TimeStamp::Now(); bool hadSnowWhiteObjects = nsCycleCollector_doDeferredDeletion(); if (hadSnowWhiteObjects && !mContinuation) { mContinuation = true; @@ -1235,8 +1234,6 @@ XPCJSContext::InterruptCallback(JSContext* cx) if (self->mSlowScriptCheckpoint.IsNull()) { self->mSlowScriptCheckpoint = TimeStamp::NowLoRes(); self->mSlowScriptSecondHalf = false; - self->mSlowScriptActualWait = mozilla::TimeDuration(); - self->mTimeoutAccumulated = false; return true; } @@ -1258,8 +1255,6 @@ XPCJSContext::InterruptCallback(JSContext* cx) if (limit == 0 || duration.ToSeconds() < limit / 2.0) return true; - self->mSlowScriptActualWait += duration; - // In order to guard against time changes or laptops going to sleep, we // don't trigger the slow script warning until (limit/2) seconds have // elapsed twice. @@ -1311,12 +1306,6 @@ XPCJSContext::InterruptCallback(JSContext* cx) return false; } - // Accumulate slow script invokation delay. - if (!chrome && !self->mTimeoutAccumulated) { - uint32_t delay = uint32_t(self->mSlowScriptActualWait.ToMilliseconds() - (limit * 1000.0)); - self->mTimeoutAccumulated = true; - } - // Show the prompt to the user, and kill if requested. nsGlobalWindow::SlowScriptResponse response = win->ShowSlowScriptDialog(); if (response == nsGlobalWindow::KillSlowScript) { @@ -2949,12 +2938,6 @@ JSSizeOfTab(JSObject* objArg, size_t* jsObjectsSize, size_t* jsStringsSize, } // namespace xpc static void -AccumulateTelemetryCallback(int id, uint32_t sample, const char* key) -{ -/* STUB */ -} - -static void CompartmentNameCallback(JSContext* cx, JSCompartment* comp, char* buf, size_t bufsize) { @@ -3113,7 +3096,6 @@ XPCJSContext::XPCJSContext() mWatchdogManager(new WatchdogManager(this)), mAsyncSnowWhiteFreer(new AsyncFreeSnowWhite()), mSlowScriptSecondHalf(false), - mTimeoutAccumulated(false), mPendingResult(NS_OK) { } @@ -3279,7 +3261,6 @@ XPCJSContext::Initialize() JS_AddWeakPointerCompartmentCallback(cx, WeakPointerCompartmentCallback, this); JS_SetWrapObjectCallbacks(cx, &WrapObjectCallbacks); js::SetPreserveWrapperCallback(cx, PreserveWrapper); - JS_SetAccumulateTelemetryCallback(cx, AccumulateTelemetryCallback); js::SetActivityCallback(cx, ActivityCallback, this); JS_AddInterruptCallback(cx, InterruptCallback); js::SetWindowProxyClass(cx, &OuterWindowProxyClass); @@ -3444,8 +3425,6 @@ XPCJSContext::BeforeProcessTask(bool aMightBlock) // Start the slow script timer. mSlowScriptCheckpoint = mozilla::TimeStamp::NowLoRes(); mSlowScriptSecondHalf = false; - mSlowScriptActualWait = mozilla::TimeDuration(); - mTimeoutAccumulated = false; // As we may be entering a nested event loop, we need to // cancel any ongoing performance measurement. diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index d7d5586b8..347b406eb 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -634,9 +634,6 @@ private: // (whichever comes later). We use it to determine whether the interrupt // callback needs to do anything. mozilla::TimeStamp mSlowScriptCheckpoint; - // Accumulates total time we actually waited for telemetry - mozilla::TimeDuration mSlowScriptActualWait; - bool mTimeoutAccumulated; // mPendingResult is used to implement Components.returnCode. Only really // meaningful while calling through XPCWrappedJS. diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 2bf20144a..2b9ad7ff8 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -61,7 +61,6 @@ #include "mozilla/OperatorNewExtensions.h" #include "mozilla/PendingAnimationTracker.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "mozilla/UniquePtr.h" #include "mozilla/Unused.h" #include "mozilla/gfx/gfxVars.h" @@ -1857,7 +1856,6 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB RefPtr<ContainerLayer> root; { - PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Layerization); root = layerBuilder-> BuildContainerLayerFor(aBuilder, layerManager, frame, nullptr, this, containerParameters, nullptr); @@ -7453,100 +7451,3 @@ nsDisplayFilter::PrintEffects(nsACString& aTo) aTo += ")"; } #endif - -namespace mozilla { - -uint32_t PaintTelemetry::sPaintLevel = 0; -uint32_t PaintTelemetry::sMetricLevel = 0; -EnumeratedArray<PaintTelemetry::Metric, - PaintTelemetry::Metric::COUNT, - double> PaintTelemetry::sMetrics; - -PaintTelemetry::AutoRecordPaint::AutoRecordPaint() -{ - // Don't record nested paints. - if (sPaintLevel++ > 0) { - return; - } - - // Reset metrics for a new paint. - for (auto& metric : sMetrics) { - metric = 0.0; - } - mStart = TimeStamp::Now(); -} - -PaintTelemetry::AutoRecordPaint::~AutoRecordPaint() -{ - MOZ_ASSERT(sPaintLevel != 0); - if (--sPaintLevel > 0) { - return; - } - - // If we're in multi-process mode, don't include paint times for the parent - // process. - if (gfxVars::BrowserTabsRemoteAutostart() && XRE_IsParentProcess()) { - return; - } - - double totalMs = (TimeStamp::Now() - mStart).ToMilliseconds(); - - // If the total time was >= 16ms, then it's likely we missed a frame due to - // painting. In this case we'll gather some detailed metrics below. - if (totalMs <= 16.0) { - return; - } - - auto record = [=](const char* aKey, double aDurationMs) -> void { - MOZ_ASSERT(aDurationMs <= totalMs); - - uint32_t amount = static_cast<int32_t>((aDurationMs / totalMs) * 100.0); - }; - - double dlMs = sMetrics[Metric::DisplayList]; - double flbMs = sMetrics[Metric::Layerization]; - double rMs = sMetrics[Metric::Rasterization]; - - // Record all permutations since aggregation makes it difficult to - // correlate. For example we can't derive "flb+r" from "dl" because we - // don't know the total time associated with a bucket entry. So we just - // play it safe and include everything. We can however derive "other" time - // from the final permutation. - record("dl", dlMs); - record("flb", flbMs); - record("r", rMs); - record("dl,flb", dlMs + flbMs); - record("dl,r", dlMs + rMs); - record("flb,r", flbMs + rMs); - record("dl,flb,r", dlMs + flbMs + rMs); -} - -PaintTelemetry::AutoRecord::AutoRecord(Metric aMetric) - : mMetric(aMetric) -{ - // Don't double-record anything nested. - if (sMetricLevel++ > 0) { - return; - } - - // Don't record inside nested paints, or outside of paints. - if (sPaintLevel != 1) { - return; - } - - mStart = TimeStamp::Now(); -} - -PaintTelemetry::AutoRecord::~AutoRecord() -{ - MOZ_ASSERT(sMetricLevel != 0); - - sMetricLevel--; - if (mStart.IsNull()) { - return; - } - - sMetrics[mMetric] += (TimeStamp::Now() - mStart).ToMilliseconds(); -} - -} // namespace mozilla diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index df584b489..9603a95b8 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -4508,43 +4508,4 @@ public: mutable mozilla::Maybe<bool> mIsFrameSelected; }; -namespace mozilla { - -class PaintTelemetry -{ - public: - enum class Metric { - DisplayList, - Layerization, - Rasterization, - COUNT, - }; - - class AutoRecord - { - public: - explicit AutoRecord(Metric aMetric); - ~AutoRecord(); - private: - Metric mMetric; - mozilla::TimeStamp mStart; - }; - - class AutoRecordPaint - { - public: - AutoRecordPaint(); - ~AutoRecordPaint(); - private: - mozilla::TimeStamp mStart; - }; - - private: - static uint32_t sPaintLevel; - static uint32_t sMetricLevel; - static mozilla::EnumeratedArray<Metric, Metric::COUNT, double> sMetrics; -}; - -} // namespace mozilla - #endif /*NSDISPLAYLIST_H_*/ diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index c1f4ad372..19200d5a7 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -111,7 +111,6 @@ #include "FrameLayerBuilder.h" #include "mozilla/layers/APZCTreeManager.h" #include "mozilla/layers/CompositorBridgeChild.h" -#include "mozilla/Telemetry.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventStateManager.h" #include "mozilla/RuleNodeCacheConditions.h" @@ -3534,8 +3533,6 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram PROFILER_LABEL("nsLayoutUtils", "PaintFrame::BuildDisplayList", js::ProfileEntry::Category::GRAPHICS); - - PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::DisplayList); aFrame->BuildDisplayListForStackingContext(&builder, dirtyRect, &list); } diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 340042b46..969ebc962 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -170,7 +170,6 @@ #include "mozilla/css/ImageLoader.h" #include "mozilla/dom/DocumentTimeline.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "nsCanvasFrame.h" #include "nsIImageLoadingContent.h" #include "nsImageFrame.h" @@ -9394,9 +9393,6 @@ PresShell::DoVerifyReflow() } #endif -// used with Telemetry metrics -#define NS_LONG_REFLOW_TIME_MS 5000 - bool PresShell::ProcessReflowCommands(bool aInterruptible) { diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index b975a69dd..5ea7a0188 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -55,7 +55,6 @@ #include "nsDocShell.h" #include "nsISimpleEnumerator.h" #include "nsJSEnvironment.h" -#include "mozilla/Telemetry.h" #include "gfxPrefs.h" #include "BackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h" @@ -524,46 +523,10 @@ private: private: ~RefreshDriverVsyncObserver() = default; - void RecordTelemetryProbes(TimeStamp aVsyncTimestamp) - { - MOZ_ASSERT(NS_IsMainThread()); - #ifndef ANDROID /* bug 1142079 */ - if (XRE_IsParentProcess()) { - TimeDuration vsyncLatency = TimeStamp::Now() - aVsyncTimestamp; - uint32_t sample = (uint32_t)vsyncLatency.ToMilliseconds(); - RecordJank(sample); - } else if (mVsyncRate != TimeDuration::Forever()) { - TimeDuration contentDelay = (TimeStamp::Now() - mLastChildTick) - mVsyncRate; - if (contentDelay.ToMilliseconds() < 0 ){ - // Vsyncs are noisy and some can come at a rate quicker than - // the reported hardware rate. In those cases, consider that we have 0 delay. - contentDelay = TimeDuration::FromMilliseconds(0); - } - uint32_t sample = (uint32_t)contentDelay.ToMilliseconds(); - RecordJank(sample); - } else { - // Request the vsync rate from the parent process. Might be a few vsyncs - // until the parent responds. - mVsyncRate = mVsyncRefreshDriverTimer->mVsyncChild->GetVsyncRate(); - } - #endif - } - - void RecordJank(uint32_t aJankMS) - { - uint32_t duration = 1 /* ms */; - for (size_t i = 0; - i < mozilla::ArrayLength(sJankLevels) && duration < aJankMS; - ++i, duration *= 2) { - sJankLevels[i]++; - } - } - void TickRefreshDriver(TimeStamp aVsyncTimestamp) { MOZ_ASSERT(NS_IsMainThread()); - RecordTelemetryProbes(aVsyncTimestamp); if (XRE_IsParentProcess()) { MonitorAutoLock lock(mRefreshTickLock); aVsyncTimestamp = mRecentVsync; @@ -2006,7 +1969,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime) mViewManagerFlushIsPending = false; RefPtr<nsViewManager> vm = mPresContext->GetPresShell()->GetViewManager(); { - PaintTelemetry::AutoRecordPaint record; vm->ProcessPendingUpdates(); } diff --git a/layout/build/nsLayoutCID.h b/layout/build/nsLayoutCID.h index 47a90d7d8..1b43c7592 100644 --- a/layout/build/nsLayoutCID.h +++ b/layout/build/nsLayoutCID.h @@ -82,7 +82,4 @@ #define SERVICEWORKERMANAGER_CID \ { 0xc74bde32, 0xbcc7, 0x4840, { 0x84, 0x30, 0xc7, 0x33, 0x35, 0x1b, 0x21, 0x2a } } -#define NOTIFICATIONTELEMETRYSERVICE_CID \ -{ 0x5995b782, 0x6a0e, 0x4066, { 0xaa, 0xc5, 0x27, 0x6f, 0x0a, 0x9a, 0xd8, 0xcf } } - #endif /* nsLayoutCID_h__ */ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 748bc11d8..8bb70f85c 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -204,7 +204,6 @@ using mozilla::dom::UDPSocketChild; using mozilla::dom::time::TimeService; using mozilla::net::StreamingProtocolControllerService; using mozilla::gmp::GeckoMediaPluginService; -using mozilla::dom::NotificationTelemetryService; #define NS_EDITORCOMMANDTABLE_CID \ { 0x4f5e62b8, 0xd659, 0x4156, \ @@ -292,7 +291,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(TextInputProcessor) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService, NS_CreatePresentationService) NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationTCPSessionTransport) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NotificationTelemetryService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(PushNotifier) //----------------------------------------------------------------------------- @@ -657,7 +655,6 @@ NS_DEFINE_NAMED_CID(NS_TEXTEDITOR_CID); NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID); NS_DEFINE_NAMED_CID(QUOTAMANAGER_SERVICE_CID); NS_DEFINE_NAMED_CID(SERVICEWORKERMANAGER_CID); -NS_DEFINE_NAMED_CID(NOTIFICATIONTELEMETRYSERVICE_CID); NS_DEFINE_NAMED_CID(PUSHNOTIFIER_CID); NS_DEFINE_NAMED_CID(WORKERDEBUGGERMANAGER_CID); @@ -925,7 +922,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kDOMREQUEST_SERVICE_CID, false, nullptr, DOMRequestServiceConstructor }, { &kQUOTAMANAGER_SERVICE_CID, false, nullptr, QuotaManagerServiceConstructor }, { &kSERVICEWORKERMANAGER_CID, false, nullptr, ServiceWorkerManagerConstructor }, - { &kNOTIFICATIONTELEMETRYSERVICE_CID, false, nullptr, NotificationTelemetryServiceConstructor }, { &kPUSHNOTIFIER_CID, false, nullptr, PushNotifierConstructor }, { &kWORKERDEBUGGERMANAGER_CID, true, nullptr, WorkerDebuggerManagerConstructor }, { &kNS_AUDIOCHANNELAGENT_CID, true, nullptr, AudioChannelAgentConstructor }, @@ -1057,7 +1053,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID }, { QUOTAMANAGER_SERVICE_CONTRACTID, &kQUOTAMANAGER_SERVICE_CID }, { SERVICEWORKERMANAGER_CONTRACTID, &kSERVICEWORKERMANAGER_CID }, - { NOTIFICATIONTELEMETRYSERVICE_CONTRACTID, &kNOTIFICATIONTELEMETRYSERVICE_CID }, { PUSHNOTIFIER_CONTRACTID, &kPUSHNOTIFIER_CID }, { WORKERDEBUGGERMANAGER_CONTRACTID, &kWORKERDEBUGGERMANAGER_CID }, { NS_AUDIOCHANNELAGENT_CONTRACTID, &kNS_AUDIOCHANNELAGENT_CID }, @@ -1132,7 +1127,6 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = { CONTENTDLF_CATEGORIES { "profile-after-change", "PresentationDeviceManager", PRESENTATION_DEVICE_MANAGER_CONTRACTID }, { "profile-after-change", "PresentationService", PRESENTATION_SERVICE_CONTRACTID }, - { "profile-after-change", "Notification Telemetry Service", NOTIFICATIONTELEMETRYSERVICE_CONTRACTID }, { nullptr } }; diff --git a/layout/style/ImageLoader.cpp b/layout/style/ImageLoader.cpp index 0a605abc9..a26a1741a 100644 --- a/layout/style/ImageLoader.cpp +++ b/layout/style/ImageLoader.cpp @@ -519,9 +519,6 @@ ImageLoader::FlushUseCounters() nsCOMPtr<imgIContainer> container; request->GetImage(getter_AddRefs(container)); - if (container) { - static_cast<image::Image*>(container.get())->ReportUseCounters(); - } } } diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 43d10ca86..f31e2edb3 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -62,7 +62,6 @@ #include "nsDOMDataChannel.h" #include "mozilla/dom/Performance.h" #include "mozilla/TimeStamp.h" -#include "mozilla/Telemetry.h" #include "mozilla/Preferences.h" #include "mozilla/PublicSSL.h" #include "nsXULAppAPI.h" @@ -2167,9 +2166,6 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP) RemoveOldRemoteTracks(pco); pco->OnSetRemoteDescriptionSuccess(jrv); -#if !defined(MOZILLA_EXTERNAL_LINKAGE) - startCallTelem(); -#endif } UpdateSignalingState(sdpType == mozilla::kJsepSdpRollback); @@ -2992,12 +2988,6 @@ PeerConnectionImpl::PluginCrash(uint32_t aPluginID, return true; } -void -PeerConnectionImpl::RecordEndOfCallTelemetry() const -{ - /* STUB */ -} - nsresult PeerConnectionImpl::CloseInt() { @@ -3014,7 +3004,6 @@ PeerConnectionImpl::CloseInt() if (!mPrivateWindow) { RecordLongtermICEStatistics(); } - RecordEndOfCallTelemetry(); CSFLogInfo(logTag, "%s: Closing PeerConnectionImpl %s; " "ending call", __FUNCTION__, mHandle.c_str()); if (mJsepSession) { @@ -3110,9 +3099,6 @@ PeerConnectionImpl::SetSignalingState_m(PCImplSignalingState aSignalingState, fireNegotiationNeeded = true; } - // Telemetry: record info on the current state of streams/renegotiations/etc - // Note: this code gets run on rollbacks as well! - // Update the max channels used with each direction for each type uint16_t receiving[SdpMediaSection::kMediaTypes]; uint16_t sending[SdpMediaSection::kMediaTypes]; @@ -3967,14 +3953,6 @@ PeerConnectionImpl::IceStreamReady(NrIceMediaStream *aStream) CSFLogDebug(logTag, "%s: %s", __FUNCTION__, aStream->name().c_str()); } -#if !defined(MOZILLA_EXTERNAL_LINKAGE) -//Telemetry for when calls start -void -PeerConnectionImpl::startCallTelem() { - /* STUB */ -} -#endif - NS_IMETHODIMP PeerConnectionImpl::GetLocalStreams(nsTArray<RefPtr<DOMMediaStream > >& result) { diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index c29d08180..1dcc70519 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -594,8 +594,6 @@ public: bool PluginCrash(uint32_t aPluginID, const nsAString& aPluginName); - void RecordEndOfCallTelemetry() const; - nsresult InitializeDataChannel(); NS_IMETHODIMP_TO_ERRORRESULT_RETREF(nsDOMDataChannel, @@ -647,9 +645,6 @@ public: bool HasMedia() const; #if !defined(MOZILLA_EXTERNAL_LINKAGE) - // initialize telemetry for when calls start - void startCallTelem(); - nsresult BuildStatsQuery_m( mozilla::dom::MediaStreamTrack *aSelector, RTCStatsQuery *query); 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<PRIntervalTime> mLastOfflineStateChange; - mozilla::Atomic<PRIntervalTime> mLastConnectivityChange; - mozilla::Atomic<PRIntervalTime> mLastNetworkLinkChange; - // Time a network tearing down started. mozilla::Atomic<PRIntervalTime> 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<nsITimedChannel> 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<nsITimedChannel> 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<PRThread*, Relaxed> 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<unsigned>(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<nsITimer> 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<bool> mServingPendingQueue; Atomic<int32_t, Relaxed> mMaxTimePerPollIter; - Atomic<bool, Relaxed> mTelemetryEnabledPref; Atomic<PRIntervalTime, Relaxed> mMaxTimeForPrClosePref; - // Between a computer going to sleep and waking up the PR_*** telemetry - // will be corrupted - so do not record it. - Atomic<bool, Relaxed> mSleepPhase; - nsCOMPtr<nsITimer> 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<uint8_t> 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; } } @@ -755,12 +750,6 @@ nsUDPSocket::GetLocalAddr(nsINetAddr * *aResult) } void -nsUDPSocket::SaveNetworkStats(bool aEnforce) -{ - /*** STUB ***/ -} - -void nsUDPSocket::CloseSocket() { if (mFD) { 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 @@ -188,12 +188,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<nsCStringHashKey, mozilla::TimeStamp> 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<bool> 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<Telemetry::PREDICTOR_TOTAL_PREFETCHES_USED> 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<Telemetry::HTTPCONNMGR_USED_SPECULATIVE_CONN> usedSpeculativeConn; - ++usedSpeculativeConn; - - if (ent->mHalfOpens[i]->IsFromPredictor()) { - Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_USED> 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<Telemetry::HTTPCONNMGR_TOTAL_SPECULATIVE_CONN> totalSpeculativeConn; - ++totalSpeculativeConn; if (isFromPredictor) { sock->SetIsFromPredictor(true); - Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_CREATED> 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<Telemetry::HTTPCONNMGR_UNUSED_SPECULATIVE_CONN> unusedSpeculativeConn; - ++unusedSpeculativeConn; - - if (halfOpen->IsFromPredictor()) { - Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_UNUSED> 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..f1ec0f947 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -105,8 +105,10 @@ public: bool EnforceAssocReq() { return mEnforceAssocReq; } bool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; } - bool IsTelemetryEnabled() { return mTelemetryEnabled; } - bool AllowExperiments() { return mTelemetryEnabled && 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; } @@ -509,9 +511,6 @@ private: // true in between init and shutdown states Atomic<bool, Relaxed> mHandlerActive; - // Whether telemetry is reported or not - uint32_t mTelemetryEnabled : 1; - // The value of network.allow-experiments uint32_t mAllowExperiments : 1; diff --git a/security/certverifier/CertVerifier.cpp b/security/certverifier/CertVerifier.cpp index 2957a269f..1139ecae5 100644 --- a/security/certverifier/CertVerifier.cpp +++ b/security/certverifier/CertVerifier.cpp @@ -333,7 +333,6 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, /*optional out*/ OCSPStaplingStatus* ocspStaplingStatus, /*optional out*/ KeySizeStatus* keySizeStatus, /*optional out*/ SHA1ModeResult* sha1ModeResult, - /*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo, /*optional out*/ CertificateTransparencyInfo* ctInfo) { MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("Top of VerifyCert\n")); @@ -423,7 +422,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, SHA1Mode::Allowed, NetscapeStepUpPolicy::NeverMatch, originAttributes, - builtChain, nullptr, nullptr); + builtChain, nullptr); rv = BuildCertChain(trustDomain, certDER, time, EndEntityOrCA::MustBeEndEntity, KeyUsage::digitalSignature, @@ -484,19 +483,13 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, continue; } - // Because of the try-strict and fallback approach, we have to clear any - // previously noted telemetry information - if (pinningTelemetryInfo) { - pinningTelemetryInfo->Reset(); - } - NSSCertDBTrustDomain trustDomain(trustSSL, evOCSPFetching, mOCSPCache, pinArg, ocspGETConfig, mCertShortLifetimeInDays, mPinningMode, MIN_RSA_BITS, ValidityCheckingMode::CheckForEV, sha1ModeConfigurations[i], mNetscapeStepUpPolicy, - originAttributes, builtChain, pinningTelemetryInfo, + originAttributes, builtChain, hostname); rv = BuildCertChainForOneKeyUsage(trustDomain, certDER, time, KeyUsage::digitalSignature,// (EC)DHE @@ -572,11 +565,6 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, continue; } - // invalidate any telemetry info relating to failed chains - if (pinningTelemetryInfo) { - pinningTelemetryInfo->Reset(); - } - NSSCertDBTrustDomain trustDomain(trustSSL, defaultOCSPFetching, mOCSPCache, pinArg, ocspGETConfig, mCertShortLifetimeInDays, @@ -585,7 +573,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, sha1ModeConfigurations[j], mNetscapeStepUpPolicy, originAttributes, builtChain, - pinningTelemetryInfo, hostname); + hostname); rv = BuildCertChainForOneKeyUsage(trustDomain, certDER, time, KeyUsage::digitalSignature,//(EC)DHE KeyUsage::keyEncipherment,//RSA @@ -647,8 +635,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, pinningDisabled, MIN_RSA_BITS_WEAK, ValidityCheckingMode::CheckingOff, SHA1Mode::Allowed, mNetscapeStepUpPolicy, - originAttributes, builtChain, nullptr, - nullptr); + originAttributes, builtChain, nullptr); rv = BuildCertChain(trustDomain, certDER, time, EndEntityOrCA::MustBeCA, KeyUsage::keyCertSign, KeyPurposeId::id_kp_serverAuth, @@ -664,8 +651,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, ValidityCheckingMode::CheckingOff, SHA1Mode::Allowed, NetscapeStepUpPolicy::NeverMatch, - originAttributes, builtChain, nullptr, - nullptr); + originAttributes, builtChain, nullptr); rv = BuildCertChain(trustDomain, certDER, time, EndEntityOrCA::MustBeEndEntity, KeyUsage::digitalSignature, @@ -692,8 +678,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, ValidityCheckingMode::CheckingOff, SHA1Mode::Allowed, NetscapeStepUpPolicy::NeverMatch, - originAttributes, builtChain, nullptr, - nullptr); + originAttributes, builtChain, nullptr); rv = BuildCertChain(trustDomain, certDER, time, EndEntityOrCA::MustBeEndEntity, KeyUsage::keyEncipherment, // RSA @@ -717,8 +702,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, ValidityCheckingMode::CheckingOff, SHA1Mode::Allowed, NetscapeStepUpPolicy::NeverMatch, - originAttributes, builtChain, nullptr, - nullptr); + originAttributes, builtChain, nullptr); rv = BuildCertChain(trustDomain, certDER, time, EndEntityOrCA::MustBeEndEntity, KeyUsage::digitalSignature, @@ -751,8 +735,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, ValidityCheckingMode::CheckingOff, SHA1Mode::Allowed, NetscapeStepUpPolicy::NeverMatch, - originAttributes, builtChain, nullptr, - nullptr); + originAttributes, builtChain, nullptr); rv = BuildCertChain(sslTrust, certDER, time, endEntityOrCA, keyUsage, eku, CertPolicyId::anyPolicy, stapledOCSPResponse); @@ -764,8 +747,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, ValidityCheckingMode::CheckingOff, SHA1Mode::Allowed, NetscapeStepUpPolicy::NeverMatch, - originAttributes, builtChain, nullptr, - nullptr); + originAttributes, builtChain, nullptr); rv = BuildCertChain(emailTrust, certDER, time, endEntityOrCA, keyUsage, eku, CertPolicyId::anyPolicy, stapledOCSPResponse); @@ -780,7 +762,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, SHA1Mode::Allowed, NetscapeStepUpPolicy::NeverMatch, originAttributes, builtChain, - nullptr, nullptr); + nullptr); rv = BuildCertChain(objectSigningTrust, certDER, time, endEntityOrCA, keyUsage, eku, CertPolicyId::anyPolicy, stapledOCSPResponse); @@ -816,7 +798,6 @@ CertVerifier::VerifySSLServerCert(const UniqueCERTCertificate& peerCert, /*optional out*/ OCSPStaplingStatus* ocspStaplingStatus, /*optional out*/ KeySizeStatus* keySizeStatus, /*optional out*/ SHA1ModeResult* sha1ModeResult, - /*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo, /*optional out*/ CertificateTransparencyInfo* ctInfo) { PR_ASSERT(peerCert); @@ -838,7 +819,7 @@ CertVerifier::VerifySSLServerCert(const UniqueCERTCertificate& peerCert, pinarg, hostname, builtChain, flags, stapledOCSPResponse, sctsFromTLS, originAttributes, evOidPolicy, ocspStaplingStatus, keySizeStatus, - sha1ModeResult, pinningTelemetryInfo, ctInfo); + sha1ModeResult, ctInfo); if (rv != Success) { return rv; } diff --git a/security/certverifier/CertVerifier.h b/security/certverifier/CertVerifier.h index d88c3f33c..fbc3adab4 100644 --- a/security/certverifier/CertVerifier.h +++ b/security/certverifier/CertVerifier.h @@ -11,7 +11,6 @@ #include "CTVerifyResult.h" #include "OCSPCache.h" #include "ScopedNSSTypes.h" -#include "mozilla/Telemetry.h" #include "mozilla/UniquePtr.h" #include "pkix/pkixtypes.h" @@ -66,22 +65,6 @@ enum class SHA1ModeResult { enum class NetscapeStepUpPolicy : uint32_t; -class PinningTelemetryInfo -{ -public: - PinningTelemetryInfo() { Reset(); } - - // Should we accumulate pinning telemetry for the result? - bool accumulateResult; - Telemetry::ID certPinningResultHistogram; - int32_t certPinningResultBucket; - // Should we accumulate telemetry for the root? - bool accumulateForRoot; - int32_t rootBucket; - - void Reset() { accumulateForRoot = false; accumulateResult = false; } -}; - class CertificateTransparencyInfo { public: @@ -137,7 +120,6 @@ public: /*optional out*/ OCSPStaplingStatus* ocspStaplingStatus = nullptr, /*optional out*/ KeySizeStatus* keySizeStatus = nullptr, /*optional out*/ SHA1ModeResult* sha1ModeResult = nullptr, - /*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo = nullptr, /*optional out*/ CertificateTransparencyInfo* ctInfo = nullptr); mozilla::pkix::Result VerifySSLServerCert( @@ -156,7 +138,6 @@ public: /*optional out*/ OCSPStaplingStatus* ocspStaplingStatus = nullptr, /*optional out*/ KeySizeStatus* keySizeStatus = nullptr, /*optional out*/ SHA1ModeResult* sha1ModeResult = nullptr, - /*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo = nullptr, /*optional out*/ CertificateTransparencyInfo* ctInfo = nullptr); enum PinningMode { diff --git a/security/certverifier/NSSCertDBTrustDomain.cpp b/security/certverifier/NSSCertDBTrustDomain.cpp index 39f7d3e9e..5e89c2484 100644 --- a/security/certverifier/NSSCertDBTrustDomain.cpp +++ b/security/certverifier/NSSCertDBTrustDomain.cpp @@ -60,7 +60,6 @@ NSSCertDBTrustDomain::NSSCertDBTrustDomain(SECTrustType certDBTrustType, NetscapeStepUpPolicy netscapeStepUpPolicy, const NeckoOriginAttributes& originAttributes, UniqueCERTCertList& builtChain, - /*optional*/ PinningTelemetryInfo* pinningTelemetryInfo, /*optional*/ const char* hostname) : mCertDBTrustType(certDBTrustType) , mOCSPFetching(ocspFetching) @@ -75,7 +74,6 @@ NSSCertDBTrustDomain::NSSCertDBTrustDomain(SECTrustType certDBTrustType, , mNetscapeStepUpPolicy(netscapeStepUpPolicy) , mOriginAttributes(originAttributes) , mBuiltChain(builtChain) - , mPinningTelemetryInfo(pinningTelemetryInfo) , mHostname(hostname) , mCertBlocklist(do_GetService(NS_CERTBLOCKLIST_CONTRACTID)) , mOCSPStaplingStatus(CertVerifier::OCSP_STAPLING_NEVER_CHECKED) @@ -874,8 +872,7 @@ NSSCertDBTrustDomain::IsChainValid(const DERArray& certArray, Time time) (mPinningMode == CertVerifier::pinningEnforceTestMode); bool chainHasValidPins; nsresult nsrv = PublicKeyPinningService::ChainHasValidPins( - certList, mHostname, time, enforceTestMode, chainHasValidPins, - mPinningTelemetryInfo); + certList, mHostname, time, enforceTestMode, chainHasValidPins); if (NS_FAILED(nsrv)) { return Result::FATAL_ERROR_LIBRARY_FAILURE; } diff --git a/security/certverifier/NSSCertDBTrustDomain.h b/security/certverifier/NSSCertDBTrustDomain.h index 64827536c..becf29eee 100644 --- a/security/certverifier/NSSCertDBTrustDomain.h +++ b/security/certverifier/NSSCertDBTrustDomain.h @@ -84,7 +84,6 @@ public: NetscapeStepUpPolicy netscapeStepUpPolicy, const NeckoOriginAttributes& originAttributes, UniqueCERTCertList& builtChain, - /*optional*/ PinningTelemetryInfo* pinningTelemetryInfo = nullptr, /*optional*/ const char* hostname = nullptr); virtual Result FindIssuer(mozilla::pkix::Input encodedIssuerName, @@ -188,7 +187,6 @@ private: NetscapeStepUpPolicy mNetscapeStepUpPolicy; const NeckoOriginAttributes& mOriginAttributes; UniqueCERTCertList& mBuiltChain; // non-owning - PinningTelemetryInfo* mPinningTelemetryInfo; const char* mHostname; // non-owning - only used for pinning checks nsCOMPtr<nsICertBlocklist> mCertBlocklist; CertVerifier::OCSPStaplingStatus mOCSPStaplingStatus; diff --git a/security/manager/ssl/PublicKeyPinningService.cpp b/security/manager/ssl/PublicKeyPinningService.cpp index 1f34c880b..ffee8ba48 100644 --- a/security/manager/ssl/PublicKeyPinningService.cpp +++ b/security/manager/ssl/PublicKeyPinningService.cpp @@ -4,11 +4,9 @@ #include "PublicKeyPinningService.h" -#include "RootCertificateTelemetryUtils.h" #include "mozilla/Base64.h" #include "mozilla/Casting.h" #include "mozilla/Logging.h" -#include "mozilla/Telemetry.h" #include "nsISiteSecurityService.h" #include "nsServiceManagerUtils.h" #include "nsSiteSecurityService.h" @@ -233,8 +231,7 @@ FindPinningInformation(const char* hostname, mozilla::pkix::Time time, static nsresult CheckPinsForHostname(const UniqueCERTCertList& certList, const char* hostname, bool enforceTestMode, mozilla::pkix::Time time, - /*out*/ bool& chainHasValidPins, - /*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo) + /*out*/ bool& chainHasValidPins) { chainHasValidPins = false; if (!certList) { @@ -265,47 +262,11 @@ CheckPinsForHostname(const UniqueCERTCertList& certList, const char* hostname, return rv; } chainHasValidPins = enforceTestModeResult; - Telemetry::ID histogram = staticFingerprints->mIsMoz - ? Telemetry::CERT_PINNING_MOZ_RESULTS - : Telemetry::CERT_PINNING_RESULTS; if (staticFingerprints->mTestMode) { - histogram = staticFingerprints->mIsMoz - ? Telemetry::CERT_PINNING_MOZ_TEST_RESULTS - : Telemetry::CERT_PINNING_TEST_RESULTS; if (!enforceTestMode) { chainHasValidPins = true; } } - // We can collect per-host pinning violations for this host because it is - // operationally critical to Firefox. - if (pinningTelemetryInfo) { - if (staticFingerprints->mId != kUnknownId) { - int32_t bucket = staticFingerprints->mId * 2 - + (enforceTestModeResult ? 1 : 0); - histogram = staticFingerprints->mTestMode - ? Telemetry::CERT_PINNING_MOZ_TEST_RESULTS_BY_HOST - : Telemetry::CERT_PINNING_MOZ_RESULTS_BY_HOST; - pinningTelemetryInfo->certPinningResultBucket = bucket; - } else { - pinningTelemetryInfo->certPinningResultBucket = - enforceTestModeResult ? 1 : 0; - } - pinningTelemetryInfo->accumulateResult = true; - pinningTelemetryInfo->certPinningResultHistogram = histogram; - } - - // We only collect per-CA pinning statistics upon failures. - CERTCertListNode* rootNode = CERT_LIST_TAIL(certList); - // Only log telemetry if the certificate list is non-empty. - if (!CERT_LIST_END(rootNode, certList)) { - if (!enforceTestModeResult && pinningTelemetryInfo) { - int32_t binNumber = RootCABinNumber(&rootNode->cert->derCert); - if (binNumber != ROOT_CERTIFICATE_UNKNOWN ) { - pinningTelemetryInfo->accumulateForRoot = true; - pinningTelemetryInfo->rootBucket = binNumber; - } - } - } MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: Pin check %s for %s host '%s' (mode=%s)\n", @@ -322,8 +283,7 @@ PublicKeyPinningService::ChainHasValidPins(const UniqueCERTCertList& certList, const char* hostname, mozilla::pkix::Time time, bool enforceTestMode, - /*out*/ bool& chainHasValidPins, - /*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo) + /*out*/ bool& chainHasValidPins) { chainHasValidPins = false; if (!certList) { @@ -334,8 +294,7 @@ PublicKeyPinningService::ChainHasValidPins(const UniqueCERTCertList& certList, } nsAutoCString canonicalizedHostname(CanonicalizeHostname(hostname)); return CheckPinsForHostname(certList, canonicalizedHostname.get(), - enforceTestMode, time, chainHasValidPins, - pinningTelemetryInfo); + enforceTestMode, time, chainHasValidPins); } nsresult diff --git a/security/manager/ssl/PublicKeyPinningService.h b/security/manager/ssl/PublicKeyPinningService.h index f42376b52..09fdd8474 100644 --- a/security/manager/ssl/PublicKeyPinningService.h +++ b/security/manager/ssl/PublicKeyPinningService.h @@ -31,8 +31,7 @@ public: const char* hostname, mozilla::pkix::Time time, bool enforceTestMode, - /*out*/ bool& chainHasValidPins, - /*optional out*/ PinningTelemetryInfo* pinningTelemetryInfo); + /*out*/ bool& chainHasValidPins); /** * Sets chainMatchesPinset to true if there is any intersection between the * certificate list and the pins specified in the aSHA256keys array. diff --git a/security/manager/ssl/RootCertificateTelemetryUtils.cpp b/security/manager/ssl/RootCertificateTelemetryUtils.cpp deleted file mode 100644 index 3f9ea3eb6..000000000 --- a/security/manager/ssl/RootCertificateTelemetryUtils.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "RootCertificateTelemetryUtils.h" - -#include "mozilla/Logging.h" -#include "RootHashes.inc" // Note: Generated by genRootCAHashes.js -#include "ScopedNSSTypes.h" -#include "mozilla/ArrayUtils.h" - -namespace mozilla { namespace psm { - -mozilla::LazyLogModule gPublicKeyPinningTelemetryLog("PublicKeyPinningTelemetryService"); - -// Used in the BinarySearch method, this does a memcmp between the pointer -// provided to its construtor and whatever the binary search is looking for. -// -// This implementation assumes everything to be of HASH_LEN, so it should not -// be used generically. -class BinaryHashSearchArrayComparator -{ -public: - explicit BinaryHashSearchArrayComparator(const uint8_t* aTarget, size_t len) - : mTarget(aTarget) - { - NS_ASSERTION(len == HASH_LEN, "Hashes should be of the same length."); - } - - int operator()(const CertAuthorityHash val) const { - return memcmp(mTarget, val.hash, HASH_LEN); - } - -private: - const uint8_t* mTarget; -}; - -// Perform a hash of the provided cert, then search in the RootHashes.inc data -// structure for a matching bin number. -int32_t -RootCABinNumber(const SECItem* cert) -{ - Digest digest; - - // Compute SHA256 hash of the certificate - nsresult rv = digest.DigestBuf(SEC_OID_SHA256, cert->data, cert->len); - if (NS_WARN_IF(NS_FAILED(rv))) { - return ROOT_CERTIFICATE_HASH_FAILURE; - } - - // Compare against list of stored hashes - size_t idx; - - MOZ_LOG(gPublicKeyPinningTelemetryLog, LogLevel::Debug, - ("pkpinTelem: First bytes %02hx %02hx %02hx %02hx\n", - digest.get().data[0], digest.get().data[1], digest.get().data[2], digest.get().data[3])); - - if (mozilla::BinarySearchIf(ROOT_TABLE, 0, ArrayLength(ROOT_TABLE), - BinaryHashSearchArrayComparator(static_cast<uint8_t*>(digest.get().data), - digest.get().len), - &idx)) { - - MOZ_LOG(gPublicKeyPinningTelemetryLog, LogLevel::Debug, - ("pkpinTelem: Telemetry index was %lu, bin is %d\n", - idx, ROOT_TABLE[idx].binNumber)); - return (int32_t) ROOT_TABLE[idx].binNumber; - } - - // Didn't match. - return ROOT_CERTIFICATE_UNKNOWN; -} - - -// Attempt to increment the appropriate bin in the provided Telemetry probe ID. If -// there was a hash failure, we do nothing. -void -AccumulateTelemetryForRootCA(mozilla::Telemetry::ID probe, - const CERTCertificate* cert) -{ - int32_t binId = RootCABinNumber(&cert->derCert); - - if (binId != ROOT_CERTIFICATE_HASH_FAILURE) { - Accumulate(probe, binId); - } -} - -} // namespace psm -} // namespace mozilla diff --git a/security/manager/ssl/RootCertificateTelemetryUtils.h b/security/manager/ssl/RootCertificateTelemetryUtils.h deleted file mode 100644 index 05dbb4e44..000000000 --- a/security/manager/ssl/RootCertificateTelemetryUtils.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef RootCertificateTelemetryUtils_h -#define RootCertificateTelemetryUtils_h - -#include "mozilla/Telemetry.h" -#include "certt.h" - -namespace mozilla { namespace psm { - -// Note: New CAs will show up as UNKNOWN_ROOT until -// RootHashes.inc is updated to include them. 0 is reserved by -// genRootCAHashes.js for the unknowns. -#define ROOT_CERTIFICATE_UNKNOWN 0 -#define ROOT_CERTIFICATE_HASH_FAILURE -1 - -int32_t -RootCABinNumber(const SECItem* cert); - -void -AccumulateTelemetryForRootCA(mozilla::Telemetry::ID probe, const CERTCertificate* cert); - -} // namespace psm -} // namespace mozilla - -#endif // RootCertificateTelemetryUtils_h diff --git a/security/manager/ssl/SSLServerCertVerification.cpp b/security/manager/ssl/SSLServerCertVerification.cpp index 757534955..af985eb92 100644 --- a/security/manager/ssl/SSLServerCertVerification.cpp +++ b/security/manager/ssl/SSLServerCertVerification.cpp @@ -102,7 +102,6 @@ #include "ExtendedValidation.h" #include "NSSCertDBTrustDomain.h" #include "PSMRunnable.h" -#include "RootCertificateTelemetryUtils.h" #include "ScopedNSSTypes.h" #include "SharedCertVerifier.h" #include "SharedSSLState.h" @@ -112,7 +111,6 @@ #include "mozilla/Casting.h" #include "mozilla/Mutex.h" #include "mozilla/RefPtr.h" -#include "mozilla/Telemetry.h" #include "mozilla/UniquePtr.h" #include "mozilla/Unused.h" #include "mozilla/net/DNS.h" @@ -150,11 +148,6 @@ namespace { // do not use a nsCOMPtr to avoid static initializer/destructor nsIThreadPool* gCertVerificationThreadPool = nullptr; -// We avoid using a mutex for the success case to avoid lock-related -// performance issues. However, we do use a lock in the error case to simplify -// the code, since performance in the error case is not important. -Mutex* gSSLVerificationTelemetryMutex = nullptr; - // We add a mutex to serialize PKCS11 database operations Mutex* gSSLVerificationPK11Mutex = nullptr; @@ -173,7 +166,6 @@ Mutex* gSSLVerificationPK11Mutex = nullptr; void InitializeSSLServerCertVerificationThreads() { - gSSLVerificationTelemetryMutex = new Mutex("SSLVerificationTelemetryMutex"); gSSLVerificationPK11Mutex = new Mutex("SSLVerificationPK11Mutex"); // TODO: tuning, make parameters preferences // XXX: instantiate nsThreadPool directly, to make this more bulletproof. @@ -207,10 +199,6 @@ void StopSSLServerCertVerificationThreads() gCertVerificationThreadPool->Shutdown(); NS_RELEASE(gCertVerificationThreadPool); } - if (gSSLVerificationTelemetryMutex) { - delete gSSLVerificationTelemetryMutex; - gSSLVerificationTelemetryMutex = nullptr; - } if (gSSLVerificationPK11Mutex) { delete gSSLVerificationPK11Mutex; gSSLVerificationPK11Mutex = nullptr; @@ -244,8 +232,6 @@ public: SSLServerCertVerificationResult(nsNSSSocketInfo* infoObject, PRErrorCode errorCode, - Telemetry::ID telemetryID = Telemetry::HistogramCount, - uint32_t telemetryValue = -1, SSLErrorMessageType errorMessageType = PlainErrorMessage); @@ -255,8 +241,6 @@ private: public: const PRErrorCode mErrorCode; const SSLErrorMessageType mErrorMessageType; - const Telemetry::ID mTelemetryID; - const uint32_t mTelemetryValue; }; class CertErrorRunnable : public SyncRunnableBase @@ -297,63 +281,6 @@ private: const uint32_t mProviderFlags; }; -// A probe value of 1 means "no error". -uint32_t -MapOverridableErrorToProbeValue(PRErrorCode errorCode) -{ - switch (errorCode) - { - case SEC_ERROR_UNKNOWN_ISSUER: return 2; - case SEC_ERROR_CA_CERT_INVALID: return 3; - case SEC_ERROR_UNTRUSTED_ISSUER: return 4; - case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE: return 5; - case SEC_ERROR_UNTRUSTED_CERT: return 6; - case SEC_ERROR_INADEQUATE_KEY_USAGE: return 7; - case SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED: return 8; - case SSL_ERROR_BAD_CERT_DOMAIN: return 9; - case SEC_ERROR_EXPIRED_CERTIFICATE: return 10; - case mozilla::pkix::MOZILLA_PKIX_ERROR_CA_CERT_USED_AS_END_ENTITY: return 11; - case mozilla::pkix::MOZILLA_PKIX_ERROR_V1_CERT_USED_AS_CA: return 12; - case mozilla::pkix::MOZILLA_PKIX_ERROR_INADEQUATE_KEY_SIZE: return 13; - case mozilla::pkix::MOZILLA_PKIX_ERROR_NOT_YET_VALID_CERTIFICATE: return 14; - case mozilla::pkix::MOZILLA_PKIX_ERROR_NOT_YET_VALID_ISSUER_CERTIFICATE: - return 15; - case SEC_ERROR_INVALID_TIME: return 16; - case mozilla::pkix::MOZILLA_PKIX_ERROR_EMPTY_ISSUER_NAME: return 17; - } - NS_WARNING("Unknown certificate error code. Does MapOverridableErrorToProbeValue " - "handle everything in DetermineCertOverrideErrors?"); - return 0; -} - -static uint32_t -MapCertErrorToProbeValue(PRErrorCode errorCode) -{ - uint32_t probeValue; - switch (errorCode) - { - // see security/pkix/include/pkix/Result.h -#define MOZILLA_PKIX_MAP(name, value, nss_name) case nss_name: probeValue = value; break; - MOZILLA_PKIX_MAP_LIST -#undef MOZILLA_PKIX_MAP - default: return 0; - } - - // Since FATAL_ERROR_FLAG is 0x800, fatal error values are much larger than - // non-fatal error values. To conserve space, we remap these so they start at - // (decimal) 90 instead of 0x800. Currently there are ~50 non-fatal errors - // mozilla::pkix might return, so saving space for 90 should be sufficient - // (similarly, there are 4 fatal errors, so saving space for 10 should also - // be sufficient). - static_assert(FATAL_ERROR_FLAG == 0x800, - "mozilla::pkix::FATAL_ERROR_FLAG is not what we were expecting"); - if (probeValue & FATAL_ERROR_FLAG) { - probeValue ^= FATAL_ERROR_FLAG; - probeValue += 90; - } - return probeValue; -} - SECStatus DetermineCertOverrideErrors(const UniqueCERTCertificate& cert, const char* hostName, @@ -562,19 +489,6 @@ CertErrorRunnable::CheckCertOverrides() } if (!remaining_display_errors) { - // This can double- or triple-count one certificate with multiple - // different types of errors. Since this is telemetry and we just - // want a ballpark answer, we don't care. - if (mErrorCodeTrust != 0) { - uint32_t probeValue = MapOverridableErrorToProbeValue(mErrorCodeTrust); - } - if (mErrorCodeMismatch != 0) { - uint32_t probeValue = MapOverridableErrorToProbeValue(mErrorCodeMismatch); - } - if (mErrorCodeTime != 0) { - uint32_t probeValue = MapOverridableErrorToProbeValue(mErrorCodeTime); - } - // all errors are covered by override rules, so let's accept the cert MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] All errors covered by override rules\n", @@ -621,8 +535,6 @@ CertErrorRunnable::CheckCertOverrides() SSLServerCertVerificationResult* result = new SSLServerCertVerificationResult(mInfoObject, errorCodeToReport, - Telemetry::HistogramCount, - -1, OverridableCertErrorMessage); LogInvalidCertError(mInfoObject, @@ -656,8 +568,6 @@ CreateCertErrorRunnable(CertVerifier& certVerifier, MOZ_ASSERT(infoObject); MOZ_ASSERT(cert); - uint32_t probeValue = MapCertErrorToProbeValue(defaultErrorCodeToReport); - uint32_t collected_errors = 0; PRErrorCode errorCodeTrust = 0; PRErrorCode errorCodeMismatch = 0; @@ -861,334 +771,6 @@ BlockServerCertChangeForSpdy(nsNSSSocketInfo* infoObject, return SECFailure; } -void -AccumulateSubjectCommonNameTelemetry(const char* commonName, - bool commonNameInSubjectAltNames) -{ - if (!commonNameInSubjectAltNames) { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: common name '%s' not in subject alt. names " - "(or the subject alt. names extension is not present)\n", - commonName)); - } -} - -// Returns true if and only if commonName ends with altName (minus its leading -// "*"). altName has already been checked to be of the form "*.<something>". -// commonName may be NULL. -static bool -TryMatchingWildcardSubjectAltName(const char* commonName, - const nsACString& altName) -{ - return commonName && - StringEndsWith(nsDependentCString(commonName), Substring(altName, 1)); -} - -// Gathers telemetry on Baseline Requirements 9.2.1 (Subject Alternative -// Names Extension) and 9.2.2 (Subject Common Name Field). -// Specifically: -// - whether or not the subject common name field is present -// - whether or not the subject alternative names extension is present -// - if there is a malformed entry in the subject alt. names extension -// - if there is an entry in the subject alt. names extension corresponding -// to the subject common name -// Telemetry is only gathered for certificates that chain to a trusted root -// in Mozilla's Root CA program. -// certList consists of a validated certificate chain. The end-entity -// certificate is first and the root (trust anchor) is last. -void -GatherBaselineRequirementsTelemetry(const UniqueCERTCertList& certList) -{ - CERTCertListNode* endEntityNode = CERT_LIST_HEAD(certList); - CERTCertListNode* rootNode = CERT_LIST_TAIL(certList); - PR_ASSERT(!(CERT_LIST_END(endEntityNode, certList) || - CERT_LIST_END(rootNode, certList))); - if (CERT_LIST_END(endEntityNode, certList) || - CERT_LIST_END(rootNode, certList)) { - return; - } - CERTCertificate* cert = endEntityNode->cert; - PR_ASSERT(cert); - if (!cert) { - return; - } - UniquePORTString commonName(CERT_GetCommonName(&cert->subject)); - // This only applies to certificates issued by authorities in our root - // program. - CERTCertificate* rootCert = rootNode->cert; - PR_ASSERT(rootCert); - if (!rootCert) { - return; - } - bool isBuiltIn = false; - Result result = IsCertBuiltInRoot(rootCert, isBuiltIn); - if (result != Success || !isBuiltIn) { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: root certificate for '%s' is not a built-in root " - "(or IsCertBuiltInRoot failed)\n", commonName.get())); - return; - } - ScopedAutoSECItem altNameExtension; - SECStatus rv = CERT_FindCertExtension(cert, SEC_OID_X509_SUBJECT_ALT_NAME, - &altNameExtension); - if (rv != SECSuccess) { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: no subject alt names extension for '%s'\n", - commonName.get())); - AccumulateSubjectCommonNameTelemetry(commonName.get(), false); - return; - } - - UniquePLArenaPool arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE)); - CERTGeneralName* subjectAltNames = - CERT_DecodeAltNameExtension(arena.get(), &altNameExtension); - if (!subjectAltNames) { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: could not decode subject alt names for '%s'\n", - commonName.get())); - AccumulateSubjectCommonNameTelemetry(commonName.get(), false); - return; - } - - CERTGeneralName* currentName = subjectAltNames; - bool commonNameInSubjectAltNames = false; - bool nonDNSNameOrIPAddressPresent = false; - bool malformedDNSNameOrIPAddressPresent = false; - bool nonFQDNPresent = false; - do { - nsAutoCString altName; - if (currentName->type == certDNSName) { - altName.Assign(BitwiseCast<char*, unsigned char*>( - currentName->name.other.data), - currentName->name.other.len); - nsDependentCString altNameWithoutWildcard(altName, 0); - if (StringBeginsWith(altNameWithoutWildcard, NS_LITERAL_CSTRING("*."))) { - altNameWithoutWildcard.Rebind(altName, 2); - commonNameInSubjectAltNames |= - TryMatchingWildcardSubjectAltName(commonName.get(), altName); - } - // net_IsValidHostName appears to return true for valid IP addresses, - // which would be invalid for a DNS name. - // Note that the net_IsValidHostName check will catch things like - // "a.*.example.com". - if (!net_IsValidHostName(altNameWithoutWildcard) || - net_IsValidIPv4Addr(altName.get(), altName.Length()) || - net_IsValidIPv6Addr(altName.get(), altName.Length())) { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: DNSName '%s' not valid (for '%s')\n", - altName.get(), commonName.get())); - malformedDNSNameOrIPAddressPresent = true; - } - if (!altName.Contains('.')) { - nonFQDNPresent = true; - } - } else if (currentName->type == certIPAddress) { - // According to DNS.h, this includes space for the null-terminator - char buf[net::kNetAddrMaxCStrBufSize] = { 0 }; - PRNetAddr addr; - if (currentName->name.other.len == 4) { - addr.inet.family = PR_AF_INET; - memcpy(&addr.inet.ip, currentName->name.other.data, - currentName->name.other.len); - if (PR_NetAddrToString(&addr, buf, sizeof(buf) - 1) != PR_SUCCESS) { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: IPAddress (v4) not valid (for '%s')\n", - commonName.get())); - malformedDNSNameOrIPAddressPresent = true; - } else { - altName.Assign(buf); - } - } else if (currentName->name.other.len == 16) { - addr.inet.family = PR_AF_INET6; - memcpy(&addr.ipv6.ip, currentName->name.other.data, - currentName->name.other.len); - if (PR_NetAddrToString(&addr, buf, sizeof(buf) - 1) != PR_SUCCESS) { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: IPAddress (v6) not valid (for '%s')\n", - commonName.get())); - malformedDNSNameOrIPAddressPresent = true; - } else { - altName.Assign(buf); - } - } else { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: IPAddress not valid (for '%s')\n", - commonName.get())); - malformedDNSNameOrIPAddressPresent = true; - } - } else { - MOZ_LOG(gPIPNSSLog, LogLevel::Debug, - ("BR telemetry: non-DNSName, non-IPAddress present for '%s'\n", - commonName.get())); - nonDNSNameOrIPAddressPresent = true; - } - if (commonName && altName.Equals(commonName.get())) { - commonNameInSubjectAltNames = true; - } - currentName = CERT_GetNextGeneralName(currentName); - } while (currentName && currentName != subjectAltNames); - - AccumulateSubjectCommonNameTelemetry(commonName.get(), - commonNameInSubjectAltNames); -} - -// Gather telemetry on whether the end-entity cert for a server has the -// required TLS Server Authentication EKU, or any others -void -GatherEKUTelemetry(const UniqueCERTCertList& certList) -{ - CERTCertListNode* endEntityNode = CERT_LIST_HEAD(certList); - CERTCertListNode* rootNode = CERT_LIST_TAIL(certList); - PR_ASSERT(!(CERT_LIST_END(endEntityNode, certList) || - CERT_LIST_END(rootNode, certList))); - if (CERT_LIST_END(endEntityNode, certList) || - CERT_LIST_END(rootNode, certList)) { - return; - } - CERTCertificate* endEntityCert = endEntityNode->cert; - PR_ASSERT(endEntityCert); - if (!endEntityCert) { - return; - } - - // Only log telemetry if the root CA is built-in - CERTCertificate* rootCert = rootNode->cert; - PR_ASSERT(rootCert); - if (!rootCert) { - return; - } - bool isBuiltIn = false; - Result rv = IsCertBuiltInRoot(rootCert, isBuiltIn); - if (rv != Success || !isBuiltIn) { - return; - } - - // Find the EKU extension, if present - bool foundEKU = false; - SECOidTag oidTag; - CERTCertExtension* ekuExtension = nullptr; - for (size_t i = 0; endEntityCert->extensions && endEntityCert->extensions[i]; - i++) { - oidTag = SECOID_FindOIDTag(&endEntityCert->extensions[i]->id); - if (oidTag == SEC_OID_X509_EXT_KEY_USAGE) { - foundEKU = true; - ekuExtension = endEntityCert->extensions[i]; - } - } - - if (!foundEKU) { - return; - } - - // Parse the EKU extension - UniqueCERTOidSequence ekuSequence( - CERT_DecodeOidSequence(&ekuExtension->value)); - if (!ekuSequence) { - return; - } - - // Search through the available EKUs - bool foundServerAuth = false; - bool foundOther = false; - for (SECItem** oids = ekuSequence->oids; oids && *oids; oids++) { - oidTag = SECOID_FindOIDTag(*oids); - if (oidTag == SEC_OID_EXT_KEY_USAGE_SERVER_AUTH) { - foundServerAuth = true; - } else { - foundOther = true; - } - } -} - -// Gathers telemetry on which CA is the root of a given cert chain. -// If the root is a built-in root, then the telemetry makes a count -// by root. Roots that are not built-in are counted in one bin. -void -GatherRootCATelemetry(const UniqueCERTCertList& certList) -{ - CERTCertListNode* rootNode = CERT_LIST_TAIL(certList); - PR_ASSERT(rootNode); - if (!rootNode) { - return; - } - PR_ASSERT(!CERT_LIST_END(rootNode, certList)); - if (CERT_LIST_END(rootNode, certList)) { - return; - } - CERTCertificate* rootCert = rootNode->cert; - PR_ASSERT(rootCert); - if (!rootCert) { - return; - } - AccumulateTelemetryForRootCA(Telemetry::CERT_VALIDATION_SUCCESS_BY_CA, - rootCert); -} - -// These time are appoximate, i.e., doesn't account for leap seconds, etc -const uint64_t ONE_WEEK_IN_SECONDS = (7 * (24 * 60 *60)); -const uint64_t ONE_YEAR_IN_WEEKS = 52; - -// Gathers telemetry on the certificate lifetimes we observe in the wild -void -GatherEndEntityTelemetry(const UniqueCERTCertList& certList) -{ - CERTCertListNode* endEntityNode = CERT_LIST_HEAD(certList); - MOZ_ASSERT(endEntityNode && !CERT_LIST_END(endEntityNode, certList)); - if (!endEntityNode || CERT_LIST_END(endEntityNode, certList)) { - return; - } - - CERTCertificate* endEntityCert = endEntityNode->cert; - PR_ASSERT(endEntityCert); - if (!endEntityCert) { - return; - } - - PRTime notBefore; - PRTime notAfter; - - if (CERT_GetCertTimes(endEntityCert, ¬Before, ¬After) != SECSuccess) { - return; - } - - PR_ASSERT(notAfter > notBefore); - if (notAfter <= notBefore) { - return; - } - - uint64_t durationInWeeks = (notAfter - notBefore) - / PR_USEC_PER_SEC - / ONE_WEEK_IN_SECONDS; - - if (durationInWeeks > (2 * ONE_YEAR_IN_WEEKS)) { - durationInWeeks = (2 * ONE_YEAR_IN_WEEKS) + 1; - } -} - -// There are various things that we want to measure about certificate -// chains that we accept. This is a single entry point for all of them. -void -GatherSuccessfulValidationTelemetry(const UniqueCERTCertList& certList) -{ - GatherBaselineRequirementsTelemetry(certList); - GatherEKUTelemetry(certList); - GatherRootCATelemetry(certList); - GatherEndEntityTelemetry(certList); -} - -void -GatherTelemetryForSingleSCT(const ct::SignedCertificateTimestamp& sct) -{ -/* STUB */ -} - -void -GatherCertificateTransparencyTelemetry(const UniqueCERTCertList& certList, - const CertificateTransparencyInfo& info) -{ -/* STUB */ -} - // Note: Takes ownership of |peerCertChain| if SECSuccess is not returned. SECStatus AuthCertificate(CertVerifier& certVerifier, @@ -1214,7 +796,6 @@ AuthCertificate(CertVerifier& certVerifier, CertVerifier::OCSP_STAPLING_NEVER_CHECKED; KeySizeStatus keySizeStatus = KeySizeStatus::NeverChecked; SHA1ModeResult sha1ModeResult = SHA1ModeResult::NeverChecked; - PinningTelemetryInfo pinningTelemetryInfo; CertificateTransparencyInfo certificateTransparencyInfo; int flags = 0; @@ -1233,22 +814,14 @@ AuthCertificate(CertVerifier& certVerifier, &evOidPolicy, &ocspStaplingStatus, &keySizeStatus, &sha1ModeResult, - &pinningTelemetryInfo, &certificateTransparencyInfo); - uint32_t evStatus = (rv != Success) ? 0 // 0 = Failure - : (evOidPolicy == SEC_OID_UNKNOWN) ? 1 // 1 = DV - : 2; // 2 = EV - if (rv == Success) { // Certificate verification succeeded. Delete any potential record of // certificate error bits. RememberCertErrorsTable::GetInstance().RememberCertHasError(infoObject, nullptr, SECSuccess); - GatherSuccessfulValidationTelemetry(certList); - GatherCertificateTransparencyTelemetry(certList, - certificateTransparencyInfo); // The connection may get terminated, for example, if the server requires // a client cert. Let's provide a minimal SSLStatus @@ -1363,11 +936,6 @@ SSLServerCertVerificationJob::Run() if (mInfoObject->isAlreadyShutDown()) { error = SEC_ERROR_USER_CANCELLED; } else { - Telemetry::ID successTelemetry - = Telemetry::SSL_SUCCESFUL_CERT_VALIDATION_TIME_MOZILLAPKIX; - Telemetry::ID failureTelemetry - = Telemetry::SSL_INITIAL_FAILED_CERT_VALIDATION_TIME_MOZILLAPKIX; - // Reset the error code here so we can detect if AuthCertificate fails to // set the error code if/when it fails. PR_SetError(0, 0); @@ -1378,21 +946,15 @@ SSLServerCertVerificationJob::Run() MOZ_ASSERT(mPeerCertChain || rv != SECSuccess, "AuthCertificate() should take ownership of chain on failure"); if (rv == SECSuccess) { - uint32_t interval = (uint32_t) ((TimeStamp::Now() - mJobStartTime).ToMilliseconds()); RefPtr<SSLServerCertVerificationResult> restart( - new SSLServerCertVerificationResult(mInfoObject, 0, - successTelemetry, interval)); + new SSLServerCertVerificationResult(mInfoObject, 0)); restart->Dispatch(); return NS_OK; } // Note: the interval is not calculated once as PR_GetError MUST be called - // before any other function call + // before any other function call error = PR_GetError(); - { - TimeStamp now = TimeStamp::Now(); - MutexAutoLock telemetryMutex(*gSSLVerificationTelemetryMutex); - } if (error != 0) { RefPtr<CertErrorRunnable> runnable( CreateCertErrorRunnable(*mCertVerifier, error, mInfoObject, mCert, @@ -1614,19 +1176,11 @@ AuthCertificateHook(void* arg, PRFileDesc* fd, PRBool checkSig, PRBool isServer) SSLServerCertVerificationResult::SSLServerCertVerificationResult( nsNSSSocketInfo* infoObject, PRErrorCode errorCode, - Telemetry::ID telemetryID, uint32_t telemetryValue, SSLErrorMessageType errorMessageType) : mInfoObject(infoObject) , mErrorCode(errorCode) , mErrorMessageType(errorMessageType) - , mTelemetryID(telemetryID) - , mTelemetryValue(telemetryValue) { -// We accumulate telemetry for (only) successful validations on the main thread -// to avoid adversely affecting performance by acquiring the mutex that we use -// when accumulating the telemetry for unsuccessful validations. Unsuccessful -// validations times are accumulated elsewhere. -MOZ_ASSERT(telemetryID == Telemetry::HistogramCount || errorCode == 0); } void diff --git a/security/manager/ssl/moz.build b/security/manager/ssl/moz.build index 19e1b4f4b..8c8d25dcc 100644 --- a/security/manager/ssl/moz.build +++ b/security/manager/ssl/moz.build @@ -135,7 +135,6 @@ UNIFIED_SOURCES += [ 'PSMContentListener.cpp', 'PSMRunnable.cpp', 'PublicKeyPinningService.cpp', - 'RootCertificateTelemetryUtils.cpp', 'SecretDecoderRing.cpp', 'SharedSSLState.cpp', 'SSLServerCertVerification.cpp', diff --git a/security/manager/ssl/nsKeygenHandler.cpp b/security/manager/ssl/nsKeygenHandler.cpp index 9196e200c..0af761d7e 100644 --- a/security/manager/ssl/nsKeygenHandler.cpp +++ b/security/manager/ssl/nsKeygenHandler.cpp @@ -8,7 +8,6 @@ #include "cryptohi.h" #include "keyhi.h" #include "mozilla/Assertions.h" -#include "mozilla/Telemetry.h" #include "nsIContent.h" #include "nsIDOMHTMLSelectElement.h" #include "nsIGenKeypairInfoDlg.h" @@ -395,13 +394,6 @@ loser: return rv; } - -void -GatherKeygenTelemetry(uint32_t keyGenMechanism, int keysize, char* curve) -{ -/* STUB */ -} - nsresult nsKeygenFormProcessor::GetPublicKey(const nsAString& aValue, const nsAString& aChallenge, @@ -639,8 +631,6 @@ nsKeygenFormProcessor::GetPublicKey(const nsAString& aValue, CopyASCIItoUTF16(keystring.get(), aOutPublicKey); rv = NS_OK; - - GatherKeygenTelemetry(keyGenMechanism, keysize, keyparamsString); loser: if (srv != SECSuccess) { if ( privateKey ) { diff --git a/security/manager/ssl/nsNSSCallbacks.cpp b/security/manager/ssl/nsNSSCallbacks.cpp index b8f1b0eb7..dda936d8c 100644 --- a/security/manager/ssl/nsNSSCallbacks.cpp +++ b/security/manager/ssl/nsNSSCallbacks.cpp @@ -14,7 +14,6 @@ #include "mozilla/Assertions.h" #include "mozilla/Casting.h" #include "mozilla/RefPtr.h" -#include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/Unused.h" #include "nsContentUtils.h" @@ -1072,37 +1071,6 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart) return SECSuccess; } -static void -AccumulateNonECCKeySize(Telemetry::ID probe, uint32_t bits) -{ - unsigned int value = bits < 512 ? 1 : bits == 512 ? 2 - : bits < 768 ? 3 : bits == 768 ? 4 - : bits < 1024 ? 5 : bits == 1024 ? 6 - : bits < 1280 ? 7 : bits == 1280 ? 8 - : bits < 1536 ? 9 : bits == 1536 ? 10 - : bits < 2048 ? 11 : bits == 2048 ? 12 - : bits < 3072 ? 13 : bits == 3072 ? 14 - : bits < 4096 ? 15 : bits == 4096 ? 16 - : bits < 8192 ? 17 : bits == 8192 ? 18 - : bits < 16384 ? 19 : bits == 16384 ? 20 - : 0; -} - -// XXX: This attempts to map a bit count to an ECC named curve identifier. In -// the vast majority of situations, we only have the Suite B curves available. -// In that case, this mapping works fine. If we were to have more curves -// available, the mapping would be ambiguous since there could be multiple -// named curves for a given size (e.g. secp256k1 vs. secp256r1). We punt on -// that for now. See also NSS bug 323674. -static void -AccumulateECCCurve(Telemetry::ID probe, uint32_t bits) -{ - unsigned int value = bits == 256 ? 23 // P-256 - : bits == 384 ? 24 // P-384 - : bits == 521 ? 25 // P-521 - : 0; // Unknown -} - // In the case of session resumption, the AuthCertificate hook has been bypassed // (because we've previously successfully connected to our peer). That being the // case, we unfortunately don't know if the peer's server certificate verified @@ -1216,11 +1184,6 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) { rv = SSL_GetChannelInfo(fd, &channelInfo, sizeof(channelInfo)); MOZ_ASSERT(rv == SECSuccess); if (rv == SECSuccess) { - // Get the protocol version for telemetry - // 1=tls1, 2=tls1.1, 3=tls1.2 - unsigned int versionEnum = channelInfo.protocolVersion & 0xFF; - MOZ_ASSERT(versionEnum > 0); - SSLCipherSuiteInfo cipherInfo; rv = SSL_GetCipherSuiteInfo(channelInfo.cipherSuite, &cipherInfo, sizeof cipherInfo); @@ -1231,16 +1194,10 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) { if (infoObject->IsFullHandshake()) { switch (channelInfo.keaType) { case ssl_kea_rsa: - AccumulateNonECCKeySize(Telemetry::SSL_KEA_RSA_KEY_SIZE_FULL, - channelInfo.keaKeyBits); break; case ssl_kea_dh: - AccumulateNonECCKeySize(Telemetry::SSL_KEA_DHE_KEY_SIZE_FULL, - channelInfo.keaKeyBits); break; case ssl_kea_ecdh: - AccumulateECCCurve(Telemetry::SSL_KEA_ECDHE_CURVE_FULL, - channelInfo.keaKeyBits); break; default: MOZ_CRASH("impossible KEA"); @@ -1252,12 +1209,8 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) { switch (channelInfo.authType) { case ssl_auth_rsa: case ssl_auth_rsa_sign: - AccumulateNonECCKeySize(Telemetry::SSL_AUTH_RSA_KEY_SIZE_FULL, - channelInfo.authKeyBits); break; case ssl_auth_ecdsa: - AccumulateECCCurve(Telemetry::SSL_AUTH_ECDSA_CURVE_FULL, - channelInfo.authKeyBits); break; default: MOZ_CRASH("impossible auth algorithm"); diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp index f580f2bcb..4d6c3963f 100644 --- a/security/manager/ssl/nsNSSComponent.cpp +++ b/security/manager/ssl/nsNSSComponent.cpp @@ -19,7 +19,6 @@ #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "mozilla/SyncRunnable.h" -#include "mozilla/Telemetry.h" #include "mozilla/Unused.h" #include "nsAppDirectoryServiceDefs.h" #include "nsCRT.h" @@ -785,13 +784,6 @@ nsNSSComponent::UnloadFamilySafetyRoot() // 2: detect Family Safety mode and import the root const char* kFamilySafetyModePref = "security.family_safety.mode"; -// The telemetry gathered by this function is as follows: -// 0-2: the value of the Family Safety mode pref -// 3: detecting Family Safety mode failed -// 4: Family Safety was not enabled -// 5: Family Safety was enabled -// 6: failed to import the Family Safety root -// 7: successfully imported the root void nsNSSComponent::MaybeEnableFamilySafetyCompatibility() { @@ -1564,15 +1556,6 @@ CipherSuiteChangeObserver::Observe(nsISupports* aSubject, void nsNSSComponent::setValidationOptions(bool isInitialSetting, const MutexAutoLock& lock) { - // This preference controls whether we do OCSP fetching and does not affect - // OCSP stapling. - // 0 = disabled, 1 = enabled - int32_t ocspEnabled = Preferences::GetInt("security.OCSP.enabled", - OCSP_ENABLED_DEFAULT); - - bool ocspRequired = ocspEnabled && - Preferences::GetBool("security.OCSP.require", false); - bool ocspStaplingEnabled = Preferences::GetBool("security.ssl.enable_ocsp_stapling", true); PublicSSLState()->SetOCSPStaplingEnabled(ocspStaplingEnabled); diff --git a/security/manager/ssl/nsNSSIOLayer.cpp b/security/manager/ssl/nsNSSIOLayer.cpp index d2549c52d..337ef8b8e 100644 --- a/security/manager/ssl/nsNSSIOLayer.cpp +++ b/security/manager/ssl/nsNSSIOLayer.cpp @@ -20,7 +20,6 @@ #include "mozilla/Logging.h" #include "mozilla/Move.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "nsArray.h" #include "nsArrayUtils.h" #include "nsCharSeparatedTokenizer.h" @@ -244,21 +243,6 @@ nsNSSSocketInfo::NoteTimeUntilReady() void nsNSSSocketInfo::SetHandshakeCompleted() { - if (!mHandshakeCompleted) { - enum HandshakeType { - Resumption = 1, - FalseStarted = 2, - ChoseNotToFalseStart = 3, - NotAllowedToFalseStart = 4, - }; - - HandshakeType handshakeType = !IsFullHandshake() ? Resumption - : mFalseStarted ? FalseStarted - : mFalseStartCallbackCalled ? ChoseNotToFalseStart - : NotAllowedToFalseStart; - } - - // Remove the plain text layer as it is not needed anymore. // The plain text layer is not always present - so its not a fatal error // if it cannot be removed @@ -1050,29 +1034,6 @@ class SSLErrorRunnable : public SyncRunnableBase namespace { -uint32_t tlsIntoleranceTelemetryBucket(PRErrorCode err) -{ - // returns a numeric code for where we track various errors in telemetry - // only errors that cause version fallback are tracked, - // so this is also used to determine which errors can cause version fallback - switch (err) { - case SSL_ERROR_BAD_MAC_ALERT: return 1; - case SSL_ERROR_BAD_MAC_READ: return 2; - case SSL_ERROR_HANDSHAKE_FAILURE_ALERT: return 3; - case SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT: return 4; - case SSL_ERROR_ILLEGAL_PARAMETER_ALERT: return 6; - case SSL_ERROR_NO_CYPHER_OVERLAP: return 7; - case SSL_ERROR_UNSUPPORTED_VERSION: return 10; - case SSL_ERROR_PROTOCOL_VERSION_ALERT: return 11; - case SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE: return 13; - case SSL_ERROR_DECODE_ERROR_ALERT: return 14; - case PR_CONNECT_RESET_ERROR: return 16; - case PR_END_OF_FILE_ERROR: return 17; - case SSL_ERROR_INTERNAL_ERROR_ALERT: return 18; - default: return 0; - } -} - bool retryDueToTLSIntolerance(PRErrorCode err, nsNSSSocketInfo* socketInfo) { @@ -1097,13 +1058,6 @@ retryDueToTLSIntolerance(PRErrorCode err, nsNSSSocketInfo* socketInfo) // this as a hard failure, but forget any intolerance so that later attempts // don't use this version (i.e., range.max) and trigger the error again. - // First, track the original cause of the version fallback. This uses the - // same buckets as the telemetry below, except that bucket 0 will include - // all cases where there wasn't an original reason. - PRErrorCode originalReason = - helpers.getIntoleranceReason(socketInfo->GetHostName(), - socketInfo->GetPort()); - helpers.forgetIntolerance(socketInfo->GetHostName(), socketInfo->GetPort()); @@ -1139,35 +1093,6 @@ retryDueToTLSIntolerance(PRErrorCode err, nsNSSSocketInfo* socketInfo) return false; } - uint32_t reason = tlsIntoleranceTelemetryBucket(err); - if (reason == 0) { - return false; - } - - Telemetry::ID pre; - Telemetry::ID post; - switch (range.max) { - case SSL_LIBRARY_VERSION_TLS_1_3: - pre = Telemetry::SSL_TLS13_INTOLERANCE_REASON_PRE; - post = Telemetry::SSL_TLS13_INTOLERANCE_REASON_POST; - break; - case SSL_LIBRARY_VERSION_TLS_1_2: - pre = Telemetry::SSL_TLS12_INTOLERANCE_REASON_PRE; - post = Telemetry::SSL_TLS12_INTOLERANCE_REASON_POST; - break; - case SSL_LIBRARY_VERSION_TLS_1_1: - pre = Telemetry::SSL_TLS11_INTOLERANCE_REASON_PRE; - post = Telemetry::SSL_TLS11_INTOLERANCE_REASON_POST; - break; - case SSL_LIBRARY_VERSION_TLS_1_0: - pre = Telemetry::SSL_TLS10_INTOLERANCE_REASON_PRE; - post = Telemetry::SSL_TLS10_INTOLERANCE_REASON_POST; - break; - default: - MOZ_CRASH("impossible TLS version"); - return false; - } - if (!helpers.rememberIntolerantAtVersion(socketInfo->GetHostName(), socketInfo->GetPort(), range.min, range.max, err)) { @@ -1187,34 +1112,6 @@ static_assert((PR_MAX_ERROR - PR_NSPR_ERROR_BASE) <= 128, static_assert((mozilla::pkix::ERROR_BASE - mozilla::pkix::END_OF_LIST) < 31, "too many moz::pkix errors"); -static void -reportHandshakeResult(int32_t bytesTransferred, bool wasReading, PRErrorCode err) -{ - uint32_t bucket; - - // A negative bytesTransferred or a 0 read are errors. - if (bytesTransferred > 0) { - bucket = 0; - } else if ((bytesTransferred == 0) && !wasReading) { - // PR_Write() is defined to never return 0, but let's make sure. - // https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_Write. - MOZ_ASSERT(false); - bucket = 671; - } else if (IS_SSL_ERROR(err)) { - bucket = err - SSL_ERROR_BASE; - MOZ_ASSERT(bucket > 0); // SSL_ERROR_EXPORT_ONLY_SERVER isn't used. - } else if (IS_SEC_ERROR(err)) { - bucket = (err - SEC_ERROR_BASE) + 256; - } else if ((err >= PR_NSPR_ERROR_BASE) && (err < PR_MAX_ERROR)) { - bucket = (err - PR_NSPR_ERROR_BASE) + 512; - } else if ((err >= mozilla::pkix::ERROR_BASE) && - (err < mozilla::pkix::ERROR_LIMIT)) { - bucket = (err - mozilla::pkix::ERROR_BASE) + 640; - } else { - bucket = 671; - } -} - int32_t checkHandshake(int32_t bytesTransfered, bool wasReading, PRFileDesc* ssl_layer_fd, nsNSSSocketInfo* socketInfo) @@ -1292,10 +1189,6 @@ checkHandshake(int32_t bytesTransfered, bool wasReading, // set the HandshakePending attribute to false so that we don't try the logic // above again in a subsequent transfer. if (handleHandshakeResultNow) { - // Report the result once for each handshake. Note that this does not - // get handshakes which are cancelled before any reads or writes - // happen. - reportHandshakeResult(bytesTransfered, wasReading, originalError); socketInfo->SetHandshakeNotPending(); } diff --git a/toolkit/components/alerts/nsXULAlerts.cpp b/toolkit/components/alerts/nsXULAlerts.cpp index 882617637..d353d8714 100644 --- a/toolkit/components/alerts/nsXULAlerts.cpp +++ b/toolkit/components/alerts/nsXULAlerts.cpp @@ -18,7 +18,6 @@ #include "nsIWindowWatcher.h" using namespace mozilla; -using mozilla::dom::NotificationTelemetryService; #define ALERT_CHROME_URL "chrome://global/content/alerts/alert.xul" @@ -185,20 +184,6 @@ nsXULAlerts::ShowAlertWithIconURI(nsIAlertNotification* aAlert, NS_ENSURE_SUCCESS(rv, rv); if (mDoNotDisturb) { - if (!inPrivateBrowsing) { - RefPtr<NotificationTelemetryService> telemetry = - NotificationTelemetryService::GetInstance(); - if (telemetry) { - // Record the number of unique senders for XUL alerts. The OS X and - // libnotify backends will fire `alertshow` even if "do not disturb" - // is enabled. In that case, `NotificationObserver` will record the - // sender. - nsCOMPtr<nsIPrincipal> principal; - if (NS_SUCCEEDED(aAlert->GetPrincipal(getter_AddRefs(principal)))) { - Unused << NS_WARN_IF(NS_FAILED(telemetry->RecordSender(principal))); - } - } - } if (aAlertListener) aAlertListener->Observe(nullptr, "alertfinished", cookie.get()); return NS_OK; diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index a369ca884..9fdc8a103 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -117,14 +117,6 @@ private: friend class PendingDBLookup; - // Telemetry states. - // Status of the remote response (valid or not). - enum SERVER_RESPONSE_TYPES { - SERVER_RESPONSE_VALID = 0, - SERVER_RESPONSE_FAILED = 1, - SERVER_RESPONSE_INVALID = 2, - }; - // Number of blocklist and allowlist hits we have seen. uint32_t mBlocklistCount; uint32_t mAllowlistCount; diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp index 33aeaf7c2..6c470356a 100644 --- a/toolkit/components/perfmonitoring/nsPerformanceStats.cpp +++ b/toolkit/components/perfmonitoring/nsPerformanceStats.cpp @@ -662,9 +662,6 @@ nsPerformanceStatsService::nsPerformanceStatsService() nsPerformanceGroup::GroupScope::RUNTIME // scope )) , mIsHandlingUserInput(false) - , mProcessStayed(0) - , mProcessMoved(0) - , mProcessUpdateCounter(0) , mIsMonitoringPerCompartment(false) , mJankAlertThreshold(mozilla::MaxValue<uint64_t>::value) // By default, no alerts , mJankAlertBufferingDelay(1000 /* ms */) @@ -953,13 +950,6 @@ nsPerformanceStatsService::SetJankAlertBufferingDelay(uint32_t value) { return NS_OK; } -nsresult -nsPerformanceStatsService::UpdateTelemetry() -{ - /* STUB */ - return NS_OK; -} - /* static */ nsIPerformanceStats* nsPerformanceStatsService::GetStatsForGroup(const js::PerformanceGroup* group) @@ -992,12 +982,6 @@ nsPerformanceStatsService::GetSnapshot(JSContext* cx, nsIPerformanceSnapshot * * } } - js::GetPerfMonitoringTestCpuRescheduling(cx, &mProcessStayed, &mProcessMoved); - - if (++mProcessUpdateCounter % 10 == 0) { - mozilla::Unused << UpdateTelemetry(); - } - snapshot.forget(aSnapshot); return NS_OK; diff --git a/toolkit/components/perfmonitoring/nsPerformanceStats.h b/toolkit/components/perfmonitoring/nsPerformanceStats.h index c82a3e92c..6902c840d 100644 --- a/toolkit/components/perfmonitoring/nsPerformanceStats.h +++ b/toolkit/components/perfmonitoring/nsPerformanceStats.h @@ -363,21 +363,6 @@ protected: nsPerformanceGroup* group); - - - /********************************************************** - * - * To check whether our algorithm makes sense, we keep count of the - * number of times the process has been rescheduled to another CPU - * while we were monitoring the performance of a group and we upload - * this data through Telemetry. - */ - nsresult UpdateTelemetry(); - - uint64_t mProcessStayed; - uint64_t mProcessMoved; - uint32_t mProcessUpdateCounter; - /********************************************************** * * Options controlling measurements. diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index a87c14b37..08c382377 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -597,7 +597,7 @@ Database::BackupAndReplaceDatabaseFile(nsCOMPtr<mozIStorageService>& aStorage) // If anything fails from this point on, we have a stale connection or // database file, and there's not much more we can do. // The only thing we can try to do is to replace the database on the next - // startup, and report the problem through telemetry. + // startup. { enum eCorruptDBReplaceStage : int8_t { stage_closing = 0, diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index dda162197..13e040bfd 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -382,12 +382,5 @@ AsyncStatementCallbackNotifier::HandleCompletion(uint16_t aReason) //////////////////////////////////////////////////////////////////////////////// //// AsyncStatementCallbackNotifier -NS_IMETHODIMP -AsyncStatementTelemetryTimer::HandleCompletion(uint16_t aReason) -{ - /* STUB */ - return NS_OK; -} - } // namespace places } // namespace mozilla diff --git a/toolkit/components/places/Helpers.h b/toolkit/components/places/Helpers.h index 654e42539..4e79abc75 100644 --- a/toolkit/components/places/Helpers.h +++ b/toolkit/components/places/Helpers.h @@ -15,7 +15,6 @@ #include "nsThreadUtils.h" #include "nsProxyRelease.h" #include "prtime.h" -#include "mozilla/Telemetry.h" namespace mozilla { namespace places { @@ -270,26 +269,6 @@ private: const char* mTopic; }; -/** - * Used to notify a topic to system observers on async execute completion. - */ -class AsyncStatementTelemetryTimer : public AsyncStatementCallback -{ -public: - explicit AsyncStatementTelemetryTimer(Telemetry::ID aHistogramId, - TimeStamp aStart = TimeStamp::Now()) - : mHistogramId(aHistogramId) - , mStart(aStart) - { - } - - NS_IMETHOD HandleCompletion(uint16_t aReason); - -private: - const Telemetry::ID mHistogramId; - const TimeStamp mStart; -}; - } // namespace places } // namespace mozilla diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 49d911d65..e72526022 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -3063,17 +3063,15 @@ nsNavHistory::Observe(nsISupports *aSubject, const char *aTopic, namespace { -class DecayFrecencyCallback : public AsyncStatementTelemetryTimer +class DecayFrecencyCallback : public AsyncStatementCallback { public: DecayFrecencyCallback() - : AsyncStatementTelemetryTimer(Telemetry::PLACES_IDLE_FRECENCY_DECAY_TIME_MS) { } NS_IMETHOD HandleCompletion(uint16_t aReason) { - (void)AsyncStatementTelemetryTimer::HandleCompletion(aReason); if (aReason == REASON_FINISHED) { nsNavHistory *navHistory = nsNavHistory::GetHistoryService(); NS_ENSURE_STATE(navHistory); diff --git a/toolkit/components/telemetry/TelemetryHistogram.cpp b/toolkit/components/telemetry/TelemetryHistogram.cpp index ba0288979..c97367a36 100644 --- a/toolkit/components/telemetry/TelemetryHistogram.cpp +++ b/toolkit/components/telemetry/TelemetryHistogram.cpp @@ -2689,37 +2689,5 @@ TelemetryHistogram::IPCTimerFired(nsITimer* aTimer, void* aClosure) } } - switch (XRE_GetProcessType()) { - case GeckoProcessType_Content: { - mozilla::dom::ContentChild* contentChild = mozilla::dom::ContentChild::GetSingleton(); - mozilla::Unused << NS_WARN_IF(!contentChild); - if (contentChild) { - if (accumulationsToSend.Length()) { - mozilla::Unused << - NS_WARN_IF(!contentChild->SendAccumulateChildHistogram(accumulationsToSend)); - } - if (keyedAccumulationsToSend.Length()) { - mozilla::Unused << - NS_WARN_IF(!contentChild->SendAccumulateChildKeyedHistogram(keyedAccumulationsToSend)); - } - } - break; - } - case GeckoProcessType_GPU: { - if (mozilla::gfx::GPUParent* gpu = mozilla::gfx::GPUParent::GetSingleton()) { - if (accumulationsToSend.Length()) { - mozilla::Unused << gpu->SendAccumulateChildHistogram(accumulationsToSend); - } - if (keyedAccumulationsToSend.Length()) { - mozilla::Unused << gpu->SendAccumulateChildKeyedHistogram(keyedAccumulationsToSend); - } - } - break; - } - default: - MOZ_ASSERT_UNREACHABLE("Unsupported process type"); - break; - } - gIPCTimerArmed = false; } diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp index e230f6951..9319822d5 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -20,7 +20,6 @@ #include "mozilla/Logging.h" #include "nsIInterfaceRequestor.h" #include "mozilla/LoadContext.h" -#include "mozilla/Telemetry.h" #include "nsContentUtils.h" #include "nsIURLFormatter.h" @@ -503,115 +502,6 @@ nsUrlClassifierStreamUpdater::AddRequestBody(const nsACString &aRequestBody) return NS_OK; } -// Map the HTTP response code to a Telemetry bucket -static uint32_t HTTPStatusToBucket(uint32_t status) -{ - uint32_t statusBucket; - switch (status) { - case 100: - case 101: - // Unexpected 1xx return code - statusBucket = 0; - break; - case 200: - // OK - Data is available in the HTTP response body. - statusBucket = 1; - break; - case 201: - case 202: - case 203: - case 205: - case 206: - // Unexpected 2xx return code - statusBucket = 2; - break; - case 204: - // No Content - statusBucket = 3; - break; - case 300: - case 301: - case 302: - case 303: - case 304: - case 305: - case 307: - case 308: - // Unexpected 3xx return code - statusBucket = 4; - break; - case 400: - // Bad Request - The HTTP request was not correctly formed. - // The client did not provide all required CGI parameters. - statusBucket = 5; - break; - case 401: - case 402: - case 405: - case 406: - case 407: - case 409: - case 410: - case 411: - case 412: - case 414: - case 415: - case 416: - case 417: - case 421: - case 426: - case 428: - case 429: - case 431: - case 451: - // Unexpected 4xx return code - statusBucket = 6; - break; - case 403: - // Forbidden - The client id is invalid. - statusBucket = 7; - break; - case 404: - // Not Found - statusBucket = 8; - break; - case 408: - // Request Timeout - statusBucket = 9; - break; - case 413: - // Request Entity Too Large - Bug 1150334 - statusBucket = 10; - break; - case 500: - case 501: - case 510: - // Unexpected 5xx return code - statusBucket = 11; - break; - case 502: - case 504: - case 511: - // Local network errors, we'll ignore these. - statusBucket = 12; - break; - case 503: - // Service Unavailable - The server cannot handle the request. - // Clients MUST follow the backoff behavior specified in the - // Request Frequency section. - statusBucket = 13; - break; - case 505: - // HTTP Version Not Supported - The server CANNOT handle the requested - // protocol major version. - statusBucket = 14; - break; - default: - statusBucket = 15; - }; - return statusBucket; -} - /////////////////////////////////////////////////////////////////////////////// // nsIStreamListenerObserver implementation diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 7109d85bd..d6dc26954 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -185,7 +185,6 @@ #include "mozilla/AutoGlobalTimelineMarker.h" #include "mozilla/Likely.h" #include "mozilla/PoisonIOInterposer.h" -#include "mozilla/Telemetry.h" #include "mozilla/ThreadLocal.h" using namespace mozilla; @@ -3488,7 +3487,6 @@ nsCycleCollector::FixGrayBits(bool aForceGC, TimeLog& aTimeLog) aTimeLog.Checkpoint("FixWeakMappingGrayBits"); bool needGC = !mJSContext->AreGCGrayBitsValid(); - // Only do a telemetry ping for non-shutdown CCs. if (!needGC) { return; } @@ -3540,8 +3538,6 @@ nsCycleCollector::CleanupAfterCollection() printf(".\ncc: \n"); #endif - timeLog.Checkpoint("CleanupAfterCollection::telemetry"); - if (mJSContext) { mJSContext->FinalizeDeferredThings(mResults.mAnyManual ? CycleCollectedJSContext::FinalizeNow |