author | Csoregi Natalia <ncsoregi@mozilla.com> |
Mon, 03 Aug 2020 20:31:35 +0300 | |
changeset 543144 | ea03df7a155432fc9cd0b4155c59a7a5dd97e6de |
parent 543143 | d7849eabe2b829d17b792d655e3868ddca7b2efc |
child 543145 | e0ac26d4e4a5634cc38ee21f489a61bef7d82570 |
push id | 123254 |
push user | ncsoregi@mozilla.com |
push date | Mon, 03 Aug 2020 17:32:44 +0000 |
treeherder | autoland@ea03df7a1554 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1647695 |
milestone | 81.0a1 |
backs out | 01b6951d0aaee040d5c51ef737046ea88cd9f7bb 1b1fa5dbd9bdf7d3579af6bcdb3a727e6ec9a777 0f097362abf86343710620aa61113434c294dc0e |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/chrome-webidl/ChromeUtils.webidl +++ b/dom/chrome-webidl/ChromeUtils.webidl @@ -549,17 +549,17 @@ dictionary ChildProcInfoDictionary { long long pid = 0; DOMString filename = ""; unsigned long long virtualMemorySize = 0; long long residentSetSize = 0; unsigned long long cpuUser = 0; 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"; }; dictionary ParentProcInfoDictionary { // System info long long pid = 0; DOMString filename = "";
--- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -1209,25 +1209,16 @@ HangMonitoredProcess::UserCanceled() { if (mActor) { uint32_t id = mHangData.get_PluginHangData().pluginId(); mActor->CleanupPluginHang(id, true); } 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(); } return true; }
--- a/dom/ipc/nsIHangReport.idl +++ b/dom/ipc/nsIHangReport.idl @@ -35,19 +35,16 @@ interface nsIHangReport : nsISupports // Duration of the hang so far. readonly attribute double hangDuration; readonly attribute AString addonId; // For PLUGIN_HANGs, this field contains information about the plugin. // 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(); // Terminate the slow script if it is still running. // Only valid for SLOW_SCRIPT reports. void terminateScript();
--- a/toolkit/components/aboutprocesses/content/aboutProcesses.css +++ b/toolkit/components/aboutprocesses/content/aboutProcesses.css @@ -37,42 +37,29 @@ body { min-width: 40em; background-color: var(--in-content-box-background); } tr { display: table; 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 { height: inherit; } #process-thead > tr > td { border: none; @@ -176,23 +163,16 @@ td { #process-tbody > tr.process { font-weight: bold; } #process-tbody > tr.thread { 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. */ #process-tbody > tr.separate-from-next-process-group { border-bottom: dotted 1px var(--in-content-box-border-color); margin-bottom: -1px; }
--- a/toolkit/components/aboutprocesses/content/aboutProcesses.js +++ b/toolkit/components/aboutprocesses/content/aboutProcesses.js @@ -21,18 +21,16 @@ const UPDATE_INTERVAL_MS = 2000; const MS_PER_NS = 1000000; const NS_PER_S = 1000000000; 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. * * Just returning a resolved Promise would mean that any `then` callbacks * would be called right after the end of the current turn, so `setTimeout` * is used to delay Promise resolution until the next turn. * * In mochi tests, it's possible for this to be called after the @@ -145,17 +143,16 @@ var State = { * Compute the delta between two process snapshots. * * @param {ProcessSnapshot} cur * @param {ProcessSnapshot?} prev */ _getProcessDelta(cur, prev) { let result = { pid: cur.pid, - childID: cur.childID, filename: cur.filename, totalVirtualMemorySize: cur.virtualMemorySize, deltaVirtualMemorySize: null, totalResidentSize: cur.residentSetSize, deltaResidentSize: null, totalCpuUser: cur.cpuUser, slopeCpuUser: null, totalCpuKernel: cur.cpuKernel, @@ -247,44 +244,41 @@ var View = { row.parentNode.insertBefore(this._fragment, row.nextSibling); this._fragment = document.createDocumentFragment(); }, /** * 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, { content: data.pid, classes: ["pid", "root"], }); 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, { content, classes: ["type"], }); } @@ -528,30 +522,24 @@ var View = { _setTextAndTooltip(elt, text, tooltip = text) { elt.textContent = text; elt.setAttribute("title", tooltip); }, }; 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) { while (row.nextSibling && row.nextSibling.classList.contains("thread")) { row.nextSibling.remove(); } }, init() { - this._initHangReports(); - let tbody = document.getElementById("process-tbody"); tbody.addEventListener("click", event => { this._updateLastMouseEvent(); // Handle showing or hiding subitems of a row. let target = event.target; if (target.classList.contains("twisty")) { let row = target.parentNode.parentNode; @@ -622,39 +610,16 @@ var Control = { await this._updateDisplay(true); }); }, _lastMouseEvent: 0, _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(); if (document.hidden) { return; } await wait(0); @@ -674,36 +639,23 @@ var Control = { let counters = State.getCounters(); // Reset the selectedRow field and the _openItems set each time we redraw // to avoid keeping forever references to dead processes. 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); latestRow = this._showChildren(processRow); } if ( this._sortColumn == null && previousProcess &&
--- a/toolkit/components/aboutprocesses/tests/browser/browser_aboutprocesses.js +++ b/toolkit/components/aboutprocesses/tests/browser/browser_aboutprocesses.js @@ -1,14 +1,14 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -const { AppConstants } = ChromeUtils.import( +let { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); // A bunch of assumptions we make about the behavior of the parent process, // and which we use as sanity checks. If Firefox evolves, we will need to // update these values. const HARDCODED_ASSUMPTIONS_PROCESS = { minimalNumberOfThreads: 10, @@ -228,58 +228,26 @@ function testMemory(string, total, delta Assert.ok( isCloseEnough(Math.abs(computedDelta), Math.abs(delta)), `The displayed approximation of the delta amount of memory is reasonable: ${computedDelta} vs ${delta}` ); } 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); // And wait for another update using a mutation observer, to give our newly created test tab some time // to burn some CPU. await new Promise(resolve => { let observer = new doc.ownerGlobal.MutationObserver(() => { observer.disconnect(); @@ -376,34 +344,13 @@ add_task(async function testAboutProcess info("Sanity checks: CPU (kernel)"); testCpu( cpuKernelContent, threadRow.thread.totalCpuKernel, threadRow.thread.slopeCpuKernel, 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); });
--- a/widget/tests/browser/browser_test_procinfo.js +++ b/widget/tests/browser/browser_test_procinfo.js @@ -44,26 +44,16 @@ add_task(async function test_proc_info() for (var i = 0; i < parentProc.children.length; i++) { let childProc = parentProc.children[i]; Assert.notEqual( childProc.type, "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", "Child proc type should be known" ); if (childProc.type == "webIsolated") { Assert.notEqual( childProc.origin || "",