Bug 1453667 - Remove BrowserUITelemetry from other parts of browser/ r?Gijs
MozReview-Commit-ID: FG1PiVPBY5U
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -1,16 +1,13 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# 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/.
-# NB: IF YOU ADD ITEMS TO THIS FILE, PLEASE UPDATE THE WHITELIST IN
-# BrowserUITelemetry.jsm. SEE BUG 991757 FOR DETAILS.
-
<menugroup id="context-navigation">
<menuitem id="context-back"
class="menuitem-iconic"
tooltiptext="&backButton.tooltip;"
aria-label="&backCmd.label;"
command="Browser:BackOrBackDuplicate"
accesskey="&backCmd.accesskey;"
onclick="checkForMiddleClick(this, event);"/>
--- a/browser/base/content/browser-sidebar.js
+++ b/browser/base/content/browser-sidebar.js
@@ -388,17 +388,16 @@ var SidebarUI = {
return this._show(commandID).then((sidebarBroadcaster) => {
this._loadSidebarExtension(sidebarBroadcaster);
if (triggerNode) {
updateToggleControlLabel(triggerNode);
}
this._fireFocusedEvent();
- BrowserUITelemetry.countSidebarEvent(commandID, "show");
});
},
/**
* Show the sidebar, without firing the focused event or logging telemetry.
* This is intended to be used when the sidebar is opened automatically
* when a window opens (not triggered by user interaction).
*
@@ -419,20 +418,16 @@ var SidebarUI = {
_show(commandID) {
return new Promise((resolve, reject) => {
let sidebarBroadcaster = this.getBroadcasterById(commandID);
if (!sidebarBroadcaster) {
reject(new Error("Invalid sidebar broadcaster specified: " + commandID));
return;
}
- if (this.isOpen && commandID != this.currentID) {
- BrowserUITelemetry.countSidebarEvent(this.currentID, "hide");
- }
-
let broadcasters = document.querySelectorAll("broadcaster[group=sidebar]");
for (let broadcaster of broadcasters) {
if (broadcaster != sidebarBroadcaster) {
broadcaster.removeAttribute("checked");
} else {
sidebarBroadcaster.setAttribute("checked", "true");
}
}
@@ -530,17 +525,16 @@ var SidebarUI = {
let selBrowser = gBrowser.selectedBrowser;
selBrowser.focus();
selBrowser.messageManager.sendAsyncMessage("Sidebar:VisibilityChange",
{commandID, isOpen: false}
);
if (triggerNode) {
updateToggleControlLabel(triggerNode);
}
- BrowserUITelemetry.countSidebarEvent(commandID, "hide");
},
};
// Add getters related to the position here, since we will want them
// available for both startDelayedLoad and init.
XPCOMUtils.defineLazyPreferenceGetter(SidebarUI, "_positionStart",
SidebarUI.POSITION_START_PREF, true, SidebarUI.setPosition.bind(SidebarUI));
XPCOMUtils.defineLazyGetter(SidebarUI, "isRTL", () => {
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -145,19 +145,16 @@ nsContextMenu.prototype = {
this.onPlainTextLink = false;
let bookmarkPage = document.getElementById("context-bookmarkpage");
if (bookmarkPage)
BookmarkingUI.onCurrentPageContextPopupShowing();
// Initialize (disable/remove) menu items.
this.initItems();
-
- // Register this opening of the menu with telemetry:
- this._checkTelemetryForMenu(aXulMenu);
},
setContext() {
let context = Object.create(null);
this.isRemote = false;
if (gContextMenuContentData) {
context = gContextMenuContentData.context;
@@ -1523,74 +1520,16 @@ nsContextMenu.prototype = {
let engineName = Services.search.currentEngine.name;
var menuLabel = gNavigatorBundle.getFormattedString("contextMenuSearch",
[engineName,
selectedText]);
menuItem.label = menuLabel;
menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey");
},
- _getTelemetryClickInfo(aXulMenu) {
- this._onPopupHiding = () => {
- aXulMenu.ownerDocument.removeEventListener("command", activationHandler, true);
- aXulMenu.removeEventListener("popuphiding", this._onPopupHiding, true);
- delete this._onPopupHiding;
-
- let eventKey = [
- this._telemetryPageContext,
- this._telemetryHadCustomItems ? "withcustom" : "withoutcustom"
- ];
- let target = this._telemetryClickID || "close-without-interaction";
- BrowserUITelemetry.registerContextMenuInteraction(eventKey, target);
- };
- let activationHandler = (e) => {
- // Deal with command events being routed to command elements; figure out
- // what triggered the event (which will have the right e.target)
- if (e.sourceEvent) {
- e = e.sourceEvent;
- }
- // Target should be in the menu (this catches using shortcuts for items
- // not in the menu while the menu is up)
- if (!aXulMenu.contains(e.target)) {
- return;
- }
-
- // Check if this is a page menu item:
- if (e.target.hasAttribute(PageMenuParent.GENERATEDITEMID_ATTR)) {
- this._telemetryClickID = "custom-page-item";
- } else {
- this._telemetryClickID = (e.target.id || "unknown").replace(/^context-/i, "");
- }
- };
- aXulMenu.ownerDocument.addEventListener("command", activationHandler, true);
- aXulMenu.addEventListener("popuphiding", this._onPopupHiding, true);
- },
-
- _getTelemetryPageContextInfo() {
- let rv = [];
- for (let k of ["isContentSelected", "onLink", "onImage", "onCanvas", "onVideo", "onAudio",
- "onTextInput", "inWebExtBrowser", "inTabBrowser"]) {
- if (this[k]) {
- rv.push(k.replace(/^(?:is|on)(.)/, (match, firstLetter) => firstLetter.toLowerCase()));
- }
- }
- if (!rv.length) {
- rv.push("other");
- }
-
- return JSON.stringify(rv);
- },
-
- _checkTelemetryForMenu(aXulMenu) {
- this._telemetryClickID = null;
- this._telemetryPageContext = this._getTelemetryPageContextInfo();
- this._telemetryHadCustomItems = this.hasPageMenu;
- this._getTelemetryClickInfo(aXulMenu);
- },
-
createContainerMenu(aEvent) {
let createMenuOptions = {
isContextMenu: true,
excludeUserContextId: gContextMenuContentData.userContextId,
};
return createUserContextMenu(aEvent, createMenuOptions);
},
};
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1897,25 +1897,23 @@
this.finishMediaBlockTimer();
} else {
if (browser.audioMuted) {
if (this.linkedPanel) {
// "Lazy Browser" should not invoke its unmute method
browser.unmute();
}
this.removeAttribute("muted");
- BrowserUITelemetry.countTabMutingEvent("unmute", aMuteReason);
hist.add(1 /* unmute */);
} else {
if (this.linkedPanel) {
// "Lazy Browser" should not invoke its mute method
browser.mute();
}
this.setAttribute("muted", "true");
- BrowserUITelemetry.countTabMutingEvent("mute", aMuteReason);
hist.add(0 /* mute */);
}
this.muteReason = aMuteReason || null;
modifiedAttrs.push("muted");
}
gBrowser._tabAttrModified(this, modifiedAttrs);
]]>
</body>
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -7,17 +7,16 @@
var EXPORTED_SYMBOLS = ["CustomizableWidgets"];
ChromeUtils.import("resource:///modules/CustomizableUI.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
- BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
PanelView: "resource:///modules/PanelMultiView.jsm",
RecentlyClosedTabsAndWindowsMenuUtils: "resource:///modules/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm",
ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
CharsetMenu: "resource://gre/modules/CharsetMenu.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
SyncedTabs: "resource://services-sync/SyncedTabs.jsm",
});
@@ -742,17 +741,16 @@ if (Services.prefs.getBoolPref("identity
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})
});
if (doc.defaultView.whereToOpenLink(e) != "current") {
e.preventDefault();
e.stopPropagation();
} else {
CustomizableUI.hidePanelForNode(item);
}
- BrowserUITelemetry.countSyncedTabEvent("open", "toolbarbutton-subview");
});
return item;
},
_createShowMoreElement(doc, clientId, showCount) {
let labelAttr, tooltipAttr;
if (showCount === Infinity) {
labelAttr = "showAllLabel";
tooltipAttr = "showAllTooltipText";
@@ -799,17 +797,16 @@ if (Services.prefs.getBoolPref("privacy.
CustomizableWidgets.push({
id: "panic-button",
type: "view",
viewId: "PanelUI-panicView",
forgetButtonCalled(aEvent) {
let doc = aEvent.target.ownerDocument;
let group = doc.getElementById("PanelUI-panic-timeSpan");
- BrowserUITelemetry.countPanicEvent(group.selectedItem.id);
let itemsToClear = [
"cookies", "history", "openWindows", "formdata", "sessions", "cache", "downloads", "offlineApps"
];
let newWindowPrivateState = PrivateBrowsingUtils.isWindowPrivate(doc.defaultView) ?
"private" : "non-private";
let promise = Sanitizer.sanitize(itemsToClear, {
ignoreTimespan: false,
range: Sanitizer.getClearRange(+group.value),
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -26,18 +26,16 @@ ChromeUtils.import("resource:///modules/
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyGlobalGetters(this, ["CSS"]);
ChromeUtils.defineModuleGetter(this, "DragPositionManager",
"resource:///modules/DragPositionManager.jsm");
-ChromeUtils.defineModuleGetter(this, "BrowserUITelemetry",
- "resource:///modules/BrowserUITelemetry.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.defineModuleGetter(this, "LightweightThemeManager",
"resource://gre/modules/LightweightThemeManager.jsm");
ChromeUtils.defineModuleGetter(this, "SessionStore",
"resource:///modules/sessionstore/SessionStore.jsm");
XPCOMUtils.defineLazyGetter(this, "gWidgetsBundle", function() {
const kUrl = "chrome://browser/locale/customizableui/customizableWidgets.properties";
@@ -1079,17 +1077,16 @@ CustomizeMode.prototype = {
document.persist(toolbar.id, "currentset");
}
},
reset() {
this.resetting = true;
// Disable the reset button temporarily while resetting:
let btn = this.$("customization-reset-button");
- BrowserUITelemetry.countCustomizationEvent("reset");
btn.disabled = true;
return (async () => {
await this.depopulatePalette();
await this._unwrapToolbarItems();
CustomizableUI.reset();
this._updateLWThemeButtonIcon();
@@ -1887,17 +1884,16 @@ CustomizeMode.prototype = {
if (aTargetArea.id == kPaletteId) {
// Did we drag from outside the palette?
if (aOriginArea.id !== kPaletteId) {
if (!CustomizableUI.isWidgetRemovable(aDraggedItemId)) {
return;
}
CustomizableUI.removeWidgetFromArea(aDraggedItemId);
- BrowserUITelemetry.countCustomizationEvent("remove");
// Special widgets are removed outright, we can return here:
if (CustomizableUI.isSpecialWidget(aDraggedItemId)) {
return;
}
}
draggedItem = draggedItem.parentNode;
// If the target node is the palette itself, just append
@@ -1929,30 +1925,23 @@ CustomizeMode.prototype = {
if (aTargetNode == aTargetArea.customizationTarget) {
aTargetArea.customizationTarget.appendChild(draggedItem);
} else {
this.unwrapToolbarItem(aTargetNode.parentNode);
aTargetArea.customizationTarget.insertBefore(draggedItem, aTargetNode);
this.wrapToolbarItem(aTargetNode, place);
}
this.wrapToolbarItem(draggedItem, place);
- BrowserUITelemetry.countCustomizationEvent("move");
return;
}
// Is the target the customization area itself? If so, we just add the
// widget to the end of the area.
if (aTargetNode == aTargetArea.customizationTarget) {
CustomizableUI.addWidgetToArea(aDraggedItemId, aTargetArea.id);
- // For the purposes of BrowserUITelemetry, we consider both moving a widget
- // within the same area, and adding a widget from one area to another area
- // as a "move". An "add" is only when we move an item from the palette into
- // an area.
- let custEventType = aOriginArea.id == kPaletteId ? "add" : "move";
- BrowserUITelemetry.countCustomizationEvent(custEventType);
this._onDragEnd(aEvent);
return;
}
// We need to determine the place that the widget is being dropped in
// the target.
let placement;
let itemForPlacement = aTargetNode;
@@ -1987,21 +1976,16 @@ CustomizeMode.prototype = {
if (aTargetArea == aOriginArea) {
CustomizableUI.moveWidgetWithinArea(aDraggedItemId, position);
} else {
CustomizableUI.addWidgetToArea(aDraggedItemId, aTargetArea.id, position);
}
this._onDragEnd(aEvent);
- // For BrowserUITelemetry, an "add" is only when we move an item from the palette
- // into an area. Otherwise, it's a move.
- let custEventType = aOriginArea.id == kPaletteId ? "add" : "move";
- BrowserUITelemetry.countCustomizationEvent(custEventType);
-
// If we dropped onto a skipintoolbarset item, manually correct the drop location:
if (aTargetNode != itemForPlacement) {
let draggedWrapper = draggedItem.parentNode;
let container = draggedWrapper.parentNode;
container.insertBefore(draggedWrapper, aTargetNode.parentNode);
}
},
--- a/browser/components/syncedtabs/TabListComponent.js
+++ b/browser/components/syncedtabs/TabListComponent.js
@@ -6,17 +6,16 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
let log = ChromeUtils.import("resource://gre/modules/Log.jsm", {})
.Log.repository.getLogger("Sync.RemoteTabs");
XPCOMUtils.defineLazyModuleGetters(this, {
- BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm",
});
var EXPORTED_SYMBOLS = [
"TabListComponent"
];
/**
@@ -109,17 +108,16 @@ TabListComponent.prototype = {
onBookmarkTab(uri, title) {
this._window.top.PlacesCommandHook
.bookmarkLink(this._window.top.PlacesUtils.bookmarksMenuFolderId, uri, title)
.catch(Cu.reportError);
},
onOpenTab(url, where, params) {
this._window.openTrustedLinkIn(url, where, params);
- BrowserUITelemetry.countSyncedTabEvent("open", "sidebar");
},
onOpenTabs(urls, where) {
if (!OpenInTabsUtils.confirmOpenInTabs(urls.length, this._window)) {
return;
}
if (where == "window") {
this._window.openDialog(this._window.getBrowserURL(), "_blank",
@@ -127,17 +125,16 @@ TabListComponent.prototype = {
} else {
let loadInBackground = where == "tabshifted";
this._getChromeWindow(this._window).gBrowser.loadTabs(urls, {
inBackground: loadInBackground,
replace: false,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}
- BrowserUITelemetry.countSyncedTabEvent("openmultiple", "sidebar");
},
onCopyTabLocation(url) {
this._clipboardHelper.copyString(url);
},
onSyncRefresh() {
this._SyncedTabs.syncTabs(true);