Browse Source

Telemetry: Remove stubs and related code

pull/1/head
adeshkp 4 years ago committed by Roy Tam
parent
commit
aea50f182f
  1. 39
      accessible/base/Statistics.h
  2. 3
      accessible/base/nsAccessibilityService.cpp
  3. 2
      accessible/windows/ia2/ia2AccessibleTable.cpp
  4. 12
      accessible/windows/msaa/Compatibility.cpp
  5. 2
      accessible/windows/msaa/DocAccessibleWrap.cpp
  6. 2
      accessible/windows/msaa/TextLeafAccessibleWrap.cpp
  7. 23
      devtools/shared/heapsnapshot/HeapSnapshot.cpp
  8. 17
      devtools/shared/heapsnapshot/HeapSnapshot.h
  9. 22
      docshell/base/nsDocShell.cpp
  10. 2
      dom/base/nsDOMWindowUtils.cpp
  11. 74
      dom/base/nsDocument.cpp
  12. 10
      dom/base/nsDocument.h
  13. 6
      dom/base/nsFrameMessageManager.cpp
  14. 11
      dom/base/nsGlobalWindow.cpp
  15. 5
      dom/base/nsGlobalWindow.h
  16. 1
      dom/base/nsObjectLoadingContent.cpp
  17. 31
      dom/geolocation/nsGeolocation.cpp
  18. 6
      dom/geolocation/nsGeolocation.h
  19. 3
      dom/html/HTMLFormElement.cpp
  20. 2
      dom/html/HTMLImageElement.cpp
  21. 227
      dom/html/HTMLMediaElement.cpp
  22. 81
      dom/html/HTMLMediaElement.h
  23. 16
      dom/html/TextTrackManager.cpp
  24. 7
      dom/html/TextTrackManager.h
  25. 143
      dom/indexedDB/ActorsParent.cpp
  26. 3
      dom/indexedDB/FileManager.h
  27. 28
      dom/ipc/ContentParent.cpp
  28. 7
      dom/ipc/ContentParent.h
  29. 10
      dom/ipc/PContent.ipdl
  30. 21
      dom/media/DecoderTraits.cpp
  31. 1
      dom/media/GraphDriver.cpp
  32. 37
      dom/media/MediaDecoder.cpp
  33. 4
      dom/media/MediaDecoder.h
  34. 20
      dom/media/MediaDecoderStateMachine.cpp
  35. 16
      dom/media/MediaManager.cpp
  36. 40
      dom/media/fmp4/MP4Demuxer.cpp
  37. 45
      dom/media/platforms/wmf/WMFMediaDataDecoder.cpp
  38. 4
      dom/media/platforms/wmf/WMFMediaDataDecoder.h
  39. 169
      dom/notification/Notification.cpp
  40. 34
      dom/notification/Notification.h
  41. 36
      dom/plugins/ipc/PluginModuleParent.cpp
  42. 3
      dom/plugins/ipc/PluginModuleParent.h
  43. 15
      dom/security/nsMixedContentBlocker.cpp
  44. 3
      dom/security/nsMixedContentBlocker.h
  45. 57
      dom/storage/DOMStorageCache.cpp
  46. 6
      dom/storage/DOMStorageCache.h
  47. 1
      dom/workers/RuntimeService.cpp
  48. 17
      extensions/cookie/nsPermissionManager.cpp
  49. 14
      gfx/ipc/GPUChild.cpp
  50. 2
      gfx/ipc/GPUChild.h
  51. 6
      gfx/ipc/PGPU.ipdl
  52. 23
      gfx/layers/apz/src/AsyncPanZoomController.cpp
  53. 18
      gfx/layers/apz/src/PotentialCheckerboardDurationTracker.cpp
  54. 2
      gfx/layers/apz/src/PotentialCheckerboardDurationTracker.h
  55. 2
      gfx/layers/client/ClientLayerManager.cpp
  56. 2
      gfx/layers/ipc/CompositorBridgeParent.cpp
  57. 13
      gfx/src/DriverCrashGuard.cpp
  58. 12
      gfx/src/DriverCrashGuard.h
  59. 2
      gfx/thebes/DeviceManagerDx.cpp
  60. 3
      gfx/thebes/gfxFont.cpp
  61. 27
      gfx/thebes/gfxPlatform.cpp
  62. 10
      gfx/thebes/gfxPlatformFontList.cpp
  63. 16
      gfx/thebes/gfxWindowsPlatform.cpp
  64. 2
      gfx/thebes/gfxWindowsPlatform.h
  65. 2
      image/Image.h
  66. 9
      image/VectorImage.cpp
  67. 2
      image/VectorImage.h
  68. 6
      ipc/glue/MessageChannel.cpp
  69. 4
      js/src/jsapi.h
  70. 11
      js/src/jsfriendapi.cpp
  71. 3
      js/src/jsfriendapi.h
  72. 7
      js/src/vm/Stopwatch.cpp
  73. 21
      js/xpconnect/src/XPCJSContext.cpp
  74. 3
      js/xpconnect/src/xpcprivate.h
  75. 99
      layout/base/nsDisplayList.cpp
  76. 39
      layout/base/nsDisplayList.h
  77. 3
      layout/base/nsLayoutUtils.cpp
  78. 4
      layout/base/nsPresShell.cpp
  79. 38
      layout/base/nsRefreshDriver.cpp
  80. 3
      layout/build/nsLayoutCID.h
  81. 6
      layout/build/nsLayoutModule.cpp
  82. 3
      layout/style/ImageLoader.cpp
  83. 22
      media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
  84. 5
      media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
  85. 13
      netwerk/base/BackgroundFileSaver.cpp
  86. 9
      netwerk/base/BackgroundFileSaver.h
  87. 14
      netwerk/base/nsIOService.cpp
  88. 13
      netwerk/base/nsIOService.h
  89. 94
      netwerk/base/nsLoadGroup.cpp
  90. 11
      netwerk/base/nsLoadGroup.h
  91. 90
      netwerk/base/nsSocketTransport2.cpp
  92. 9
      netwerk/base/nsSocketTransport2.h
  93. 68
      netwerk/base/nsSocketTransportService2.cpp
  94. 17
      netwerk/base/nsSocketTransportService2.h
  95. 11
      netwerk/base/nsUDPSocket.cpp
  96. 2
      netwerk/base/nsUDPSocket.h
  97. 98
      netwerk/cache2/CacheStorageService.cpp
  98. 12
      netwerk/cache2/CacheStorageService.h
  99. 20
      netwerk/cookie/nsCookieService.cpp
  100. 1
      netwerk/cookie/nsCookieService.h
  101. Some files were not shown because too many files have changed in this diff Show More

39
accessible/base/Statistics.h

@ -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

3
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;
}

2
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;

12
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,

2
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;

2
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;

23
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()

17
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();

22
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");

2
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;
}

74
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)
{

10
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;

6
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");

11
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

5
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;

1
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;
}

31
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);

6
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;

3
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;
}

2
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

227
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);
}
@ -3648,191 +3639,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 +5118,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 +5243,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 +5294,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 +6069,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;
}

81
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);
@ -1688,65 +1665,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;

16
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

7
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

143
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);
}