Backed out 3 changesets (bug 1754015, bug 1754012) for causing failures on test_nsIX509CertValidity.js. CLOSED TREE

Backed out changeset 6928edee3bbc (bug 1754012)
Backed out changeset 6792032bd169 (bug 1754012)
Backed out changeset 8f11731d9aee (bug 1754015)
This commit is contained in:
criss 2022-02-08 13:42:46 +02:00
parent fd4de32944
commit b6a852be9b
3 changed files with 23 additions and 47 deletions

View File

@ -515,8 +515,8 @@ proto.rejects = function(promise, expected, message) {
};
function compareNumbers(expression, lhs, rhs, message, operator) {
let lhsIsNumber = typeof lhs == "number" && !Number.isNaN(lhs);
let rhsIsNumber = typeof rhs == "number" && !Number.isNaN(rhs);
let lhsIsNumber = typeof lhs == "number";
let rhsIsNumber = typeof rhs == "number";
if (lhsIsNumber && rhsIsNumber) {
this.report(expression, lhs, rhs, message, operator);

View File

@ -409,20 +409,6 @@ function run_test() {
}
assert.equal(message, "AssertionError: 2 <= 1");
try {
assert.greater(NaN, 0);
} catch (e) {
message = e.toString().split("\n")[0];
}
assert.equal(message, "AssertionError: 'NaN' is not a number");
try {
assert.greater(0, NaN);
} catch (e) {
message = e.toString().split("\n")[0];
}
assert.equal(message, "AssertionError: 'NaN' is not a number");
/* ---- stringMatches ---- */
assert.stringMatches("hello world", /llo\s/);
assert.stringMatches("hello world", "llo\\s");

View File

@ -11,39 +11,13 @@ const DUMMY_URL =
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const MAC = AppConstants.platform == "macosx";
const HAS_THREAD_NAMES =
AppConstants.platform != "win" ||
AppConstants.isPlatformAndVersionAtLeast("win", 10);
const isFissionEnabled = SpecialPowers.useRemoteSubframes;
const SAMPLE_SIZE = 10;
const NS_PER_MS = 1000000;
function checkProcessCpuTime(proc) {
Assert.greater(proc.cpuTime, 0, "Got some cpu time");
let cpuThreads = 0;
for (let thread of proc.threads) {
cpuThreads += Math.floor(thread.cpuTime / NS_PER_MS);
}
Assert.greater(cpuThreads, 0, "Got some cpu time in the threads");
let processCpuTime = Math.ceil(proc.cpuTime / NS_PER_MS);
if (AppConstants.platform == "win" && processCpuTime < cpuThreads) {
// On Windows, our test jobs likely run in VMs without constant TSC,
// so we might have low precision CPU time measurements.
const MAX_DISCREPENCY = 100;
Assert.ok(
cpuThreads - processCpuTime < MAX_DISCREPENCY,
`on Windows, we accept a discrepency of up to ${MAX_DISCREPENCY}ms between the process CPU time and the sum of its threads' CPU time, process CPU time: ${processCpuTime}, sum of thread CPU time: ${cpuThreads}`
);
} else {
Assert.greaterOrEqual(
processCpuTime,
cpuThreads,
"The total CPU time of the process should be at least the sum of the CPU time spent by the still alive threads"
);
}
}
add_task(async function test_proc_info() {
// Open a few `about:home` tabs, they'll end up in `privilegedabout`.
@ -58,9 +32,13 @@ add_task(async function test_proc_info() {
await BrowserTestUtils.withNewTab(
{ gBrowser, url: DUMMY_URL },
async function(browser) {
let cpuThreads = 0;
let cpuUser = 0;
// We test `SAMPLE_SIZE` times to increase a tad the chance of encountering race conditions.
for (let z = 0; z < SAMPLE_SIZE; z++) {
let parentProc = await ChromeUtils.requestProcInfo();
cpuUser += parentProc.cpuUser;
Assert.equal(
parentProc.type,
@ -68,7 +46,9 @@ add_task(async function test_proc_info() {
"Parent proc type should be browser"
);
checkProcessCpuTime(parentProc);
for (var x = 0; x < parentProc.threads.length; x++) {
cpuThreads += parentProc.threads[x].cpuUser;
}
// Under Windows, thread names appeared with Windows 10.
if (HAS_THREAD_NAMES) {
@ -86,7 +66,8 @@ add_task(async function test_proc_info() {
// that don't care whether we have a race condition and once to test that at
// least one well-known process that should not be able to vanish during
// the test respects all the invariants.
for (let childProc of parentProc.children) {
for (var i = 0; i < parentProc.children.length; i++) {
let childProc = parentProc.children[i];
Assert.notEqual(
childProc.type,
"browser",
@ -115,14 +96,18 @@ add_task(async function test_proc_info() {
);
}
checkProcessCpuTime(childProc);
for (var y = 0; y < childProc.threads.length; y++) {
cpuThreads += childProc.threads[y].cpuUser;
}
cpuUser += childProc.cpuUser;
}
// We only check other properties on the `privilegedabout` subprocess, which
// as of this writing is always active and available.
var hasPrivilegedAbout = false;
var numberOfAboutTabs = 0;
for (let childProc of parentProc.children) {
for (i = 0; i < parentProc.children.length; i++) {
let childProc = parentProc.children[i];
if (childProc.type != "privilegedabout") {
continue;
}
@ -159,6 +144,11 @@ add_task(async function test_proc_info() {
"We have found the privileged about process"
);
}
// see https://bugzilla.mozilla.org/show_bug.cgi?id=1529023
if (!MAC) {
Assert.greater(cpuThreads, 0, "Got some cpu time in the threads");
}
Assert.greater(cpuUser, 0, "Got some cpu time");
for (let tab of tabsAboutHome) {
BrowserTestUtils.removeTab(tab);