diff --git a/dom/chrome-webidl/ChromeUtils.webidl b/dom/chrome-webidl/ChromeUtils.webidl index 3b1d74b7f4ce..974123cc2683 100644 --- a/dom/chrome-webidl/ChromeUtils.webidl +++ b/dom/chrome-webidl/ChromeUtils.webidl @@ -554,7 +554,7 @@ dictionary ChildProcInfoDictionary { unsigned long long cpuKernel = 0; sequence threads = []; // Firefox info - unsigned long long childID = 0; + unsigned long long ChildID = 0; UTF8String origin = ""; WebIDLProcType type = "web"; }; diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp index 4430f85e5e2a..ba3619a16e8d 100644 --- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -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(); diff --git a/dom/ipc/nsIHangReport.idl b/dom/ipc/nsIHangReport.idl index cf3ecdf9844d..e4bb46d4cc65 100644 --- a/dom/ipc/nsIHangReport.idl +++ b/dom/ipc/nsIHangReport.idl @@ -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(); diff --git a/toolkit/components/aboutprocesses/content/aboutProcesses.css b/toolkit/components/aboutprocesses/content/aboutProcesses.css index 32064f83f7a4..e4bfe0c5f7d5 100644 --- a/toolkit/components/aboutprocesses/content/aboutProcesses.css +++ b/toolkit/components/aboutprocesses/content/aboutProcesses.css @@ -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. */ diff --git a/toolkit/components/aboutprocesses/content/aboutProcesses.js b/toolkit/components/aboutprocesses/content/aboutProcesses.js index b2212bcb98d7..941c0ae3ffc6 100644 --- a/toolkit/components/aboutprocesses/content/aboutProcesses.js +++ b/toolkit/components/aboutprocesses/content/aboutProcesses.js @@ -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 - _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); diff --git a/toolkit/components/aboutprocesses/tests/browser/browser_aboutprocesses.js b/toolkit/components/aboutprocesses/tests/browser/browser_aboutprocesses.js index 19f68676673f..3361f2cadab2 100644 --- a/toolkit/components/aboutprocesses/tests/browser/browser_aboutprocesses.js +++ b/toolkit/components/aboutprocesses/tests/browser/browser_aboutprocesses.js @@ -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); }); diff --git a/widget/tests/browser/browser_test_procinfo.js b/widget/tests/browser/browser_test_procinfo.js index 6672a1740afe..f7b5ecb66628 100644 --- a/widget/tests/browser/browser_test_procinfo.js +++ b/widget/tests/browser/browser_test_procinfo.js @@ -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",