diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 2484920f452f..3e0f97cfbefc 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -25,7 +25,6 @@ #include "mozilla/dom/MessageManagerBinding.h" #include "mozilla/dom/MouseEventBinding.h" #include "mozilla/dom/PaymentRequestChild.h" -#include "mozilla/dom/TelemetryScrollProbe.h" #include "mozilla/IMEStateManager.h" #include "mozilla/ipc/URIUtils.h" #include "mozilla/layers/APZChild.h" @@ -2751,8 +2750,6 @@ TabChild::InitTabChildGlobal() return false; } - scope->Init(); - nsCOMPtr root = do_QueryInterface(chromeHandler); if (NS_WARN_IF(!root)) { mTabChildGlobal = nullptr; @@ -3505,12 +3502,6 @@ TabChildGlobal::~TabChildGlobal() { } -void -TabChildGlobal::Init() -{ - TelemetryScrollProbe::Create(this); -} - NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildGlobal) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TabChildGlobal, diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 3b4612e521b7..433e7111de10 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -87,7 +87,7 @@ class TabChildGlobal : public ContentFrameMessageManager, { public: explicit TabChildGlobal(TabChild* aTabChild); - void Init(); + NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, DOMEventTargetHelper) diff --git a/dom/ipc/TelemetryScrollProbe.cpp b/dom/ipc/TelemetryScrollProbe.cpp deleted file mode 100644 index aeb6afbd9f39..000000000000 --- a/dom/ipc/TelemetryScrollProbe.cpp +++ /dev/null @@ -1,89 +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 "TelemetryScrollProbe.h" - -#include "nsIURI.h" // for nsIURI -#include "TabChild.h" // for TabChildGlobal, TabChildBase -#include "mozilla/Telemetry.h" // for mozilla::Telemetry -#include "mozilla/dom/Event.h" // for Event - -namespace mozilla { -namespace dom { - -/* static */ void -TelemetryScrollProbe::Create(TabChildGlobal* aWebFrame) -{ - nsWeakPtr webNav = do_GetWeakReference(aWebFrame->mTabChild->WebNavigation()); - RefPtr probe = new TelemetryScrollProbe(webNav); - - aWebFrame->AddEventListener(NS_LITERAL_STRING("pagehide"), probe, true); -} - -already_AddRefed -TelemetryScrollProbe::GetWebNavigation() const -{ - nsCOMPtr webNav = do_QueryReferent(mWebNav); - return webNav.forget(); -} - -already_AddRefed -TelemetryScrollProbe::GetDocument() const -{ - nsCOMPtr result; - if (nsCOMPtr webNav = GetWebNavigation()) { - webNav->GetDocument(getter_AddRefs(result)); - } - return result.forget(); -} - -already_AddRefed -TelemetryScrollProbe::GetPresShell() const -{ - nsCOMPtr result; - if (nsCOMPtr doc = GetDocument()) { - result = doc->GetShell(); - } - return result.forget(); -} - -bool -TelemetryScrollProbe::ShouldIgnore(Event* aEvent) const -{ - RefPtr document = GetDocument(); - - return !document || - aEvent->GetTarget() != document || - nsContentUtils::IsSystemPrincipal(document->NodePrincipal()); -} - -NS_IMPL_ISUPPORTS(TelemetryScrollProbe, nsIDOMEventListener) - -NS_IMETHODIMP -TelemetryScrollProbe::HandleEvent(Event* aEvent) -{ - RefPtr presShell = GetPresShell(); - - if (!presShell || ShouldIgnore(aEvent)) { - return NS_OK; - } - - RefPtr presContext = presShell->GetPresContext(); - - nscoord maxAppUnits = presContext->TelemetryScrollMaxY(); - nscoord totalAppUnits = presContext->TelemetryScrollTotalY(); - - float maxCSSPixels = nsPresContext::AppUnitsToFloatCSSPixels(maxAppUnits); - float totalCSSPixels = nsPresContext::AppUnitsToFloatCSSPixels(totalAppUnits); - - mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOTAL_SCROLL_Y, totalCSSPixels); - mozilla::Telemetry::Accumulate(mozilla::Telemetry::PAGE_MAX_SCROLL_Y, maxCSSPixels); - - return NS_OK; -} - -} // namespace dom -} // namespace mozilla diff --git a/dom/ipc/TelemetryScrollProbe.h b/dom/ipc/TelemetryScrollProbe.h deleted file mode 100644 index bff52a124052..000000000000 --- a/dom/ipc/TelemetryScrollProbe.h +++ /dev/null @@ -1,54 +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 mozilla_dom_TelemetryScrollProbe_h -#define mozilla_dom_TelemetryScrollProbe_h - -#include "nsIDOMEventListener.h" - -class nsIDocument; -class nsIPresShell; -class nsIWebNavigation; - -namespace mozilla { -namespace dom { - -class Event; -class TabChildGlobal; - -/* - * A class for implementing a telemetry scroll probe, listens to - * pagehide events in a frame script context and records the - * max scroll y, and amount of vertical scrolling that ocurred. - * for more information see bug 1340904 - */ -class TelemetryScrollProbe final : public nsIDOMEventListener -{ -public: - static void Create(TabChildGlobal* aWebFrame); - - NS_DECL_ISUPPORTS - NS_DECL_NSIDOMEVENTLISTENER - -private: - explicit TelemetryScrollProbe(nsWeakPtr aWebNav) - : mWebNav(aWebNav) - { } - ~TelemetryScrollProbe() {} - - already_AddRefed GetWebNavigation() const; - already_AddRefed GetDocument() const; - already_AddRefed GetPresShell() const; - - bool ShouldIgnore(Event* aEvent) const; - - nsWeakPtr mWebNav; -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_TelemetryScrollProbe_h diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index fcbe06e7630e..13289b363643 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -39,7 +39,6 @@ EXPORTS.mozilla.dom += [ 'TabContext.h', 'TabMessageUtils.h', 'TabParent.h', - 'TelemetryScrollProbe.h', 'URLClassifierChild.h', 'URLClassifierParent.h', ] @@ -73,7 +72,6 @@ UNIFIED_SOURCES += [ 'TabContext.cpp', 'TabMessageUtils.cpp', 'TabParent.cpp', - 'TelemetryScrollProbe.cpp', 'URLClassifierParent.cpp', ] diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 305ae885a640..d56528907bf6 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -220,9 +220,6 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType) mFramesConstructed(0), mFramesReflowed(0), mInteractionTimeEnabled(true), - mTelemetryScrollLastY(0), - mTelemetryScrollMaxY(0), - mTelemetryScrollTotalY(0), mHasPendingInterrupt(false), mPendingInterruptFromTest(false), mInterruptsEnabled(false), diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 4e8e5c902ebf..345dca0e35bf 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -936,29 +936,6 @@ public: return mFramesReflowed; } - /* - * Helper functions for a telemetry scroll probe - * for more information see bug 1340904 - */ - void SetTelemetryScrollY(nscoord aScrollY) - { - nscoord delta = abs(aScrollY - mTelemetryScrollLastY); - mTelemetryScrollLastY = aScrollY; - - mTelemetryScrollTotalY += delta; - if (aScrollY > mTelemetryScrollMaxY) { - mTelemetryScrollMaxY = aScrollY; - } - } - nscoord TelemetryScrollMaxY() const - { - return mTelemetryScrollMaxY; - } - nscoord TelemetryScrollTotalY() const - { - return mTelemetryScrollTotalY; - } - static nscoord GetBorderWidthForKeyword(unsigned int aBorderWidthKeyword) { // This table maps border-width enums 'thin', 'medium', 'thick' @@ -1426,10 +1403,6 @@ protected: // last time we did a full style flush mozilla::TimeStamp mLastStyleUpdateForAllAnimations; - nscoord mTelemetryScrollLastY; - nscoord mTelemetryScrollMaxY; - nscoord mTelemetryScrollTotalY; - unsigned mHasPendingInterrupt : 1; unsigned mPendingInterruptFromTest : 1; unsigned mInterruptsEnabled : 1; diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 9fad047689ef..433ebca1643d 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4988,7 +4988,6 @@ ScrollFrameHelper::FireScrollEvent() if (mIsRoot) { nsIDocument* doc = content->GetUncomposedDoc(); if (doc) { - prescontext->SetTelemetryScrollY(GetScrollPosition().y); EventDispatcher::Dispatch(doc, prescontext, &event, nullptr, &status); } } else { diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index bcfb60d70b2b..d6cb26708534 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -12205,24 +12205,6 @@ "releaseChannelCollection": "opt-out", "description": "Graphics Crash Reason (...)" }, - "TOTAL_SCROLL_Y": { - "record_in_processes": ["main", "content"], - "alert_emails": ["hkirschner@mozilla.com"], - "bug_numbers": [1297867], - "expires_in_version": "58", - "kind": "count", - "description": "Count of the total number of CSS pixels scrolled up or down in the vertical axis of the root frame of all the pages visited in a subsession. This doesn't include any scrolling of nested scroll frames such as inputs, iframes, or scrollable divs." - }, - "PAGE_MAX_SCROLL_Y": { - "record_in_processes": ["main", "content"], - "alert_emails": ["hkirschner@mozilla.com"], - "bug_numbers": [1312881], - "expires_in_version": "58", - "kind": "exponential", - "high": 100000, - "n_buckets": 50, - "description": "Maximum distance in CSS pixels a user scrolls down the vertical axis of the root frame of a page. This doesn't include any scrolling of nested scroll frames such as inputs, iframes, or scrollable divs." - }, "WEB_NOTIFICATION_CLICKED": { "record_in_processes": ["main", "content"], "releaseChannelCollection": "opt-out", diff --git a/toolkit/components/telemetry/histogram-whitelists.json b/toolkit/components/telemetry/histogram-whitelists.json index 760f334781f4..f9bd52e35e61 100644 --- a/toolkit/components/telemetry/histogram-whitelists.json +++ b/toolkit/components/telemetry/histogram-whitelists.json @@ -1644,7 +1644,6 @@ "TELEMETRY_TEST_RELEASE_OPTOUT", "TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED", "TOTAL_CONTAINERS_OPENED", - "TOTAL_SCROLL_Y", "TRANSLATED_PAGES", "TRANSLATED_PAGES_BY_LANGUAGE", "UNIQUE_CONTAINERS_OPENED",