Bug 1652613 - record whether the user switched away from the tab while it was hung, r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D84343
This commit is contained in:
Gijs Kruitbosch 2020-07-24 00:55:34 +00:00
Родитель 02d23145dc
Коммит eabaeb4c02
2 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -432,6 +432,7 @@ var ProcessHangMonitor = {
{
end_reason: endReason,
hang_duration: "" + hangDuration,
n_tab_deselect: "" + info.deselectCount,
uri_type,
uptime,
wait_count: "" + info.waitCount,
@ -638,8 +639,18 @@ var ProcessHangMonitor = {
// If a new tab is selected or if a tab changes remoteness, then
// we may need to show or hide a hang notification.
if (event.type == "TabSelect" || event.type == "TabRemotenessChange") {
if (event.type == "TabSelect" && event.detail.previousTab) {
// If we've got a notification, check the previous tab's report and
// indicate the user switched tabs while the notification was up.
let r =
this.findActiveReport(event.detail.previousTab.linkedBrowser) ||
this.findPausedReport(event.detail.previousTab.linkedBrowser);
if (r) {
let info = this._activeReports.get(r) || this._pausedReports.get(r);
info.deselectCount++;
}
}
this.updateWindow(win);
}
},
@ -684,6 +695,7 @@ var ProcessHangMonitor = {
}
this._activeReports.set(report, {
deselectCount: 0,
lastReportFromChild: now,
waitCount: 0,
});

Просмотреть файл

@ -2294,6 +2294,7 @@ slow_script_warning:
end_reason: Why the warning was hidden (user action, the process becoming responsive again, the browser quitting, etc.)
wait_count: How many times the user elected to wait.
hang_duration: How long we believe the hang continued (ms).
n_tab_deselect: How many times the user switched away from a tab affected by this hang.
uri_type: The kind of script URL that hung.
uptime: How long the notification was up (ms).