Bug 1502440 - Hide browser internals in about:performance for beta and release users, r=felipe.

This commit is contained in:
Florian Quèze 2018-10-31 19:10:51 +01:00
Родитель d33f864af8
Коммит 97a292d889
2 изменённых файлов: 22 добавлений и 10 удалений

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

@ -5902,6 +5902,12 @@ pref("dom.xhr.lowercase_header.enabled", true);
// this can be removed.
pref("dom.clients.openwindow_favors_same_process", true);
#ifdef RELEASE_OR_BETA
pref("toolkit.aboutPerformance.showInternals", false);
#else
pref("toolkit.aboutPerformance.showInternals", true);
#endif
// When a crash happens, whether to include heap regions of the crash context
// in the minidump. Enabled by default on nightly and aurora.
#ifdef RELEASE_OR_BETA

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

@ -602,7 +602,8 @@ var State = {
let previous = this._buffer[Math.max(this._buffer.length - 2, 0)].tabs;
let current = this._latest.tabs;
return Object.keys(current).map(id => {
let counters = [];
for (let id of Object.keys(current)) {
let tab = current[id];
let oldest;
for (let index = 0; index <= this._buffer.length - 2; ++index) {
@ -614,7 +615,7 @@ var State = {
let prev = previous[id];
let host = tab.host;
let type = "tab";
let type = "other";
let name = `${host} (${id})`;
let image = "chrome://mozapps/skin/places/defaultFavicon.svg";
let found = tabFinder.get(parseInt(id));
@ -622,10 +623,10 @@ var State = {
if (found.tabbrowser) {
name = found.tab.getAttribute("label");
image = found.tab.getAttribute("image");
type = "tab";
} else {
name = {id: "preloaded-tab",
title: found.tab.linkedBrowser.contentTitle};
type = "other";
}
} else if (id == 1) {
name = BRAND_NAME;
@ -638,7 +639,11 @@ var State = {
type = "addon";
} else if (id == 0 && !tab.isWorker) {
name = {id: "ghost-windows"};
type = "other";
}
if (type != "tab" && type != "addon" &&
!Services.prefs.getBoolPref("toolkit.aboutPerformance.showInternals", false)) {
continue;
}
// Create a map of all the child items from the previous time we read the
@ -697,12 +702,13 @@ var State = {
durationSinceStartOfBuffer =
duration - oldest.duration - (oldest.durationFromFormerChildren || 0);
}
return ({id, name, image, type,
totalDispatches: dispatches, totalDuration: duration,
durationSincePrevious, dispatchesSincePrevious,
durationSinceStartOfBuffer, dispatchesSinceStartOfBuffer,
children});
});
counters.push({id, name, image, type,
totalDispatches: dispatches, totalDuration: duration,
durationSincePrevious, dispatchesSincePrevious,
durationSinceStartOfBuffer, dispatchesSinceStartOfBuffer,
children});
}
return counters;
},
};