Bug 1573238 - Provide a minimal BrowserUsageTelemetry.jsm module in GeckoView that implements nsIBrowserUsage; r=snorp
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 10 Sep 2019 20:52:47 +0000
changeset 492584 5a2bf4210a6e48fe8e81f51134cf0333f071dfef
parent 492583 46f7b0bdf2a3bd008074d1fb134e47ee932ebba8
child 492585 8b41b3986d2c051a15dc08b19e7c20ee9ea8d2d5
push id95002
push usereakhgari@mozilla.com
push dateTue, 10 Sep 2019 20:53:16 +0000
treeherderautoland@5a2bf4210a6e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1573238
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1573238 - Provide a minimal BrowserUsageTelemetry.jsm module in GeckoView that implements nsIBrowserUsage; r=snorp Differential Revision: https://phabricator.services.mozilla.com/D45428
mobile/android/modules/geckoview/BrowserUsageTelemetry.jsm
mobile/android/modules/geckoview/moz.build
new file mode 100644
--- /dev/null
+++ b/mobile/android/modules/geckoview/BrowserUsageTelemetry.jsm
@@ -0,0 +1,25 @@
+/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */
+/* 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/. */
+
+"use strict";
+
+var EXPORTED_SYMBOLS = ["getUniqueDomainsVisitedInPast24Hours"];
+
+// Used by nsIBrowserUsage
+function getUniqueDomainsVisitedInPast24Hours() {
+  // The prompting heuristic for the storage access API looks at 1% of the
+  // number of the domains visited in the past 24 hours, with a minimum cap of
+  // 5 domains, in order to prevent prompts from showing up before a tracker is
+  // about to obtain tracking power over a significant portion of the user's
+  // cross-site browsing activity (that is, we do not want to allow automatic
+  // access grants over 1% of the domains). We have the
+  // dom.storage_access.max_concurrent_auto_grants which establishes the
+  // minimum cap here (set to 5 by default) so if we return 0 here the minimum
+  // cap would always take effect. That would only become inaccurate if the
+  // user has browsed more than 500 top-level eTLD's in the past 24 hours,
+  // which should be a very unlikely scenario on mobile anyway.
+
+  return 0;
+}
--- a/mobile/android/modules/geckoview/moz.build
+++ b/mobile/android/modules/geckoview/moz.build
@@ -1,16 +1,17 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 EXTRA_JS_MODULES += [
     'AndroidLog.jsm',
+    'BrowserUsageTelemetry.jsm',
     'ContentCrashHandler.jsm',
     'DelayedInit.jsm',
     'GeckoViewAccessibility.jsm',
     'GeckoViewAutoFill.jsm',
     'GeckoViewChildModule.jsm',
     'GeckoViewConsole.jsm',
     'GeckoViewContent.jsm',
     'GeckoViewContentBlockingController.jsm',