Bug 1917838 - Remove expired telemetry event close_tab_warning.shown, r=chutten,tabbrowser-reviewers,firefox-desktop-core-reviewers ,dao.

Differential Revision: https://phabricator.services.mozilla.com/D221650
This commit is contained in:
Florian Quèze
2024-09-12 13:42:22 +00:00
parent e78f5e8ed2
commit 7346c45e51
5 changed files with 7 additions and 91 deletions

View File

@@ -5851,10 +5851,9 @@ function WindowIsClosing(event) {
* Checks if this is the last full *browser* window around. If it is, this will * Checks if this is the last full *browser* window around. If it is, this will
* be communicated like quitting. Otherwise, we warn about closing multiple tabs. * be communicated like quitting. Otherwise, we warn about closing multiple tabs.
* *
* @param source where the request to close came from (used for telemetry)
* @returns true if closing can proceed, false if it got cancelled. * @returns true if closing can proceed, false if it got cancelled.
*/ */
function warnAboutClosingWindow(source) { function warnAboutClosingWindow() {
// Popups aren't considered full browser windows; we also ignore private windows. // Popups aren't considered full browser windows; we also ignore private windows.
let isPBWindow = let isPBWindow =
PrivateBrowsingUtils.isWindowPrivate(window) && PrivateBrowsingUtils.isWindowPrivate(window) &&
@@ -5863,8 +5862,7 @@ function warnAboutClosingWindow(source) {
if (!isPBWindow && !toolbar.visible) { if (!isPBWindow && !toolbar.visible) {
return gBrowser.warnAboutClosingTabs( return gBrowser.warnAboutClosingTabs(
gBrowser.visibleTabs.length, gBrowser.visibleTabs.length,
gBrowser.closingTabsEnum.ALL, gBrowser.closingTabsEnum.ALL
source
); );
} }
@@ -5904,8 +5902,7 @@ function warnAboutClosingWindow(source) {
isPBWindow || isPBWindow ||
gBrowser.warnAboutClosingTabs( gBrowser.warnAboutClosingTabs(
gBrowser.visibleTabs.length, gBrowser.visibleTabs.length,
gBrowser.closingTabsEnum.ALL, gBrowser.closingTabsEnum.ALL
source
) )
); );
} }
@@ -5930,8 +5927,7 @@ function warnAboutClosingWindow(source) {
isPBWindow || isPBWindow ||
gBrowser.warnAboutClosingTabs( gBrowser.warnAboutClosingTabs(
gBrowser.visibleTabs.length, gBrowser.visibleTabs.length,
gBrowser.closingTabsEnum.ALL, gBrowser.closingTabsEnum.ALL
source
) )
); );
} }

View File

@@ -3520,7 +3520,6 @@ BrowserGlue.prototype = {
let windowcount = 0; let windowcount = 0;
let pagecount = 0; let pagecount = 0;
let pinnedcount = 0;
for (let win of lazy.BrowserWindowTracker.orderedWindows) { for (let win of lazy.BrowserWindowTracker.orderedWindows) {
if (win.closed) { if (win.closed) {
continue; continue;
@@ -3528,7 +3527,6 @@ BrowserGlue.prototype = {
windowcount++; windowcount++;
let tabbrowser = win.gBrowser; let tabbrowser = win.gBrowser;
if (tabbrowser) { if (tabbrowser) {
pinnedcount += tabbrowser._numPinnedTabs;
pagecount += tabbrowser.visibleTabs.length - tabbrowser._numPinnedTabs; pagecount += tabbrowser.visibleTabs.length - tabbrowser._numPinnedTabs;
} }
} }
@@ -3616,26 +3614,6 @@ BrowserGlue.prototype = {
checkboxLabel.value, checkboxLabel.value,
warnOnClose warnOnClose
); );
Services.telemetry.setEventRecordingEnabled("close_tab_warning", true);
let warnCheckbox = warnOnClose.value ? "checked" : "unchecked";
let sessionWillBeRestored =
Services.prefs.getIntPref("browser.startup.page") == 3 ||
Services.prefs.getBoolPref("browser.sessionstore.resume_session_once");
Services.telemetry.recordEvent(
"close_tab_warning",
"shown",
"application",
null,
{
source: this._quitSource,
button: buttonPressed == 0 ? "close" : "cancel",
warn_checkbox: warnCheckbox,
closing_wins: "" + windowcount,
closing_tabs: "" + (pagecount + pinnedcount),
will_restore: sessionWillBeRestored ? "yes" : "no",
}
);
// If the user has unticked the box, and has confirmed closing, stop showing // If the user has unticked the box, and has confirmed closing, stop showing
// the warning. // the warning.

View File

@@ -3436,7 +3436,7 @@
} }
}, },
warnAboutClosingTabs(tabsToClose, aCloseTabs, aSource) { warnAboutClosingTabs(tabsToClose, aCloseTabs) {
// We want to warn about closing duplicates even if there was only a // We want to warn about closing duplicates even if there was only a
// single duplicate, so we intentionally place this above the check for // single duplicate, so we intentionally place this above the check for
// tabsToClose <= 1. // tabsToClose <= 1.
@@ -3540,39 +3540,6 @@
warnOnClose warnOnClose
); );
Services.telemetry.setEventRecordingEnabled("close_tab_warning", true);
let closeTabEnumKey =
Object.entries(this.closingTabsEnum)
.find(([, v]) => v == aCloseTabs)?.[0]
?.toLowerCase() || "some";
let warnCheckbox = warnOnClose.value ? "checked" : "unchecked";
if (!checkboxLabel) {
warnCheckbox = "not-present";
}
let sessionWillBeRestored =
Services.prefs.getIntPref("browser.startup.page") == 3 ||
Services.prefs.getBoolPref("browser.sessionstore.resume_session_once");
let closesWindow = aCloseTabs == this.closingTabsEnum.ALL;
Services.telemetry.recordEvent(
"close_tab_warning",
"shown",
closesWindow ? "window" : "tabs",
null,
{
source: aSource || `close-${closeTabEnumKey}-tabs`,
button: buttonPressed == 0 ? "close" : "cancel",
warn_checkbox: warnCheckbox,
closing_tabs: "" + tabsToClose,
closing_wins: "" + +closesWindow, // ("1" or "0", depending on the value)
// This value doesn't really apply to whether this warning
// gets shown, but having pings be consistent (and perhaps
// being able to see trends for users with/without sessionrestore)
// seems useful:
will_restore: sessionWillBeRestored ? "yes" : "no",
}
);
var reallyClose = buttonPressed == 0; var reallyClose = buttonPressed == 0;
// don't set the pref unless they press OK and it's false // don't set the pref unless they press OK and it's false

View File

@@ -3706,28 +3706,6 @@ contextservices.quicksuggest:
- adw@mozilla.com - adw@mozilla.com
expiry_version: never expiry_version: never
close_tab_warning:
shown:
description: >
Recorded whenever we show the 'Close Tabs' dialog, with details about
the reason it is shown and what choices the user makes (close or not).
objects: ["window", "application", "tabs"]
release_channel_collection: opt-out
expiry_version: "99"
record_in_processes: ["main"]
products: ["firefox"]
bug_numbers: [1712306, 1725296]
notification_emails:
- gkruitbosch@mozilla.com
- rtestard@mozilla.com
extra_keys:
source: The way in which the tabs were closed (shortcut, close button, menuitem, appmenu, etc.)
button: Which button the user clicked (Close tabs or Cancel)
warn_checkbox: Whether the checkbox to display the warning again was checked or not.
closing_wins: The number of windows being closed.
closing_tabs: The number of tabs being closed.
will_restore: Whether the session will be restored if closed now.
memory_watcher: memory_watcher:
on_high_memory: on_high_memory:
description: > description: >

View File

@@ -26,7 +26,7 @@ function closeWindow(aClose, aPromptFunction, aSource) {
if ( if (
windowCount != 1 && windowCount != 1 &&
typeof aPromptFunction == "function" && typeof aPromptFunction == "function" &&
!aPromptFunction(aSource) !aPromptFunction()
) { ) {
return false; return false;
} }
@@ -35,10 +35,7 @@ function closeWindow(aClose, aPromptFunction, aSource) {
if (aClose) { if (aClose) {
window.SessionStore?.maybeDontRestoreTabs(window); window.SessionStore?.maybeDontRestoreTabs(window);
} }
} else if ( } else if (typeof aPromptFunction == "function" && !aPromptFunction()) {
typeof aPromptFunction == "function" &&
!aPromptFunction(aSource)
) {
return false; return false;
} }