summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaming4JC <g4jc@bulletmail.org>2018-08-15 17:59:12 -0400
committerGaming4JC <g4jc@bulletmail.org>2018-08-15 17:59:12 -0400
commit9acca3b80775d5f441359f3ccbcb19c360a0f7c8 (patch)
treedace16f89d79602cc0bdc56124edeb611cefbf83
parentc3d0b9d89caf27ff0011ecc40d810ea6d920e7d2 (diff)
downloadiceweasel-uxp-9acca3b80775d5f441359f3ccbcb19c360a0f7c8.tar.gz
Remove BrowserUsageTelemetry
-rwxr-xr-xbase/content/browser.js53
-rw-r--r--base/content/urlbarBindings.xml1
-rw-r--r--components/nsBrowserGlue.js4
-rw-r--r--components/search/content/search.xml98
-rw-r--r--modules/BrowserUsageTelemetry.jsm468
-rw-r--r--modules/ContentSearch.jsm2
-rw-r--r--modules/moz.build1
7 files changed, 6 insertions, 621 deletions
diff --git a/base/content/browser.js b/base/content/browser.js
index 6469ab0..035cf2c 100755
--- a/base/content/browser.js
+++ b/base/content/browser.js
@@ -16,7 +16,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["AboutHome", "resource:///modules/AboutHome.jsm"],
["AddonWatcher", "resource://gre/modules/AddonWatcher.jsm"],
["AppConstants", "resource://gre/modules/AppConstants.jsm"],
- ["BrowserUsageTelemetry", "resource:///modules/BrowserUsageTelemetry.jsm"],
["BrowserUtils", "resource://gre/modules/BrowserUtils.jsm"],
["CastingApps", "resource:///modules/CastingApps.jsm"],
["CharsetMenu", "resource://gre/modules/CharsetMenu.jsm"],
@@ -3652,9 +3651,6 @@ const BrowserSearch = {
*/
loadSearchFromContext: function (terms) {
let engine = BrowserSearch._loadSearch(terms, true, "contextmenu");
- if (engine) {
- BrowserSearch.recordSearchInTelemetry(engine, "contextmenu");
- }
},
pasteAndSearch: function (event) {
@@ -3678,55 +3674,6 @@ const BrowserSearch = {
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
var where = newWindowPref == 3 ? "tab" : "window";
openUILinkIn(this.searchEnginesURL, where);
- },
-
- /**
- * Helper to record a search with Telemetry.
- *
- * Telemetry records only search counts and nothing pertaining to the search itself.
- *
- * @param engine
- * (nsISearchEngine) The engine handling the search.
- * @param source
- * (string) Where the search originated from. See BrowserUsageTelemetry for
- * allowed values.
- * @param details [optional]
- * An optional parameter passed to |BrowserUsageTelemetry.recordSearch|.
- * See its documentation for allowed options.
- * Additionally, if the search was a suggested search, |details.selection|
- * indicates where the item was in the suggestion list and how the user
- * selected it: {selection: {index: The selected index, kind: "key" or "mouse"}}
- */
- recordSearchInTelemetry: function (engine, source, details={}) {
- try {
- BrowserUsageTelemetry.recordSearch(engine, source, details);
- } catch (ex) {
- Cu.reportError(ex);
- }
- },
-
- /**
- * Helper to record a one-off search with Telemetry.
- *
- * Telemetry records only search counts and nothing pertaining to the search itself.
- *
- * @param engine
- * (nsISearchEngine) The engine handling the search.
- * @param source
- * (string) Where the search originated from. See BrowserUsageTelemetry for
- * allowed values.
- * @param type
- * (string) Indicates how the user selected the search item.
- * @param where
- * (string) Where was the search link opened (e.g. new tab, current tab, ..).
- */
- recordOneoffSearchInTelemetry: function (engine, source, type, where) {
- try {
- const details = {type, isOneOff: true};
- BrowserUsageTelemetry.recordSearch(engine, source, details);
- } catch (ex) {
- Cu.reportError(ex);
- }
}
};
diff --git a/base/content/urlbarBindings.xml b/base/content/urlbarBindings.xml
index eb31505..79b09d3 100644
--- a/base/content/urlbarBindings.xml
+++ b/base/content/urlbarBindings.xml
@@ -626,7 +626,6 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
details.isOneOff = isOneOff;
details.type = eventType;
- BrowserSearch.recordSearchInTelemetry(engine, "urlbar", details);
let submission = engine.getSubmission(query, null, "keyword");
return [submission.uri.spec, submission.postData];
]]></body>
diff --git a/components/nsBrowserGlue.js b/components/nsBrowserGlue.js
index c9f2810..e3e9de7 100644
--- a/components/nsBrowserGlue.js
+++ b/components/nsBrowserGlue.js
@@ -27,7 +27,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
["AutoCompletePopup", "resource://gre/modules/AutoCompletePopup.jsm"],
["BookmarkHTMLUtils", "resource://gre/modules/BookmarkHTMLUtils.jsm"],
["BookmarkJSONUtils", "resource://gre/modules/BookmarkJSONUtils.jsm"],
- ["BrowserUsageTelemetry", "resource:///modules/BrowserUsageTelemetry.jsm"],
["ContentClick", "resource:///modules/ContentClick.jsm"],
["ContentPrefServiceParent", "resource://gre/modules/ContentPrefServiceParent.jsm"],
["ContentSearch", "resource:///modules/ContentSearch.jsm"],
@@ -311,7 +310,6 @@ BrowserGlue.prototype = {
Cu.reportError(ex);
}
let win = RecentWindow.getMostRecentBrowserWindow();
- win.BrowserSearch.recordSearchInTelemetry(engine, "urlbar");
break;
case "browser-search-engine-modified":
// Ensure we cleanup the hiddenOneOffs pref when removing
@@ -661,7 +659,6 @@ BrowserGlue.prototype = {
NewTabMessages.init();
SessionStore.init();
- BrowserUsageTelemetry.init();
ContentSearch.init();
FormValidationHandler.init();
@@ -1007,7 +1004,6 @@ BrowserGlue.prototype = {
delete this._bookmarksBackupIdleTime;
}
- BrowserUsageTelemetry.uninit();
UserAgentOverrides.uninit();
PageThumbs.uninit();
NewTabMessages.uninit();
diff --git a/components/search/content/search.xml b/components/search/content/search.xml
index 41a5256..11e8f73 100644
--- a/components/search/content/search.xml
+++ b/components/search/content/search.xml
@@ -372,13 +372,9 @@
var textBox = this._textbox;
var textValue = textBox.value;
- let selection = this.telemetrySearchDetails;
let oneOffRecorded = false;
- if (!selection || (selection.index == -1)) {
- oneOffRecorded = this.textbox.popup.oneOffButtons
- .maybeRecordTelemetry(aEvent, aWhere, aParams);
- if (!oneOffRecorded) {
+ if (!oneOffRecorded) {
let source = "unknown";
let type = "unknown";
let target = aEvent.originalTarget;
@@ -398,10 +394,7 @@
if (!aEngine) {
aEngine = this.currentEngine;
}
- BrowserSearch.recordOneoffSearchInTelemetry(aEngine, source, type,
- aWhere);
}
- }
// This is a one-off search only if oneOffRecorded is true.
this.doSearch(textValue, aWhere, aEngine, aParams, oneOffRecorded);
@@ -433,18 +426,11 @@
let engine = aEngine || this.currentEngine;
var submission = engine.getSubmission(aData, null, "searchbar");
- let telemetrySearchDetails = this.telemetrySearchDetails;
- this.telemetrySearchDetails = null;
- if (telemetrySearchDetails && telemetrySearchDetails.index == -1) {
- telemetrySearchDetails = null;
- }
// If we hit here, we come either from a one-off, a plain search or a suggestion.
const details = {
isOneOff: aOneOff,
- isSuggestion: (!aOneOff && telemetrySearchDetails),
- selection: telemetrySearchDetails
+ isSuggestion: (!aOneOff)
};
- BrowserSearch.recordSearchInTelemetry(engine, "searchbar", details);
// null parameter below specifies HTML response for search
let params = {
postData: submission.postData,
@@ -767,7 +753,6 @@
}
if (this._selectionDetails &&
this._selectionDetails.currentIndex != -1) {
- BrowserSearch.searchBar.telemetrySearchDetails = this._selectionDetails;
this._selectionDetails = null;
}
document.getBindingParent(this).handleSearchCommand(aEvent, engine);
@@ -984,9 +969,6 @@
);
this.style.minWidth = minWidth + "px";
- // Set the origin before assigning the popup, as the assignment does
- // a rebuild and would miss the origin.
- this.oneOffButtons.telemetryOrigin = "searchbar";
// Set popup after setting the minWidth since it builds the buttons.
this.oneOffButtons.popup = this;
this.oneOffButtons.textbox = this.input;
@@ -1181,10 +1163,6 @@
]]></setter>
</property>
- <!-- Set this to a string that identifies your one-offs consumer. It'll
- be appended to telemetry recorded with maybeRecordTelemetry(). -->
- <field name="telemetryOrigin">""</field>
-
<field name="_query">""</field>
<!-- The query string currently shown in the one-offs. If the textbox
@@ -1402,7 +1380,7 @@
let button = document.createElementNS(kXULNS, "button");
let label = this.bundle.formatStringFromName("cmd_addFoundEngine",
[engine.title], 1);
- button.id = this.telemetryOrigin + "-add-engine-" +
+ button.id = "-add-engine-" +
engine.title.replace(/ /g, '-');
button.setAttribute("class", "addengine-item");
button.setAttribute("label", label);
@@ -1470,9 +1448,9 @@
// Ensure we can refer to the settings buttons by ID:
let settingsEl = document.getAnonymousElementByAttribute(this, "anonid", "search-settings");
- settingsEl.id = this.telemetryOrigin + "-anon-search-settings";
+ settingsEl.id = "-anon-search-settings";
let compactSettingsEl = document.getAnonymousElementByAttribute(this, "anonid", "search-settings-compact");
- compactSettingsEl.id = this.telemetryOrigin +
+ compactSettingsEl.id =
"-anon-search-settings-compact";
let dummyItems = enginesPerRow - (oneOffCount % enginesPerRow || enginesPerRow);
@@ -1546,7 +1524,7 @@
<method name="_buttonIDForEngine">
<parameter name="engine"/>
<body><![CDATA[
- return this.telemetryOrigin + "-engine-one-off-item-" +
+ return "-engine-one-off-item-" +
engine.name.replace(/ /g, '-');
]]></body>
</method>
@@ -1882,70 +1860,6 @@
]]></body>
</method>
- <!--
- If the given event is related to the one-offs, this method records
- one-off telemetry for it. this.telemetryOrigin will be appended to the
- computed source, so make sure you set that first.
-
- @param aEvent
- An event, like a click on a one-off button.
- @param aOpenUILinkWhere
- The "where" passed to openUILink.
- @param aOpenUILinkParams
- The "params" passed to openUILink.
- @return True if telemetry was recorded and false if not.
- -->
- <method name="maybeRecordTelemetry">
- <parameter name="aEvent"/>
- <parameter name="aOpenUILinkWhere"/>
- <parameter name="aOpenUILinkParams"/>
- <body><![CDATA[
- if (!aEvent) {
- return false;
- }
-
- let source = null;
- let type = "unknown";
- let engine = null;
- let target = aEvent.originalTarget;
-
- if (aEvent instanceof KeyboardEvent) {
- type = "key";
- if (this.selectedButton) {
- source = "oneoff";
- engine = this.selectedButton.engine;
- }
- } else if (aEvent instanceof MouseEvent) {
- type = "mouse";
- if (target.classList.contains("searchbar-engine-one-off-item")) {
- source = "oneoff";
- engine = target.engine;
- }
- } else if ((aEvent instanceof XULCommandEvent) &&
- target.getAttribute("anonid") ==
- "search-one-offs-context-open-in-new-tab") {
- source = "oneoff-context";
- engine = this._contextEngine;
- }
-
- if (!source) {
- return false;
- }
-
- if (this.telemetryOrigin) {
- source += "-" + this.telemetryOrigin;
- }
-
- let tabBackground = aOpenUILinkWhere == "tab" &&
- aOpenUILinkParams &&
- aOpenUILinkParams.inBackground;
- let where = tabBackground ? "tab-background" : aOpenUILinkWhere;
- BrowserSearch.recordOneoffSearchInTelemetry(engine, source, type,
- where);
- return true;
- ]]></body>
- </method>
-
</implementation>
<handlers>
diff --git a/modules/BrowserUsageTelemetry.jsm b/modules/BrowserUsageTelemetry.jsm
deleted file mode 100644
index 39012d2..0000000
--- a/modules/BrowserUsageTelemetry.jsm
+++ /dev/null
@@ -1,468 +0,0 @@
-/* -*- 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";
-
-this.EXPORTED_SYMBOLS = ["BrowserUsageTelemetry"];
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
- "resource://gre/modules/PrivateBrowsingUtils.jsm");
-
-// The upper bound for the count of the visited unique domain names.
-const MAX_UNIQUE_VISITED_DOMAINS = 100;
-
-// Observed topic names.
-const WINDOWS_RESTORED_TOPIC = "sessionstore-windows-restored";
-const TAB_RESTORING_TOPIC = "SSTabRestoring";
-const TELEMETRY_SUBSESSIONSPLIT_TOPIC = "internal-telemetry-after-subsession-split";
-const DOMWINDOW_OPENED_TOPIC = "domwindowopened";
-
-// Probe names.
-const MAX_TAB_COUNT_SCALAR_NAME = "browser.engagement.max_concurrent_tab_count";
-const MAX_WINDOW_COUNT_SCALAR_NAME = "browser.engagement.max_concurrent_window_count";
-const TAB_OPEN_EVENT_COUNT_SCALAR_NAME = "browser.engagement.tab_open_event_count";
-const WINDOW_OPEN_EVENT_COUNT_SCALAR_NAME = "browser.engagement.window_open_event_count";
-const UNIQUE_DOMAINS_COUNT_SCALAR_NAME = "browser.engagement.unique_domains_count";
-const TOTAL_URI_COUNT_SCALAR_NAME = "browser.engagement.total_uri_count";
-const UNFILTERED_URI_COUNT_SCALAR_NAME = "browser.engagement.unfiltered_uri_count";
-
-// A list of known search origins.
-const KNOWN_SEARCH_SOURCES = [
- "abouthome",
- "contextmenu",
- "newtab",
- "searchbar",
- "urlbar",
-];
-
-const KNOWN_ONEOFF_SOURCES = [
- "oneoff-urlbar",
- "oneoff-searchbar",
- "unknown", // Edge case: this is the searchbar (see bug 1195733 comment 7).
-];
-
-function getOpenTabsAndWinsCounts() {
- let tabCount = 0;
- let winCount = 0;
-
- let browserEnum = Services.wm.getEnumerator("navigator:browser");
- while (browserEnum.hasMoreElements()) {
- let win = browserEnum.getNext();
- winCount++;
- tabCount += win.gBrowser.tabs.length;
- }
-
- return { tabCount, winCount };
-}
-
-function getSearchEngineId(engine) {
- if (engine) {
- if (engine.identifier) {
- return engine.identifier;
- }
- // Due to bug 1222070, we can't directly check Services.telemetry.canRecordExtended
- // here.
- const extendedTelemetry = Services.prefs.getBoolPref("toolkit.telemetry.enabled");
- if (engine.name && extendedTelemetry) {
- // If it's a custom search engine only report the engine name
- // if extended Telemetry is enabled.
- return "other-" + engine.name;
- }
- }
- return "other";
-}
-
-let URICountListener = {
- // A set containing the visited domains, see bug 1271310.
- _domainSet: new Set(),
- // A map to keep track of the URIs loaded from the restored tabs.
- _restoredURIsMap: new WeakMap(),
-
- isHttpURI(uri) {
- // Only consider http(s) schemas.
- return uri.schemeIs("http") || uri.schemeIs("https");
- },
-
- addRestoredURI(browser, uri) {
- if (!this.isHttpURI(uri)) {
- return;
- }
-
- this._restoredURIsMap.set(browser, uri.spec);
- },
-
- onLocationChange(browser, webProgress, request, uri, flags) {
- // Don't count this URI if it's an error page.
- if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
- return;
- }
-
- // We only care about top level loads.
- if (!webProgress.isTopLevel) {
- return;
- }
-
- // The SessionStore sets the URI of a tab first, firing onLocationChange the
- // first time, then manages content loading using its scheduler. Once content
- // loads, we will hit onLocationChange again.
- // We can catch the first case by checking for null requests: be advised that
- // this can also happen when navigating page fragments, so account for it.
- if (!request &&
- !(flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
- return;
- }
-
- // Track URI loads, even if they're not http(s).
- let uriSpec = null;
- try {
- uriSpec = uri.spec;
- } catch (e) {
- // If we have troubles parsing the spec, still count this as
- // an unfiltered URI.
- Services.telemetry.scalarAdd(UNFILTERED_URI_COUNT_SCALAR_NAME, 1);
- return;
- }
-
-
- // Don't count about:blank and similar pages, as they would artificially
- // inflate the counts.
- if (browser.ownerDocument.defaultView.gInitialPages.includes(uriSpec)) {
- return;
- }
-
- // If the URI we're loading is in the _restoredURIsMap, then it comes from a
- // restored tab. If so, let's skip it and remove it from the map as we want to
- // count page refreshes.
- if (this._restoredURIsMap.get(browser) === uriSpec) {
- this._restoredURIsMap.delete(browser);
- return;
- }
-
- // The URI wasn't from a restored tab. Count it among the unfiltered URIs.
- // If this is an http(s) URI, this also gets counted by the "total_uri_count"
- // probe.
- Services.telemetry.scalarAdd(UNFILTERED_URI_COUNT_SCALAR_NAME, 1);
-
- if (!this.isHttpURI(uri)) {
- return;
- }
-
- // Update the URI counts.
- Services.telemetry.scalarAdd(TOTAL_URI_COUNT_SCALAR_NAME, 1);
-
- // We only want to count the unique domains up to MAX_UNIQUE_VISITED_DOMAINS.
- if (this._domainSet.size == MAX_UNIQUE_VISITED_DOMAINS) {
- return;
- }
-
- // Unique domains should be aggregated by (eTLD + 1): x.test.com and y.test.com
- // are counted once as test.com.
- try {
- // Even if only considering http(s) URIs, |getBaseDomain| could still throw
- // due to the URI containing invalid characters or the domain actually being
- // an ipv4 or ipv6 address.
- this._domainSet.add(Services.eTLD.getBaseDomain(uri));
- } catch (e) {
- return;
- }
-
- Services.telemetry.scalarSet(UNIQUE_DOMAINS_COUNT_SCALAR_NAME, this._domainSet.size);
- },
-
- /**
- * Reset the counts. This should be called when breaking a session in Telemetry.
- */
- reset() {
- this._domainSet.clear();
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
- Ci.nsISupportsWeakReference]),
-};
-
-let BrowserUsageTelemetry = {
- init() {
- Services.obs.addObserver(this, WINDOWS_RESTORED_TOPIC, false);
- },
-
- /**
- * Handle subsession splits in the parent process.
- */
- afterSubsessionSplit() {
- // Scalars just got cleared due to a subsession split. We need to set the maximum
- // concurrent tab and window counts so that they reflect the correct value for the
- // new subsession.
- const counts = getOpenTabsAndWinsCounts();
- Services.telemetry.scalarSetMaximum(MAX_TAB_COUNT_SCALAR_NAME, counts.tabCount);
- Services.telemetry.scalarSetMaximum(MAX_WINDOW_COUNT_SCALAR_NAME, counts.winCount);
-
- // Reset the URI counter.
- URICountListener.reset();
- },
-
- uninit() {
- Services.obs.removeObserver(this, DOMWINDOW_OPENED_TOPIC, false);
- Services.obs.removeObserver(this, TELEMETRY_SUBSESSIONSPLIT_TOPIC, false);
- Services.obs.removeObserver(this, WINDOWS_RESTORED_TOPIC, false);
- },
-
- observe(subject, topic, data) {
- switch (topic) {
- case WINDOWS_RESTORED_TOPIC:
- this._setupAfterRestore();
- break;
- case DOMWINDOW_OPENED_TOPIC:
- this._onWindowOpen(subject);
- break;
- case TELEMETRY_SUBSESSIONSPLIT_TOPIC:
- this.afterSubsessionSplit();
- break;
- }
- },
-
- handleEvent(event) {
- switch (event.type) {
- case "TabOpen":
- this._onTabOpen();
- break;
- case "unload":
- this._unregisterWindow(event.target);
- break;
- case TAB_RESTORING_TOPIC:
- // We're restoring a new tab from a previous or crashed session.
- // We don't want to track the URIs from these tabs, so let
- // |URICountListener| know about them.
- let browser = event.target.linkedBrowser;
- URICountListener.addRestoredURI(browser, browser.currentURI);
- break;
- }
- },
-
- /**
- * The main entry point for recording search related Telemetry. This includes
- * search counts and engagement measurements.
- *
- * Telemetry records only search counts per engine and action origin, but
- * nothing pertaining to the search contents themselves.
- *
- * @param {nsISearchEngine} engine
- * The engine handling the search.
- * @param {String} source
- * Where the search originated from. See KNOWN_SEARCH_SOURCES for allowed
- * values.
- * @param {Object} [details] Options object.
- * @param {Boolean} [details.isOneOff=false]
- * true if this event was generated by a one-off search.
- * @param {Boolean} [details.isSuggestion=false]
- * true if this event was generated by a suggested search.
- * @param {Boolean} [details.isAlias=false]
- * true if this event was generated by a search using an alias.
- * @param {Object} [details.type=null]
- * The object describing the event that triggered the search.
- * @throws if source is not in the known sources list.
- */
- recordSearch(engine, source, details={}) {
- const isOneOff = !!details.isOneOff;
- const countId = getSearchEngineId(engine) + "." + source;
-
- if (isOneOff) {
- if (!KNOWN_ONEOFF_SOURCES.includes(source)) {
- // Silently drop the error if this bogus call
- // came from 'urlbar' or 'searchbar'. They're
- // calling |recordSearch| twice from two different
- // code paths because they want to record the search
- // in SEARCH_COUNTS.
- if (['urlbar', 'searchbar'].includes(source)) {
- Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS").add(countId);
- return;
- }
- throw new Error("Unknown source for one-off search: " + source);
- }
- } else {
- if (!KNOWN_SEARCH_SOURCES.includes(source)) {
- throw new Error("Unknown source for search: " + source);
- }
- Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS").add(countId);
- }
-
- // Dispatch the search signal to other handlers.
- this._handleSearchAction(engine, source, details);
- },
-
- _recordSearch(engine, source, action = null) {
- let scalarKey = action ? "search_" + action : "search";
- Services.telemetry.keyedScalarAdd("browser.engagement.navigation." + source,
- scalarKey, 1);
- Services.telemetry.recordEvent("navigation", "search", source, action,
- { engine: getSearchEngineId(engine) });
- },
-
- _handleSearchAction(engine, source, details) {
- switch (source) {
- case "urlbar":
- case "oneoff-urlbar":
- case "searchbar":
- case "oneoff-searchbar":
- case "unknown": // Edge case: this is the searchbar (see bug 1195733 comment 7).
- this._handleSearchAndUrlbar(engine, source, details);
- break;
- case "abouthome":
- this._recordSearch(engine, "about_home", "enter");
- break;
- case "newtab":
- this._recordSearch(engine, "about_newtab", "enter");
- break;
- case "contextmenu":
- this._recordSearch(engine, "contextmenu");
- break;
- }
- },
-
- /**
- * This function handles the "urlbar", "urlbar-oneoff", "searchbar" and
- * "searchbar-oneoff" sources.
- */
- _handleSearchAndUrlbar(engine, source, details) {
- // We want "urlbar" and "urlbar-oneoff" (and similar cases) to go in the same
- // scalar, but in a different key.
-
- // When using one-offs in the searchbar we get an "unknown" source. See bug
- // 1195733 comment 7 for the context. Fix-up the label here.
- const sourceName =
- (source === "unknown") ? "searchbar" : source.replace("oneoff-", "");
-
- const isOneOff = !!details.isOneOff;
- if (isOneOff) {
- // We will receive a signal from the "urlbar"/"searchbar" even when the
- // search came from "oneoff-urlbar". That's because both signals
- // are propagated from search.xml. Skip it if that's the case.
- // Moreover, we skip the "unknown" source that comes from the searchbar
- // when performing searches from the default search engine. See bug 1195733
- // comment 7 for context.
- if (["urlbar", "searchbar", "unknown"].includes(source)) {
- return;
- }
-
- // If that's a legit one-off search signal, record it using the relative key.
- this._recordSearch(engine, sourceName, "oneoff");
- return;
- }
-
- // The search was not a one-off. It was a search with the default search engine.
- if (details.isSuggestion) {
- // It came from a suggested search, so count it as such.
- this._recordSearch(engine, sourceName, "suggestion");
- return;
- } else if (details.isAlias) {
- // This one came from a search that used an alias.
- this._recordSearch(engine, sourceName, "alias");
- return;
- }
-
- // The search signal was generated by typing something and pressing enter.
- this._recordSearch(engine, sourceName, "enter");
- },
-
- /**
- * This gets called shortly after the SessionStore has finished restoring
- * windows and tabs. It counts the open tabs and adds listeners to all the
- * windows.
- */
- _setupAfterRestore() {
- // Make sure to catch new chrome windows and subsession splits.
- Services.obs.addObserver(this, DOMWINDOW_OPENED_TOPIC, false);
- Services.obs.addObserver(this, TELEMETRY_SUBSESSIONSPLIT_TOPIC, false);
-
- // Attach the tabopen handlers to the existing Windows.
- let browserEnum = Services.wm.getEnumerator("navigator:browser");
- while (browserEnum.hasMoreElements()) {
- this._registerWindow(browserEnum.getNext());
- }
-
- // Get the initial tab and windows max counts.
- const counts = getOpenTabsAndWinsCounts();
- Services.telemetry.scalarSetMaximum(MAX_TAB_COUNT_SCALAR_NAME, counts.tabCount);
- Services.telemetry.scalarSetMaximum(MAX_WINDOW_COUNT_SCALAR_NAME, counts.winCount);
- },
-
- /**
- * Adds listeners to a single chrome window.
- */
- _registerWindow(win) {
- win.addEventListener("unload", this);
- win.addEventListener("TabOpen", this, true);
-
- // Don't include URI and domain counts when in private mode.
- if (PrivateBrowsingUtils.isWindowPrivate(win)) {
- return;
- }
- win.gBrowser.tabContainer.addEventListener(TAB_RESTORING_TOPIC, this);
- win.gBrowser.addTabsProgressListener(URICountListener);
- },
-
- /**
- * Removes listeners from a single chrome window.
- */
- _unregisterWindow(win) {
- win.removeEventListener("unload", this);
- win.removeEventListener("TabOpen", this, true);
-
- // Don't include URI and domain counts when in private mode.
- if (PrivateBrowsingUtils.isWindowPrivate(win.defaultView)) {
- return;
- }
- win.defaultView.gBrowser.tabContainer.removeEventListener(TAB_RESTORING_TOPIC, this);
- win.defaultView.gBrowser.removeTabsProgressListener(URICountListener);
- },
-
- /**
- * Updates the tab counts.
- * @param {Number} [newTabCount=0] The count of the opened tabs across all windows. This
- * is computed manually if not provided.
- */
- _onTabOpen(tabCount = 0) {
- // Use the provided tab count if available. Otherwise, go on and compute it.
- tabCount = tabCount || getOpenTabsAndWinsCounts().tabCount;
- // Update the "tab opened" count and its maximum.
- Services.telemetry.scalarAdd(TAB_OPEN_EVENT_COUNT_SCALAR_NAME, 1);
- Services.telemetry.scalarSetMaximum(MAX_TAB_COUNT_SCALAR_NAME, tabCount);
- },
-
- /**
- * Tracks the window count and registers the listeners for the tab count.
- * @param{Object} win The window object.
- */
- _onWindowOpen(win) {
- // Make sure to have a |nsIDOMWindow|.
- if (!(win instanceof Ci.nsIDOMWindow)) {
- return;
- }
-
- let onLoad = () => {
- win.removeEventListener("load", onLoad, false);
-
- // Ignore non browser windows.
- if (win.document.documentElement.getAttribute("windowtype") != "navigator:browser") {
- return;
- }
-
- this._registerWindow(win);
- // Track the window open event and check the maximum.
- const counts = getOpenTabsAndWinsCounts();
- Services.telemetry.scalarAdd(WINDOW_OPEN_EVENT_COUNT_SCALAR_NAME, 1);
- Services.telemetry.scalarSetMaximum(MAX_WINDOW_COUNT_SCALAR_NAME, counts.winCount);
-
- // We won't receive the "TabOpen" event for the first tab within a new window.
- // Account for that.
- this._onTabOpen(counts.tabCount);
- };
- win.addEventListener("load", onLoad, false);
- },
-};
diff --git a/modules/ContentSearch.jsm b/modules/ContentSearch.jsm
index 91b0b9a..8e10b79 100644
--- a/modules/ContentSearch.jsm
+++ b/modules/ContentSearch.jsm
@@ -254,8 +254,6 @@ this.ContentSearch = {
};
win.openUILinkIn(submission.uri.spec, where, params);
}
- win.BrowserSearch.recordSearchInTelemetry(engine, data.healthReportKey,
- { selection: data.selection });
return;
},
diff --git a/modules/moz.build b/modules/moz.build
index d043d47..a0969a6 100644
--- a/modules/moz.build
+++ b/modules/moz.build
@@ -8,7 +8,6 @@ EXTRA_JS_MODULES += [
'AboutHome.jsm',
'AboutNewTab.jsm',
'AttributionCode.jsm',
- 'BrowserUsageTelemetry.jsm',
'CastingApps.jsm',
'ContentClick.jsm',
'ContentCrashHandlers.jsm',