Backed out 3 changesets (bug 1647695) for failures on browser_aboutprocesses.js. CLOSED TREE

Backed out changeset 01b6951d0aae (bug 1647695)
Backed out changeset 1b1fa5dbd9bd (bug 1647695)
Backed out changeset 0f097362abf8 (bug 1647695)
This commit is contained in:
Csoregi Natalia 2020-08-03 20:31:35 +03:00
parent 5c490f26a5
commit b93d5d6e33
7 changed files with 10 additions and 153 deletions

View File

@ -554,7 +554,7 @@ dictionary ChildProcInfoDictionary {
unsigned long long cpuKernel = 0;
sequence<ThreadInfoDictionary> threads = [];
// Firefox info
unsigned long long childID = 0;
unsigned long long ChildID = 0;
UTF8String origin = "";
WebIDLProcType type = "web";
};

View File

@ -1214,15 +1214,6 @@ HangMonitoredProcess::UserCanceled() {
return NS_OK;
}
NS_IMETHODIMP
HangMonitoredProcess::GetChildID(uint64_t* aChildID) {
if (!mContentParent) {
return NS_ERROR_NOT_AVAILABLE;
}
*aChildID = mContentParent->ChildID();
return NS_OK;
}
static bool InterruptCallback(JSContext* cx) {
if (HangMonitorChild* child = HangMonitorChild::Get()) {
return child->InterruptCallback();

View File

@ -40,9 +40,6 @@ interface nsIHangReport : nsISupports
// Only valid for PLUGIN_HANG reports.
readonly attribute ACString pluginName;
// The child id of the process in which the hang happened.
readonly attribute unsigned long long childID;
// Called by front end code when user ignores or cancels
// the notification.
void userCanceled();

View File

@ -42,32 +42,19 @@ tr {
table-layout: fixed;
width: 100%;
}
/* column-pid */
td:nth-child(1) {
width: 16%;
}
/* At least one column needs to have a flexible width,
so no width specified for td:nth-child(2) aka column-name*/
/* column-memory-resident */
so no width specified for td:nth-child(2) */
td:nth-child(3) {
width: 10%;
}
/* column-cpu-user */
td:nth-child(4) {
width: 10%;
width: 10%;
}
/* column-cpu-kernel */
td:nth-child(5) {
width: 10%;
}
/* column-threads */
td:nth-child(6) {
width: 2%;
width: 10%;
}
#process-thead > tr {
@ -181,13 +168,6 @@ td {
font-size-adjust: 0.5;
}
/* column-name */
/* When the process is reported as frozen, we display an hourglass before its name. */
.process.hung > :nth-child(2)::before {
content: "⌛️";
}
/*
Show a the separation between process groups.
*/

View File

@ -26,8 +26,6 @@ const ONE_GIGA = 1024 * 1024 * 1024;
const ONE_MEGA = 1024 * 1024;
const ONE_KILO = 1024;
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* Returns a Promise that's resolved after the next turn of the event loop.
*
@ -150,7 +148,6 @@ var State = {
_getProcessDelta(cur, prev) {
let result = {
pid: cur.pid,
childID: cur.childID,
filename: cur.filename,
totalVirtualMemorySize: cur.virtualMemorySize,
deltaVirtualMemorySize: null,
@ -252,16 +249,13 @@ var View = {
* Append a row showing a single process (without its threads).
*
* @param {ProcessDelta} data The data to display.
* @param {bool} isOpen `true` if we're also displaying the threads of this process, `false` otherwise.
* @return {DOMElement} The row displaying the process.
*/
appendProcessRow(data) {
appendProcessRow(data, isOpen) {
let row = document.createElement("tr");
row.classList.add("process");
if (data.isHung) {
row.classList.add("hung");
}
// Column: pid / twisty image
{
let elt = this._addCell(row, {
@ -272,14 +266,14 @@ var View = {
if (data.threads.length) {
let img = document.createElement("span");
img.classList.add("twisty", "process");
if (data.isOpen) {
if (isOpen) {
img.classList.add("open");
}
elt.insertBefore(img, elt.firstChild);
}
}
// Column: name/type
// Column: type
{
let content = data.origin ? `${data.origin} (${data.type})` : data.type;
this._addCell(row, {
@ -533,10 +527,6 @@ var View = {
var Control = {
_openItems: new Set(),
// The set of all processes reported as "hung" by the process hang monitor.
//
// type: Set<ChildID>
_hungItems: new Set(),
_sortColumn: null,
_sortAscendent: true,
_removeSubtree(row) {
@ -545,8 +535,6 @@ var Control = {
}
},
init() {
this._initHangReports();
let tbody = document.getElementById("process-tbody");
tbody.addEventListener("click", event => {
this._updateLastMouseEvent();
@ -627,29 +615,6 @@ var Control = {
_updateLastMouseEvent() {
this._lastMouseEvent = Date.now();
},
_initHangReports() {
const PROCESS_HANG_REPORT_NOTIFICATION = "process-hang-report";
// Receiving report of a hung child.
// Let's store if for our next update.
let hangReporter = report => {
report.QueryInterface(Ci.nsIHangReport);
this._hungItems.add(report.childID);
};
Services.obs.addObserver(hangReporter, PROCESS_HANG_REPORT_NOTIFICATION);
// Don't forget to unregister the reporter.
window.addEventListener(
"unload",
() => {
Services.obs.removeObserver(
hangReporter,
PROCESS_HANG_REPORT_NOTIFICATION
);
},
{ once: true }
);
},
async update() {
await State.update();
@ -679,26 +644,13 @@ var Control = {
let openItems = this._openItems;
this._openItems = new Set();
// Similarly, we reset `_hungItems`, based on the assumption that the process hang
// monitor will inform us again before the next update. Since the process hang monitor
// pings its clients about once per second and we update about once per 2 seconds
// (or more if the mouse moves), we should be ok.
let hungItems = this._hungItems;
this._hungItems = new Set();
counters = this._sortProcesses(counters);
let previousRow = null;
let previousProcess = null;
for (let process of counters) {
let isOpen = openItems.has(process.pid);
process.isOpen = isOpen;
let isHung = process.childID && hungItems.has(process.childID);
process.isHung = isHung;
let processRow = View.appendProcessRow(process, isOpen);
processRow.process = process;
let latestRow = processRow;
if (isOpen) {
this._openItems.add(process.pid);

View File

@ -3,7 +3,7 @@
"use strict";
const { AppConstants } = ChromeUtils.import(
let { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
@ -233,48 +233,16 @@ function testMemory(string, total, delta, assumptions) {
add_task(async function testAboutProcesses() {
info("Setting up about:processes");
// The tab we're testing.
let tabAboutProcesses = (gBrowser.selectedTab = BrowserTestUtils.addTab(
gBrowser,
"about:processes"
));
// Another tab that we'll pretend is hung.
let tabHung = BrowserTestUtils.addTab(gBrowser, "https://example.org");
await BrowserTestUtils.browserLoaded(tabAboutProcesses.linkedBrowser);
await BrowserTestUtils.browserLoaded(tabHung.linkedBrowser);
let hungChildID = tabHung.linkedBrowser.frameLoader.childID;
let doc = tabAboutProcesses.linkedBrowser.contentDocument;
let tbody = doc.getElementById("process-tbody");
// Keep informing about:processes that `tabHung` is hung.
// Note: this is a background task, do not `await` it.
let isProcessHangDetected = false;
let fakeProcessHangMonitor = async function() {
for (let i = 0; i < 100; ++i) {
if (isProcessHangDetected || !tabHung.linkedBrowser) {
// Let's stop spamming as soon as we can.
return;
}
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
await new Promise(resolve => setTimeout(resolve, 300));
Services.obs.notifyObservers(
{
childID: hungChildID,
hangType: Ci.nsIHangReport.PLUGIN_HANG,
pluginName: "Fake plug-in",
QueryInterface: ChromeUtils.generateQI(["nsIHangReport"]),
},
"process-hang-report"
);
}
};
fakeProcessHangMonitor();
// Wait until the table has first been populated.
await TestUtils.waitForCondition(() => tbody.childElementCount);
@ -381,29 +349,8 @@ add_task(async function testAboutProcesses() {
HARDCODED_ASSUMPTIONS_THREAD
);
}
Assert.equal(numberOfThreads, numberOfThreadsFound);
info("Ensuring that the hung process is marked as hung");
let isOneNonHungProcessDetected = false;
for (let row of tbody.getElementsByClassName("process")) {
if (row.classList.contains("hung")) {
if (row.process.childID == hungChildID) {
isProcessHangDetected = true;
}
} else {
isOneNonHungProcessDetected = true;
}
if (isProcessHangDetected && isOneNonHungProcessDetected) {
break;
}
}
Assert.ok(isProcessHangDetected, "We have found our hung process");
Assert.ok(
isOneNonHungProcessDetected,
"We have found at least one non-hung process"
);
BrowserTestUtils.removeTab(tabAboutProcesses);
BrowserTestUtils.removeTab(tabHung);
});

View File

@ -49,16 +49,6 @@ add_task(async function test_proc_info() {
"browser",
"Child proc type should not be browser"
);
if (
childProc.type.startsWith("web") ||
childProc.type.startsWith("Web")
) {
Assert.notEqual(
childProc.childID,
0,
"Child proc should not have a 0 childID"
);
}
Assert.notEqual(
childProc.type,
"unknown",