Bug 1780071 - autofix devtools/ violations of no-comparison-or-assignment-inside-ok r=profiler-reviewers,devtools-reviewers,julienw,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D198975
This commit is contained in:
Gijs Kruitbosch 2024-01-26 13:12:07 +00:00
parent 0356e30735
commit 671866b17f
208 changed files with 1112 additions and 628 deletions

View File

@ -115,8 +115,9 @@ add_task(async function testRemoteRuntime() {
function assertWarningMessage(doc, expectedMessage) {
const hasMessage = !!doc.querySelector(".qa-service-workers-warning");
ok(
hasMessage === expectedMessage,
Assert.strictEqual(
hasMessage,
expectedMessage,
expectedMessage
? "Warning message is displayed"
: "Warning message is not displayed"

View File

@ -45,8 +45,9 @@ add_task(async function () {
await waitForServiceWorkerRunning(SW_URL, document);
swPane = getDebugTargetPane("Service Workers", document);
ok(
swPane.querySelectorAll(".qa-debug-target-item").length === 1,
Assert.strictEqual(
swPane.querySelectorAll(".qa-debug-target-item").length,
1,
"Service worker list has one element"
);
ok(

View File

@ -47,8 +47,9 @@ function checkTelemetryEvents(expectedEvents, expectedSessionId) {
const sameExtrasEvents = sameMethodEvents.filter(e =>
_eventHasExpectedExtras(e, expectedEvent)
);
ok(
sameExtrasEvents.length === 1,
Assert.strictEqual(
sameExtrasEvents.length,
1,
"Found exactly one event matching the expected extras"
);
if (sameExtrasEvents.length === 0) {

View File

@ -25,8 +25,9 @@ add_task(async function () {
checkManifestMember(doc, "name", "Foo");
checkManifestMember(doc, "background_color", "#ff0000");
ok(
doc.querySelector(".js-manifest-issues") === null,
Assert.strictEqual(
doc.querySelector(".js-manifest-issues"),
null,
"No validation issues are being displayed"
);
@ -56,12 +57,16 @@ add_task(async function () {
checkManifestMember(doc, "background_color", "");
const issuesEl = doc.querySelector(".js-manifest-issues");
ok(issuesEl !== null, "Validation issues are displayed");
Assert.notStrictEqual(issuesEl, null, "Validation issues are displayed");
const warningEl = [...issuesEl.querySelectorAll(".js-manifest-issue")].find(
x => x.textContent.includes("background_color")
);
ok(warningEl !== null, "A warning about background_color is displayed");
Assert.notStrictEqual(
warningEl,
null,
"A warning about background_color is displayed"
);
// close the tab
info("Closing the tab.");
@ -83,12 +88,16 @@ add_task(async function () {
ok(true, "Manifest is being displayed");
const issuesEl = doc.querySelector(".js-manifest-issues");
ok(issuesEl !== null, "Validation issues are displayed");
Assert.notStrictEqual(issuesEl, null, "Validation issues are displayed");
const errorEl = [...issuesEl.querySelectorAll(".js-manifest-issue")].find(x =>
x.textContent.includes("JSON")
);
ok(errorEl !== null, "An error about JSON parsing is displayed");
Assert.notStrictEqual(
errorEl,
null,
"An error about JSON parsing is displayed"
);
// close the tab
info("Closing the tab.");
@ -111,9 +120,13 @@ add_task(async function () {
// assert manifest icon is being displayed
const iconEl = findMemberByLabel(doc, "128x128image/svg");
ok(iconEl !== null, "Icon label is being displayed with size and image type");
Assert.notStrictEqual(
iconEl,
null,
"Icon label is being displayed with size and image type"
);
const imgEl = iconEl.querySelector(".js-manifest-item-content img");
ok(imgEl !== null, "An image is displayed for the icon");
Assert.notStrictEqual(imgEl, null, "An image is displayed for the icon");
is(
imgEl.src,
URL_ROOT + "resources/manifest/icon.svg",

View File

@ -44,7 +44,7 @@ async function enableFirstBreakpoint(dbg) {
await addBreakpoint(dbg, "long.js", 32);
const bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
ok(bpMarkers.length === 2, "2 column breakpoints");
Assert.strictEqual(bpMarkers.length, 2, "2 column breakpoints");
assertClass(bpMarkers[0], "active");
assertClass(bpMarkers[1], "active", false);
}

View File

@ -123,7 +123,7 @@ async function enableFirstBreakpoint(dbg) {
await addBreakpoint(dbg, "long.js", 32);
const bpMarkers = await waitForAllElements(dbg, "columnBreakpoints");
ok(bpMarkers.length === 2, "2 column breakpoints");
Assert.strictEqual(bpMarkers.length, 2, "2 column breakpoints");
assertClass(bpMarkers[0], "active");
assertClass(bpMarkers[1], "active", false);
}

View File

@ -41,7 +41,7 @@ add_task(async function () {
info("Enable the breakpoint for the second debugger statement on line 12");
let bpElements = await waitForAllElements(dbg, "columnBreakpoints");
ok(bpElements.length === 2, "2 column breakpoints");
Assert.strictEqual(bpElements.length, 2, "2 column breakpoints");
assertClass(bpElements[0], "active");
assertClass(bpElements[1], "active", false);

View File

@ -37,7 +37,11 @@ add_task(async function () {
);
ok(process, "The remote debugger process was created");
ok(process.exitCode == null, "The remote debugger process is running");
Assert.equal(
process.exitCode,
null,
"The remote debugger process is running"
);
is(
typeof process.pid,
"number",

View File

@ -36,7 +36,11 @@ add_task(async function () {
await waitForPaused(dbg);
findElement(dbg, "frame", 1).focus();
await clickElement(dbg, "frame", 1);
ok(cm.getScrollInfo().top != 0, "frame scrolled down to correct location");
Assert.notEqual(
cm.getScrollInfo().top,
0,
"frame scrolled down to correct location"
);
info("Navigating while paused, goes to the correct location");
await selectSource(dbg, "long.js");

View File

@ -44,7 +44,7 @@ add_task(async function () {
);
const matchScrollTop = getScrollTop(dbg);
ok(pauseScrollTop != matchScrollTop, "did not jump to debug line");
Assert.notEqual(pauseScrollTop, matchScrollTop, "did not jump to debug line");
});
function getScrollTop(dbg) {

View File

@ -52,11 +52,12 @@ add_task(async function () {
await waitForSelectedSource(dbg, "bundle.js");
// Assert that reducer do have some data before remove the target.
ok(dbg.selectors.getSourceCount() > 0, "Some sources exists");
Assert.greater(dbg.selectors.getSourceCount(), 0, "Some sources exists");
is(dbg.selectors.getBreakpointCount(), 1, "There is one breakpoint");
is(dbg.selectors.getSourceTabs().length, 2, "Two tabs are opened");
ok(
dbg.selectors.getAllThreads().length > 1,
Assert.greater(
dbg.selectors.getAllThreads().length,
1,
"There is many targets/threads involved by the intergration test"
);
ok(
@ -69,8 +70,9 @@ add_task(async function () {
"The generated source is reporeted as selected"
);
ok(!!dbg.selectors.getFocusedSourceItem(), "Has a focused source tree item");
ok(
dbg.selectors.getExpandedState().size > 0,
Assert.greater(
dbg.selectors.getExpandedState().size,
0,
"Has some expanded source tree items"
);
@ -86,20 +88,24 @@ add_task(async function () {
"Some symbols for generated sources exists"
);
ok(!!Object.keys(state.ast.mutableInScopeLines).length, "Some scopes exists");
ok(
state.sourceActors.mutableSourceActors.size > 0,
Assert.greater(
state.sourceActors.mutableSourceActors.size,
0,
"Some source actor exists"
);
ok(
state.sourceActors.mutableBreakableLines.size > 0,
Assert.greater(
state.sourceActors.mutableBreakableLines.size,
0,
"Some breakable line exists"
);
ok(
state.sources.mutableBreakpointPositions.size > 0,
Assert.greater(
state.sources.mutableBreakpointPositions.size,
0,
"Some breakable positions exists"
);
ok(
state.sources.mutableOriginalBreakableLines.size > 0,
Assert.greater(
state.sources.mutableOriginalBreakableLines.size,
0,
"Some original breakable lines exists"
);

View File

@ -153,10 +153,14 @@ add_task(async function () {
let nodes = getAllLabels(dbg);
const originalNodesCount = nodes.length;
const targetNodeIndex = nodes.indexOf("target");
ok(targetNodeIndex > -1, "Found the target node");
Assert.greater(targetNodeIndex, -1, "Found the target node");
await toggleScopeNode(dbg, targetNodeIndex);
nodes = getAllLabels(dbg);
ok(nodes.length > originalNodesCount, "the target node was expanded");
Assert.greater(
nodes.length,
originalNodesCount,
"the target node was expanded"
);
ok(nodes.includes("classList"), "classList is displayed");
await resume(dbg);

View File

@ -63,5 +63,5 @@ function findNodeValue(dbg, text) {
async function checkObjectNode(dbg, text, value) {
await toggleNode(dbg, text);
ok(findNodeValue(dbg, "a") == value, "object value");
Assert.equal(findNodeValue(dbg, "a"), value, "object value");
}

View File

@ -23,7 +23,7 @@ add_task(async function () {
invokeInTab("webpack3Babel6EsmodulesCjs");
await waitForPaused(dbg);
ok(getOriginalScope(dbg) != null, "Scopes are now mapped");
Assert.notEqual(getOriginalScope(dbg), null, "Scopes are now mapped");
ok(!findFooterNotificationMessage(dbg), "No footer notification message");
await assertPreviewTextValue(dbg, 20, 20, {

View File

@ -23,8 +23,8 @@ add_task(async function test() {
// We step past the 'let x' at the start of the function because it is not
// a breakpoint position.
ok(findNodeValue(dbg, "x") == "undefined", "x undefined");
ok(findNodeValue(dbg, "y") == "(uninitialized)", "y uninitialized");
Assert.equal(findNodeValue(dbg, "x"), "undefined", "x undefined");
Assert.equal(findNodeValue(dbg, "y"), "(uninitialized)", "y uninitialized");
await stepOver(dbg);
@ -34,7 +34,7 @@ add_task(async function test() {
9
);
ok(findNodeValue(dbg, "y") == "3", "y initialized");
Assert.equal(findNodeValue(dbg, "y"), "3", "y initialized");
});
function findNodeValue(dbg, text) {

View File

@ -15,7 +15,7 @@ add_task(async function () {
await waitForThreadCount(dbg, 2);
const workers = dbg.selectors.getThreads();
ok(workers.length == 2, "Got two workers");
Assert.equal(workers.length, 2, "Got two workers");
const thread1 = workers[0].actor;
const thread2 = workers[1].actor;
@ -43,7 +43,7 @@ add_task(async function () {
await addExpression(dbg, "count");
is(getWatchExpressionLabel(dbg, 1), "count");
const v = getWatchExpressionValue(dbg, 1);
ok(v == `${+v}`, "Value of count should be a number");
Assert.equal(v, `${+v}`, "Value of count should be a number");
info("StepOver in the first worker");
await stepOver(dbg);

View File

@ -11,5 +11,5 @@ add_task(async function () {
await waitForThreadCount(dbg, 2);
const workers = dbg.selectors.getThreads();
ok(workers.length == 2, "Got two workers");
Assert.equal(workers.length, 2, "Got two workers");
});

View File

@ -22,22 +22,22 @@ add_task(async function () {
assertPausedAtSourceAndLine(dbg, workerSource2.id, 11);
await toggleNode(dbg, "var_array");
ok(findNodeValue(dbg, "0") == '"mango"', "array elem0");
ok(findNodeValue(dbg, "1") == '"pamplemousse"', "array elem1");
ok(findNodeValue(dbg, "2") == '"pineapple"', "array elem2");
Assert.equal(findNodeValue(dbg, "0"), '"mango"', "array elem0");
Assert.equal(findNodeValue(dbg, "1"), '"pamplemousse"', "array elem1");
Assert.equal(findNodeValue(dbg, "2"), '"pineapple"', "array elem2");
await toggleNode(dbg, "var_array");
await toggleNode(dbg, "var_tarray");
ok(findNodeValue(dbg, "0") == "42", "tarray elem0");
ok(findNodeValue(dbg, "1") == "43", "tarray elem1");
ok(findNodeValue(dbg, "2") == "44", "tarray elem2");
Assert.equal(findNodeValue(dbg, "0"), "42", "tarray elem0");
Assert.equal(findNodeValue(dbg, "1"), "43", "tarray elem1");
Assert.equal(findNodeValue(dbg, "2"), "44", "tarray elem2");
await toggleNode(dbg, "var_tarray");
await toggleNode(dbg, "var_set");
await toggleNode(dbg, "<entries>");
ok(findNodeValue(dbg, "0") == '"papaya"', "set elem0");
ok(findNodeValue(dbg, "1") == '"banana"', "set elem1");
Assert.equal(findNodeValue(dbg, "0"), '"papaya"', "set elem0");
Assert.equal(findNodeValue(dbg, "1"), '"banana"', "set elem1");
await toggleNode(dbg, "var_set");
await toggleNode(dbg, "var_map");

View File

@ -60,7 +60,11 @@ add_task(async function () {
i++,
`index ${name} is correct and sorted into the correct position`
);
ok(typeof row.name === "number", "array index is displayed as a number");
Assert.strictEqual(
typeof row.name,
"number",
"array index is displayed as a number"
);
is(TEST_ARRAY[name], row.value, `value for array[${name}] is ${row.value}`);
}
});

View File

@ -22,7 +22,7 @@ add_task(async function () {
const inspector = toolbox.getPanel("inspector");
const openInInspectorIcon = node.querySelector(".open-inspector");
ok(node !== null, "Node was logged as expected");
Assert.notStrictEqual(node, null, "Node was logged as expected");
info(
"Clicking on the inspector icon and waiting for the " +

View File

@ -52,8 +52,9 @@ add_task(async function () {
null,
"With Fission or server side target switching, example.com target front is destroyed"
);
ok(
comTabTarget != newTarget,
Assert.notEqual(
comTabTarget,
newTarget,
"With Fission or server side target switching, a new target was created for example.org"
);

View File

@ -38,8 +38,9 @@ add_task(async function () {
);
iframe.style.height = "10000px"; // Set height to something unreasonably large.
ok(
iframe.clientHeight < panelHeight,
Assert.less(
iframe.clientHeight,
panelHeight,
`The iframe fits within the available space (${iframe.clientHeight} < ${panelHeight})`
);
@ -54,8 +55,9 @@ add_task(async function () {
const oldWidth = iframe.style.width;
iframe.style.width = "10000px"; // Set width to something unreasonably large.
ok(
iframe.clientWidth < panelWidth,
Assert.less(
iframe.clientWidth,
panelWidth,
`The iframe fits within the available space (${iframe.clientWidth} < ${panelWidth})`
);
iframe.style.width = oldWidth;

View File

@ -26,8 +26,9 @@ add_task(async function () {
const menuDockToBottom = toolbox.doc.getElementById(
"toolbox-meatball-menu-dock-bottom"
);
ok(
menuDockToBottom.getAttribute("aria-checked") === "true",
Assert.strictEqual(
menuDockToBottom.getAttribute("aria-checked"),
"true",
"menuDockToBottom has checked"
);

View File

@ -115,8 +115,9 @@ async function testJSDisabled() {
const output = doc.getElementById("output");
doc.querySelector("#logJSDisabled").click();
ok(
output.textContent !== "JavaScript Disabled",
Assert.notStrictEqual(
output.textContent,
"JavaScript Disabled",
'output is not "JavaScript Disabled"'
);
});
@ -131,8 +132,9 @@ async function testJSDisabledIframe() {
const iframeDoc = iframe.contentDocument;
const output = iframeDoc.getElementById("output");
iframeDoc.querySelector("#logJSDisabled").click();
ok(
output.textContent !== "JavaScript Disabled",
Assert.notStrictEqual(
output.textContent,
"JavaScript Disabled",
'output is not "JavaScript Disabled" in iframe'
);
});

View File

@ -95,7 +95,7 @@ async function checkResults() {
const expected = DATA[i];
// ignore timestamp
ok(timestamp > 0, "timestamp is greater than 0");
Assert.greater(timestamp, 0, "timestamp is greater than 0");
is(category, expected.category, "category is correct");
is(method, expected.method, "method is correct");
is(object, expected.object, "object is correct");

View File

@ -136,7 +136,7 @@ async function checkResults() {
const expected = DATA[i];
// ignore timestamp
ok(timestamp > 0, "timestamp is greater than 0");
Assert.greater(timestamp, 0, "timestamp is greater than 0");
is(category, expected.category, "category is correct");
is(method, expected.method, "method is correct");
is(object, expected.object, "object is correct");

View File

@ -113,7 +113,7 @@ async function checkResults() {
const expected = DATA[i];
// ignore timestamp
ok(timestamp > 0, "timestamp is greater than 0");
Assert.greater(timestamp, 0, "timestamp is greater than 0");
is(category, expected.category, "category is correct");
is(method, expected.method, "method is correct");
is(object, expected.object, "object is correct");

View File

@ -44,8 +44,9 @@ add_task(async function () {
const initialTabCount = toolbox.doc.querySelectorAll(".devtools-tab").length;
// Make all toolbox button to be visible.
setToolboxButtonsVisibility(checkButtons, true);
ok(
toolbox.doc.querySelectorAll(".devtools-tab").length < initialTabCount,
Assert.less(
toolbox.doc.querySelectorAll(".devtools-tab").length,
initialTabCount,
"Count of shown devtools tab should decreased"
);

View File

@ -78,8 +78,16 @@ add_task(async function () {
// vertical: IntID::ContextMenuOffsetVertical of macOS uses -6.
const xDelta = Math.abs(menuBounds.left - buttonBounds.left);
const yDelta = Math.abs(menuBounds.top - buttonBounds.bottom);
ok(xDelta < 2, "xDelta is lower than 2: " + xDelta + ". #" + menu.id);
ok(yDelta < 6, "yDelta is lower than 6: " + yDelta + ". #" + menu.id);
Assert.less(
xDelta,
2,
"xDelta is lower than 2: " + xDelta + ". #" + menu.id
);
Assert.less(
yDelta,
6,
"yDelta is lower than 6: " + yDelta + ". #" + menu.id
);
}
break;
@ -90,8 +98,9 @@ add_task(async function () {
const buttonCenter = buttonBounds.left + buttonBounds.width / 2;
const arrowCenter = arrowBounds.left + arrowBounds.width / 2;
const delta = Math.abs(arrowCenter - buttonCenter);
ok(
Math.round(delta) <= 1,
Assert.lessOrEqual(
Math.round(delta),
1,
"Center of arrow is within 1px of button center" +
` (delta: ${delta})`
);

View File

@ -41,9 +41,9 @@ add_task(async function () {
info("Checking timeline tick item elements after enlarge sidebar width");
await setSidebarWidth("100%", inspector);
await assertTickLabels(timeScale, listContainerEl);
ok(
timelineTickItemLength <
listContainerEl.querySelectorAll(".tick-label").length,
Assert.less(
timelineTickItemLength,
listContainerEl.querySelectorAll(".tick-label").length,
"The timeline tick item elements should increase"
);
});

View File

@ -25,9 +25,9 @@ add_task(async function () {
info("Check existed animations have different currentTime");
const animations = animationInspector.state.animations;
ok(
animations[0].state.currentTime + WAIT_TIME >
animations[1].state.currentTime,
Assert.greater(
animations[0].state.currentTime + WAIT_TIME,
animations[1].state.currentTime,
`The currentTime of added animation shold be ${WAIT_TIME}ms less than ` +
"at least that currentTime of first animation"
);

View File

@ -32,8 +32,9 @@ add_task(async function () {
const barBounds = barEl.getBoundingClientRect();
const barX = barBounds.x + barBounds.width / 2 - controllerBounds.x;
const expectedBarX = controllerBounds.width * 0.5;
ok(
Math.abs(barX - expectedBarX) < 1,
Assert.less(
Math.abs(barX - expectedBarX),
1,
"Progress bar should indicate at progress of 0.5"
);
});

View File

@ -60,8 +60,9 @@ function assertPlayState(animations, expectedState) {
function assertCurrentTimeLessThanDuration(animations) {
animations.forEach((animation, index) => {
ok(
animation.state.currentTime < animation.state.duration,
Assert.less(
animation.state.currentTime,
animation.state.duration,
`The current time of animation[${index}] should be less than its duration`
);
});
@ -70,8 +71,9 @@ function assertCurrentTimeLessThanDuration(animations) {
function assertScrubberPosition(panel) {
const scrubberEl = panel.querySelector(".current-time-scrubber");
const marginInlineStart = parseFloat(scrubberEl.style.marginInlineStart);
ok(
marginInlineStart >= 0,
Assert.greaterOrEqual(
marginInlineStart,
0,
"The translateX of scrubber position should be zero or more"
);
}

View File

@ -23,15 +23,16 @@ add_task(async function () {
animationInspector,
animationInspector.state.timeScale.getDuration() * 0.5
);
ok(
initialCurrentTime >
animationInspector.state.animations[0].state.currentTime,
Assert.greater(
initialCurrentTime,
animationInspector.state.animations[0].state.currentTime,
"currentTime should be decreased"
);
info("Check whether the progress bar was moved to left");
ok(
initialProgressBarX > getProgressBarX(panel),
Assert.greater(
initialProgressBarX,
getProgressBarX(panel),
"Progress bar should be moved to left"
);
});

View File

@ -1023,8 +1023,9 @@ function checkAdjustingTheTime(animation1, animation2) {
animation2.currentTime / animation2.playbackRate -
animation1.currentTime / animation1.playbackRate;
const createdTimeDiff = animation1.createdTime - animation2.createdTime;
ok(
Math.abs(adjustedCurrentTimeDiff - createdTimeDiff) < 0.1,
Assert.less(
Math.abs(adjustedCurrentTimeDiff - createdTimeDiff),
0.1,
"Adjusted time is correct"
);
}

View File

@ -42,5 +42,5 @@ add_task(async function () {
const sym = Symbol();
const onTimeout = wait(500).then(() => sym);
const raceResult = await Promise.any([onResetChanges, onTimeout]);
ok(raceResult === sym, "RESET_CHANGES has not been dispatched");
Assert.strictEqual(raceResult, sym, "RESET_CHANGES has not been dispatched");
});

View File

@ -27,7 +27,7 @@ add_task(async function () {
// Check that the outline is wider than it is tall in the configuration.
let bounds = flexOutline.getBoxQuads()[0].getBounds();
ok(bounds.width > bounds.height, "The outline looks like a row");
Assert.greater(bounds.width, bounds.height, "The outline looks like a row");
// Select a flex item in the column flexbox layout.
onFlexItemOutlineRendered = waitForDOM(
@ -45,5 +45,9 @@ add_task(async function () {
// Check that the outline is taller than it is wide in the configuration.
bounds = flexOutline.getBoxQuads()[0].getBounds();
ok(bounds.height > bounds.width, "The outline looks like a column");
Assert.greater(
bounds.height,
bounds.width,
"The outline looks like a column"
);
});

View File

@ -14,9 +14,10 @@ add_task(async function () {
await selectNode(".input-field", inspector);
const fontEls = getUsedFontsEls(viewDoc);
ok(fontEls.length == 1, `Used fonts found for styled input element`);
ok(
fontEls[0].textContent == "Ostrich Sans Medium",
Assert.equal(fontEls.length, 1, `Used fonts found for styled input element`);
Assert.equal(
fontEls[0].textContent,
"Ostrich Sans Medium",
`Proper font found: 'Ostrich Sans Medium' for styled input.`
);
});

View File

@ -29,7 +29,7 @@ add_task(async function () {
});
const bottomScrollPos = await waitForScrollStop(markup.doc);
ok(bottomScrollPos > 0, "The view was scrolled down");
Assert.greater(bottomScrollPos, 0, "The view was scrolled down");
info("Simulate a mousemove at the top and expect more scrolling");
@ -40,7 +40,7 @@ add_task(async function () {
});
const topScrollPos = await waitForScrollStop(markup.doc);
ok(topScrollPos < bottomScrollPos, "The view was scrolled up");
Assert.less(topScrollPos, bottomScrollPos, "The view was scrolled up");
is(topScrollPos, 0, "The view was scrolled up to the top");
info("Simulate a mouseup to stop dragging");

View File

@ -28,7 +28,7 @@ add_task(async function () {
});
const bottomScrollPos = await waitForScrollStop(markup.doc);
ok(bottomScrollPos > 0, "The view was scrolled down");
Assert.greater(bottomScrollPos, 0, "The view was scrolled down");
info("Simulate a mousemove at the top and expect more scrolling");
markup._onMouseMove({
@ -38,7 +38,7 @@ add_task(async function () {
});
const topScrollPos = await waitForScrollStop(markup.doc);
ok(topScrollPos < bottomScrollPos, "The view was scrolled up");
Assert.less(topScrollPos, bottomScrollPos, "The view was scrolled up");
is(topScrollPos, 0, "The view was scrolled up to the top");
info("Simulate a mouseup to stop dragging");

View File

@ -197,8 +197,9 @@ const TEST_DATA = [
const container = await getContainerForSelector("#node1", inspector);
ok(!container.inlineTextChild, "Does not have single text child.");
ok(container.canExpand, "Can expand container with child nodes.");
ok(
container.editor.elt.querySelector(".text") == null,
Assert.equal(
container.editor.elt.querySelector(".text"),
null,
"Single text child editor removed."
);
},
@ -229,8 +230,9 @@ const TEST_DATA = [
const container = await getContainerForSelector("#node1", inspector);
ok(!container.inlineTextChild, "Does not have single text child.");
ok(!container.canExpand, "Can't expand empty container.");
ok(
container.editor.elt.querySelector(".text") == null,
Assert.equal(
container.editor.elt.querySelector(".text"),
null,
"Single text child editor removed."
);
},

View File

@ -19,16 +19,18 @@ add_task(async function () {
inspector
);
info("Checking the clipPath element");
ok(
clipPathContainer.editor.tag.textContent === "clipPath",
Assert.strictEqual(
clipPathContainer.editor.tag.textContent,
"clipPath",
"clipPath node name is not lowercased"
);
const divContainer = await getContainerForSelector("div", inspector);
info("Checking the div element");
ok(
divContainer.editor.tag.textContent === "div",
Assert.strictEqual(
divContainer.editor.tag.textContent,
"div",
"div node name is lowercased"
);
});

View File

@ -35,8 +35,9 @@ add_task(async function () {
inspector
);
info("Checking the clipPath element");
ok(
clipPathContainer.editor.tag.textContent === "svg:clipPath",
Assert.strictEqual(
clipPathContainer.editor.tag.textContent,
"svg:clipPath",
"svg:clipPath node is correctly displayed"
);
@ -45,8 +46,9 @@ add_task(async function () {
inspector
);
info("Checking the circle element");
ok(
circlePathContainer.editor.tag.textContent === "svg:circle",
Assert.strictEqual(
circlePathContainer.editor.tag.textContent,
"svg:circle",
"svg:circle node is correctly displayed"
);
});

View File

@ -64,8 +64,9 @@ add_task(async function () {
EventUtils.synthesizeKey("KEY_Tab", {}, win);
await tagFocused;
ok(
inspector.markup.doc.activeElement === tagSpan,
Assert.strictEqual(
inspector.markup.doc.activeElement,
tagSpan,
"Focus has gone back to first element"
);
});

View File

@ -38,8 +38,9 @@ add_task(async function () {
const iframe = await getNodeFront("iframe", inspector);
const { nodes } = await inspector.walker.children(iframe);
const documentFront = nodes[0];
ok(
documentFront.displayName === "#document",
Assert.strictEqual(
documentFront.displayName,
"#document",
"First child of IFRAME is #document"
);

View File

@ -16,8 +16,9 @@ add_task(async function () {
!editor.elt.classList.contains("void-element"),
"h1 element does not have void-element class"
);
ok(
!editor.elt.querySelector(".close").style.display !== "none",
Assert.notStrictEqual(
!editor.elt.querySelector(".close").style.display,
"none",
"h1 element tag is not hidden"
);
@ -29,7 +30,11 @@ add_task(async function () {
);
let closeElement = container.editor.elt.querySelector(".close");
let computedStyle = win.getComputedStyle(closeElement);
ok(computedStyle.display === "none", "img closing tag is hidden");
Assert.strictEqual(
computedStyle.display,
"none",
"img closing tag is hidden"
);
info("check void element with pseudo element");
const hrNodeFront = await getNodeFront("hr.before", inspector);
@ -40,12 +45,16 @@ add_task(async function () {
);
closeElement = container.editor.elt.querySelector(".close");
computedStyle = win.getComputedStyle(closeElement);
ok(computedStyle.display === "none", "hr closing tag is hidden");
Assert.strictEqual(computedStyle.display, "none", "hr closing tag is hidden");
info("check expanded void element closing tag is not hidden");
await inspector.markup.expandNode(hrNodeFront);
await waitForMultipleChildrenUpdates(inspector);
ok(container.expanded, "hr container is expanded");
computedStyle = win.getComputedStyle(closeElement);
ok(computedStyle.display === "none", "hr closing tag is not hidden anymore");
Assert.strictEqual(
computedStyle.display,
"none",
"hr closing tag is not hidden anymore"
);
});

View File

@ -16,8 +16,9 @@ add_task(async function () {
!editor.elt.classList.contains("void-element"),
"h1 element does not have void-element class"
);
ok(
!editor.elt.querySelector(".close").style.display !== "none",
Assert.notStrictEqual(
!editor.elt.querySelector(".close").style.display,
"none",
"h1 element tag is not hidden"
);
@ -29,5 +30,9 @@ add_task(async function () {
);
const closeElement = container.editor.elt.querySelector(".close");
const computedStyle = win.getComputedStyle(closeElement);
ok(computedStyle.display !== "none", "br closing tag is not hidden");
Assert.notStrictEqual(
computedStyle.display,
"none",
"br closing tag is not hidden"
);
});

View File

@ -175,8 +175,9 @@ async function checkEventsForNode(test, inspector) {
const shouldBeDisabled =
expected[i].attributes?.includes("React") ||
expected[i].attributes?.includes("jQuery");
ok(
disabled === shouldBeDisabled,
Assert.strictEqual(
disabled,
shouldBeDisabled,
`The checkbox is ${shouldBeDisabled ? "disabled" : "enabled"}\n`
);

View File

@ -60,7 +60,7 @@ add_task(async function () {
info("Check that UP/DOWN navigates in the input, even when next to a number");
EventUtils.synthesizeKey("VK_DOWN", {}, view.styleWindow);
ok(editor.input.selectionStart !== pos, "Input caret moved");
Assert.notStrictEqual(editor.input.selectionStart, pos, "Input caret moved");
is(editor.input.value, LONG_CSS_VALUE, "Input value was not decremented.");
info("Move the caret to the end of the gradient definition.");

View File

@ -184,9 +184,9 @@ function assertContainerQueryData(view, expectedRules) {
expectedRule.ancestorRulesData.join("\n"),
`Expected ancestor rules data displayed for ${selector}`
);
ok(
ancestorDataEl.querySelector(".container-query .open-inspector") !==
null,
Assert.notStrictEqual(
ancestorDataEl.querySelector(".container-query .open-inspector"),
null,
"An icon is displayed to select the container in the markup view"
);
}

View File

@ -157,7 +157,7 @@ function checkResults() {
const expected = DATA[i];
// ignore timestamp
ok(timestamp > 0, "timestamp is greater than 0");
Assert.greater(timestamp, 0, "timestamp is greater than 0");
is(category, expected.category, "category is correct");
is(method, expected.method, "method is correct");
is(object, expected.object, "object is correct");

View File

@ -111,8 +111,9 @@ add_task(async function () {
flexboxToggle.classList.contains("active"),
"Flexbox highlighter toggle is active."
);
ok(
getNodeForActiveHighlighter(HIGHLIGHTER_TYPE) != firstFlexboxHighterShown,
Assert.notEqual(
getNodeForActiveHighlighter(HIGHLIGHTER_TYPE),
firstFlexboxHighterShown,
"Flexbox highlighter for the second flexbox container is shown."
);

View File

@ -112,8 +112,9 @@ add_task(async function () {
gridToggle.classList.contains("active"),
"Grid highlighter toggle is active."
);
ok(
highlighters.gridHighlighters.keys().next().value != firstGridHighterShown,
Assert.notEqual(
highlighters.gridHighlighters.keys().next().value,
firstGridHighterShown,
"Grid highlighter for the second grid container is shown."
);

View File

@ -51,8 +51,9 @@ async function testExplicitNamedAreas(inspector, view) {
"Check that the expected grid line column names are shown in the editor popup."
);
for (const lineName of gridColLines) {
ok(
editor.gridLineNames.cols.indexOf(lineName) > -1,
Assert.greater(
editor.gridLineNames.cols.indexOf(lineName),
-1,
`${lineName} is a suggested implicit grid line`
);
}
@ -87,8 +88,9 @@ async function testImplicitNamedAreasWithExplicitGridLineNames(
"Check that the expected grid line row names are shown in the editor popup."
);
for (const lineName of gridRowLines) {
ok(
editor.gridLineNames.rows.indexOf(lineName) > -1,
Assert.greater(
editor.gridLineNames.rows.indexOf(lineName),
-1,
`${lineName} is a suggested explicit grid line`
);
}

View File

@ -86,12 +86,14 @@ async function assertKeyframeRules(selector, inspector, view, expected) {
let i = 0;
for (const keyframeRule of rules.keyframeRules) {
ok(
keyframeRule.keyframes.name == expected.keyframesRules[i],
Assert.equal(
keyframeRule.keyframes.name,
expected.keyframesRules[i],
keyframeRule.keyframes.name + " has the correct keyframes name"
);
ok(
keyframeRule.domRule.keyText == expected.keyframeRules[i],
Assert.equal(
keyframeRule.domRule.keyText,
expected.keyframeRules[i],
keyframeRule.domRule.keyText + " selector heading is correct"
);
i++;

View File

@ -66,8 +66,9 @@ add_task(async function () {
);
const ruleviewContainer =
view.styleDocument.getElementById("ruleview-container");
ok(
ruleviewContainer.scrollHeight === ruleviewContainer.clientHeight,
Assert.strictEqual(
ruleviewContainer.scrollHeight,
ruleviewContainer.clientHeight,
"The ruleview container does not have a scrollbar"
);
});

View File

@ -75,12 +75,14 @@ add_task(async function () {
info(
`Image preview dimensions: ${tooltipRect.width} x ${tooltipRect.height}`
);
ok(
tooltipRect.height > originalHeight,
Assert.greater(
tooltipRect.height,
originalHeight,
"Tooltip is taller for image preview"
);
ok(
tooltipRect.width < originalWidth,
Assert.less(
tooltipRect.width,
originalWidth,
"Tooltip is narrower for image preview"
);
await assertTooltipHiddenOnMouseOut(previewTooltip, colorVariableElement);

View File

@ -19,8 +19,9 @@ add_task(async function () {
await selectNode(testdiv, inspector);
const htmlBefore = view.element.innerHTML;
ok(
htmlBefore.indexOf("font-size") > -1,
Assert.greater(
htmlBefore.indexOf("font-size"),
-1,
"The rule view should contain a font-size property."
);

View File

@ -43,12 +43,14 @@ function checkRuleViewRuleMarkupOrder(view, selectorText, index = 0) {
const parentNode = selectorContainer.parentNode;
const childNodes = [...parentNode.childNodes];
ok(
childNodes.indexOf(selectorContainer) < childNodes.indexOf(highlighterIcon),
Assert.less(
childNodes.indexOf(selectorContainer),
childNodes.indexOf(highlighterIcon),
"Selector text is rendered before the highlighter icon"
);
ok(
childNodes.indexOf(highlighterIcon) < childNodes.indexOf(ruleOpenBrace),
Assert.less(
childNodes.indexOf(highlighterIcon),
childNodes.indexOf(ruleOpenBrace),
"Highlighter icon is rendered before the opening brace"
);
}

View File

@ -101,15 +101,17 @@ async function assertSelectorWarnings({
);
if (expectedWarnings.length === 0) {
ok(
selectorWarningsContainerEl === null,
Assert.strictEqual(
selectorWarningsContainerEl,
null,
`"${selectorText}" does not have warnings`
);
return;
}
ok(
selectorWarningsContainerEl !== null,
Assert.notStrictEqual(
selectorWarningsContainerEl,
null,
`"${selectorText}" does have warnings`
);

View File

@ -106,8 +106,9 @@ add_task(async function () {
shapeToggle.classList.contains("active"),
"shapes highlighter toggle is active."
);
ok(
highlighters.shapesHighlighterShown != firstShapesHighlighterShown,
Assert.notEqual(
highlighters.shapesHighlighterShown,
firstShapesHighlighterShown,
"shapes highlighter for the second shapes container is shown."
);

View File

@ -119,7 +119,7 @@ async function userAgentStylesVisible(inspector, view) {
userRules = view._elementStyle.rules.filter(rule => rule.editor.isEditable);
uaRules = view._elementStyle.rules.filter(rule => !rule.editor.isEditable);
is(userRules.length, data.numUserRules, "Correct number of user rules");
ok(uaRules.length > data.numUARules, "Has UA rules");
Assert.greater(uaRules.length, data.numUARules, "Has UA rules");
}
ok(

View File

@ -41,12 +41,14 @@ async function testImageDimension(ruleView) {
const imageRect = panel.querySelector("img").getBoundingClientRect();
const panelRect = panel.getBoundingClientRect();
ok(
panelRect.width >= imageRect.width,
Assert.greaterOrEqual(
panelRect.width,
imageRect.width,
"The panel is wide enough to show the image"
);
ok(
panelRect.height >= imageRect.height,
Assert.greaterOrEqual(
panelRect.height,
imageRect.height,
"The panel is high enough to show the image"
);
@ -69,12 +71,14 @@ async function testPickerDimension(ruleView) {
const spectrumRect = cPicker.spectrum.element.getBoundingClientRect();
const panelRect = cPicker.tooltip.container.getBoundingClientRect();
ok(
panelRect.width >= spectrumRect.width,
Assert.greaterOrEqual(
panelRect.width,
spectrumRect.width,
"The panel is wide enough to show the picker"
);
ok(
panelRect.height >= spectrumRect.height,
Assert.greaterOrEqual(
panelRect.height,
spectrumRect.height,
"The panel is high enough to show the picker"
);

View File

@ -50,8 +50,9 @@ add_task(async function () {
await onHighlighterHidden;
ok(true, "Highlighter was shown and hidden");
ok(
delay >= inspector.HIGHLIGHTER_AUTOHIDE_TIMER,
Assert.greaterOrEqual(
delay,
inspector.HIGHLIGHTER_AUTOHIDE_TIMER,
`Highlighter was hidden after expected delay (${delay}ms)`
);

View File

@ -20,7 +20,11 @@ add_task(async function () {
async function manyInstancesOfCustomHighlighters({ inspectorFront }) {
const h1 = await inspectorFront.getHighlighterByType("BoxModelHighlighter");
const h2 = await inspectorFront.getHighlighterByType("BoxModelHighlighter");
ok(h1 !== h2, "getHighlighterByType returns new instances every time (1)");
Assert.notStrictEqual(
h1,
h2,
"getHighlighterByType returns new instances every time (1)"
);
const h3 = await inspectorFront.getHighlighterByType(
"CssTransformHighlighter"
@ -28,7 +32,11 @@ async function manyInstancesOfCustomHighlighters({ inspectorFront }) {
const h4 = await inspectorFront.getHighlighterByType(
"CssTransformHighlighter"
);
ok(h3 !== h4, "getHighlighterByType returns new instances every time (2)");
Assert.notStrictEqual(
h3,
h4,
"getHighlighterByType returns new instances every time (2)"
);
ok(
h3 !== h1 && h3 !== h2,
"getHighlighterByType returns new instances every time (3)"

View File

@ -66,7 +66,7 @@ add_task(async function () {
// SVG stroke seems to impact boundingClientRect differently depending on platform/hardware.
// Let's assert that the delta is okay, and use it for the different assertions.
const delta = wrapperX + wrapperWidth * 0.2 - rect.x;
ok(Math.abs(delta) <= 1, `delta is <=1 (${Math.abs(delta)})`);
Assert.lessOrEqual(Math.abs(delta), 1, `delta is <=1 (${Math.abs(delta)})`);
// Coming from inset(10% 20%)
let inlineOffset = 0.2 * wrapperWidth - delta;
@ -161,27 +161,30 @@ add_task(async function () {
inlineOffset = 0.2 * viewportClientRect.width - delta;
blockOffset = 0.1 * viewportClientRect.height - delta;
ok(
Math.abs(absRect.x - (viewportClientRect.x + inlineOffset)) < 1,
Assert.less(
Math.abs(absRect.x - (viewportClientRect.x + inlineOffset)),
1,
`Rect approximately has expected x (got ${absRect.x}, expected ${
viewportClientRect.x + inlineOffset
})`
);
ok(
Math.abs(absRect.y - (viewportClientRect.y + blockOffset)) < 1,
Assert.less(
Math.abs(absRect.y - (viewportClientRect.y + blockOffset)),
1,
`Rect approximately has expected y (got ${absRect.y}, expected ${
viewportClientRect.y + blockOffset
})`
);
ok(
Math.abs(absRect.width - (viewportClientRect.width - inlineOffset * 2)) < 1,
Assert.less(
Math.abs(absRect.width - (viewportClientRect.width - inlineOffset * 2)),
1,
`Rect approximately has expected width (got ${absRect.width}, expected ${
viewportClientRect.width - inlineOffset * 2
})`
);
ok(
Math.abs(absRect.height - (viewportClientRect.height - blockOffset * 2)) <
1,
Assert.less(
Math.abs(absRect.height - (viewportClientRect.height - blockOffset * 2)),
1,
`Rect approximately has expected height (got ${absRect.height}, expected ${
viewportClientRect.height - blockOffset * 2
})`

View File

@ -70,7 +70,7 @@ add_task(async function () {
const nb = await highlighterTestFront.getSelectorHighlighterBoxNb(
highlighter.actorID
);
ok(nb !== null, "The number of highlighters was retrieved");
Assert.notStrictEqual(nb, null, "The number of highlighters was retrieved");
is(nb, containerCount, "The correct number of highlighers were created");
await highlighter.hide();

View File

@ -75,7 +75,7 @@ add_task(async function () {
const nb = await highlighterTestFront.getSelectorHighlighterBoxNb(
highlighter.actorID
);
ok(nb !== null, "The number of highlighters was retrieved");
Assert.notStrictEqual(nb, null, "The number of highlighters was retrieved");
is(nb, containerCount, "The correct number of highlighers were created");
await highlighter.hide();

View File

@ -102,8 +102,9 @@ add_task(async function () {
info("Waiting for mutation to occur");
await onMutation;
ok(
(await getInnerHTML()) === clipboard.getText(),
Assert.strictEqual(
await getInnerHTML(),
clipboard.getText(),
"Clipboard content was pasted into the node's inner HTML."
);
ok(
@ -111,8 +112,9 @@ add_task(async function () {
"The original node has been preserved."
);
await undoChange(inspector);
ok(
(await getInnerHTML()) === origInnerHTML,
Assert.strictEqual(
await getInnerHTML(),
origInnerHTML,
"Previous innerHTML has been restored after undo"
);
}
@ -147,8 +149,9 @@ add_task(async function () {
adjacentNodeSelector,
"innerHTML"
);
ok(
html.trim() === '1<span class="ref">234</span><span>5</span>',
Assert.strictEqual(
html.trim(),
'1<span class="ref">234</span><span>5</span>',
"The Paste as Last Child / as First Child / Before / After worked as " +
"expected"
);
@ -158,8 +161,9 @@ add_task(async function () {
adjacentNodeSelector,
"innerHTML"
);
ok(
html.trim() === '1<span class="ref">234</span>',
Assert.strictEqual(
html.trim(),
'1<span class="ref">234</span>',
"Undo works for paste adjacent HTML"
);
}

View File

@ -37,8 +37,9 @@ async function runUserAgentWidgetPickerTest({ enableAnonymousContent }) {
// We do not assert specifically which node was selected, we just want to
// check the node was under the shadow DOM for the <video type=date>
const shadowHost = getShadowHost(selectedNode);
ok(
selectedNode.tagName.toLowerCase() !== "video",
Assert.notStrictEqual(
selectedNode.tagName.toLowerCase(),
"video",
"The selected node is not the <video>"
);
ok(shadowHost, "The selected node is in a shadow root");

View File

@ -99,7 +99,7 @@ function checkResults() {
const expected = DATA[i];
// ignore timestamp
ok(timestamp > 0, "timestamp is greater than 0");
Assert.greater(timestamp, 0, "timestamp is greater than 0");
is(category, expected.category, "category is correct");
is(method, expected.method, "method is correct");
is(object, expected.object, "object is correct");

View File

@ -13,7 +13,7 @@ add_task(async function () {
const countBefore = await getElementCount(
".jsonPanelBox .treeTable .treeRow"
);
ok(countBefore == 1, "There must be one row");
Assert.equal(countBefore, 1, "There must be one row");
const text = await getElementText(".jsonPanelBox .treeTable .treeRow");
is(text, 'name"value"', "There must be proper JSON displayed");

View File

@ -48,8 +48,9 @@ add_task(async function () {
.map(x => "hoot"),
status: "ok",
});
ok(
json.length > EXPAND_THRESHOLD,
Assert.greater(
json.length,
EXPAND_THRESHOLD,
"The generated JSON must be larger than 100kB"
);
await addJsonViewTab("data:application/json," + json);

View File

@ -11,7 +11,7 @@ add_task(async function () {
await addJsonViewTab(TEST_JSON_URL);
const count = await getElementCount(".textPanelBox");
ok(count == 1, "The raw data panel must be shown");
Assert.equal(count, 1, "The raw data panel must be shown");
const text = await getElementText(".textPanelBox .jsonParseError");
ok(text, "There must be an error description");

View File

@ -35,7 +35,11 @@ add_task(async function () {
const scroller = content.document.querySelector(
".jsonPanelBox .panelContent"
);
ok(scroller.clientHeight < scroller.scrollHeight, "There is a scrollbar.");
Assert.less(
scroller.clientHeight,
scroller.scrollHeight,
"There is a scrollbar."
);
is(scroller.scrollTop, 0, "Initially scrolled to the top.");
});
@ -61,7 +65,7 @@ add_task(async function () {
const scroller = content.document.querySelector(
".jsonPanelBox .panelContent"
);
ok(scroller.scrollTop > 0, "Not scrolled to the top.");
Assert.greater(scroller.scrollTop, 0, "Not scrolled to the top.");
// Synthesize up arrow key to select first row.
content.document.querySelector(".treeTable").focus();
});
@ -138,8 +142,9 @@ add_task(async function () {
".jsonPanelBox .panelContent"
);
const row = content.document.querySelector(".treeRow:nth-child(2)");
ok(
scroller.clientHeight < row.clientHeight,
Assert.less(
scroller.clientHeight,
row.clientHeight,
"The row is taller than the scroller."
);
is(scroller.scrollTop, 0, "Initially scrolled to the top.");
@ -197,13 +202,14 @@ add_task(async function () {
const scrollPos = (scroller.scrollTop = Math.ceil(
(scroller.scrollTop + row.offsetTop) / 2
));
ok(
scroller.scrollTop > row.offsetTop,
Assert.greater(
scroller.scrollTop,
row.offsetTop,
"The top of the row is not visible."
);
ok(
scroller.scrollTop + scroller.offsetHeight <
row.offsetTop + row.offsetHeight,
Assert.less(
scroller.scrollTop + scroller.offsetHeight,
row.offsetTop + row.offsetHeight,
"The bottom of the row is not visible."
);

View File

@ -17,7 +17,7 @@ const TEST_URL =
"http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
function checkCells(cells) {
ok(cells.length > 1, "Should have found some");
Assert.greater(cells.length, 1, "Should have found some");
// Ignore the first header cell.
for (const cell of cells.slice(1)) {
const percent = cell.querySelector(".heap-tree-percent");

View File

@ -143,7 +143,7 @@ async function createTempFile() {
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
const destPath = file.path;
const stat = await IOUtils.stat(destPath);
ok(stat.size === 0, "new file is 0 bytes at start");
Assert.strictEqual(stat.size, 0, "new file is 0 bytes at start");
return destPath;
}

View File

@ -56,7 +56,11 @@ add_task(async function () {
await deleteEvents;
ok(true, "received delete snapshots events");
ok(getState().snapshots.length === 0, "Snapshots array should be empty");
Assert.strictEqual(
getState().snapshots.length,
0,
"Snapshots array should be empty"
);
ok(!getState().diffing, "We should no longer be diffing");
heapWorker.destroy();

View File

@ -38,7 +38,7 @@ add_task(async function () {
const stat = await IOUtils.stat(destPath);
info(stat.size);
ok(stat.size > 0, "destination file is more than 0 bytes");
Assert.greater(stat.size, 0, "destination file is more than 0 bytes");
heapWorker.destroy();
await front.detach();

View File

@ -54,7 +54,11 @@ add_task(async function () {
);
// Test invalid displays
ok(getState().errors.length === 0, "No error actions in the queue.");
Assert.strictEqual(
getState().errors.length,
0,
"No error actions in the queue."
);
dispatch(setCensusDisplayAndRefresh(heapWorker, {}));
await waitUntilState(store, () => getState().errors.length === 1);
ok(true, "Emits an error action when passing in an invalid display object");

View File

@ -69,7 +69,11 @@ add_task(async function () {
"only send partial dominator trees across initially and load the rest " +
"on demand"
);
ok(oldNode !== oldRoot, "But the node should not be the root");
Assert.notStrictEqual(
oldNode,
oldRoot,
"But the node should not be the root"
);
const lazyChildren = new DominatorTreeLazyChildren(oldNode.nodeId, 0);
dispatch(
@ -99,7 +103,11 @@ add_task(async function () {
);
const newRoot = getState().snapshots[0].dominatorTree.root;
ok(oldRoot !== newRoot, "When we insert new nodes, we get a new tree");
Assert.notStrictEqual(
oldRoot,
newRoot,
"When we insert new nodes, we get a new tree"
);
equal(
oldRoot.children.length,
newRoot.children.length,
@ -141,8 +149,9 @@ add_task(async function () {
const newNode = findNewNode(newRoot);
ok(newNode, "Should find the node in the new tree again");
ok(
newNode !== oldNode,
Assert.notStrictEqual(
newNode,
oldNode,
"We did not mutate the old node in place, instead created a new node"
);
ok(newNode.children, "And the new node should have the children attached");

View File

@ -86,8 +86,9 @@ add_task(async function () {
const oldNode2 = findNodeRev(oldRoot);
ok(oldNode2, "Should have found another node with more children.");
ok(
oldNode !== oldNode2,
Assert.notStrictEqual(
oldNode,
oldNode2,
"The second node should not be the same as the first one"
);
@ -126,7 +127,11 @@ add_task(async function () {
);
const newRoot = getState().snapshots[0].dominatorTree.root;
ok(oldRoot !== newRoot, "When we insert new nodes, we get a new tree");
Assert.notStrictEqual(
oldRoot,
newRoot,
"When we insert new nodes, we get a new tree"
);
// Find the new node which has the children inserted.
@ -149,8 +154,9 @@ add_task(async function () {
const newNode = findNodeWithId(oldNode.nodeId, newRoot);
ok(newNode, "Should find the node in the new tree again");
ok(
newNode !== oldNode,
Assert.notStrictEqual(
newNode,
oldNode,
"We did not mutate the old node in place, instead created a new node"
);
ok(
@ -160,8 +166,9 @@ add_task(async function () {
const newNode2 = findNodeWithId(oldNode2.nodeId, newRoot);
ok(newNode2, "Should find the second node in the new tree again");
ok(
newNode2 !== oldNode2,
Assert.notStrictEqual(
newNode2,
oldNode2,
"We did not mutate the second old node in place, instead created a new node"
);
ok(

View File

@ -52,8 +52,8 @@ add_task(async function () {
const totalBytes = result.bytes;
const totalCount = result.count;
ok(totalBytes > 0, "counted up bytes in the census");
ok(totalCount > 0, "counted up count in the census");
Assert.greater(totalBytes, 0, "counted up bytes in the census");
Assert.greater(totalCount, 0, "counted up count in the census");
result = getSnapshotTotals(getState().snapshots[0].census);
equal(

View File

@ -26,8 +26,9 @@ add_task(async function () {
states.SAVING,
"utils.createSnapshot() creates snapshot in saving state"
);
ok(
s1.id !== s2.id,
Assert.notStrictEqual(
s1.id,
s2.id,
"utils.createSnapshot() creates snapshot with unique ids"
);

View File

@ -85,7 +85,11 @@ async function testManyReloads({ tab, monitor, toolbox }) {
});
// In most cases, we will have two requests, but sometimes,
// the first one might be missing as we couldn't fetch any lazy data for it.
ok(har.log.entries.length >= 1, "There must be at least one request");
Assert.greaterOrEqual(
har.log.entries.length,
1,
"There must be at least one request"
);
info(
"Assert the first navigation request which has been cancelled by the second reload"
);
@ -167,7 +171,7 @@ async function testClearedRequests({ tab, monitor, toolbox }) {
function assertNavigationRequestEntry(entry) {
info("Assert that the entry relates to the navigation request");
ok(entry.time > 0, "Check the total time");
Assert.greater(entry.time, 0, "Check the total time");
is(entry.request.method, "GET", "Check the method");
is(entry.request.url, SIMPLE_URL, "Check the URL");
is(

View File

@ -19,14 +19,26 @@ add_task(async function () {
setData(format, data) {
this.setDataTrigger = true;
ok(format === "text/plain", 'setData passed valid "text/plain" format');
ok(data === this.BLOCKING_URL, "Data matches the expected URL");
Assert.strictEqual(
format,
"text/plain",
'setData passed valid "text/plain" format'
);
Assert.strictEqual(
data,
this.BLOCKING_URL,
"Data matches the expected URL"
);
this.data = data;
}
getData(format) {
this.getDataTrigger = true;
ok(format === "text/plain", 'getData passed valid "text/plain" format');
Assert.strictEqual(
format,
"text/plain",
'getData passed valid "text/plain" format'
);
return this.data;
}
@ -96,8 +108,9 @@ add_task(async function () {
})
);
ok(
dataTransfer.wasSetDataTriggered() === true,
Assert.strictEqual(
dataTransfer.wasSetDataTriggered(),
true,
'setData() was called during the "dragstart" event'
);
@ -110,8 +123,9 @@ add_task(async function () {
})
);
ok(
dataTransfer.wasGetDataTriggered() === true,
Assert.strictEqual(
dataTransfer.wasGetDataTriggered(),
true,
'getData() was called during the "drop" event'
);

View File

@ -145,7 +145,7 @@ add_task(async function () {
ok(!normalRequestState.blockedReason, "Normal request is not blocked");
ok(!normalRequestSize.includes("Blocked"), "Normal request has a size");
ok(normalHeadersSectionSize == 2, "Both header sections are showing");
Assert.equal(normalHeadersSectionSize, 2, "Both header sections are showing");
ok(
normalFirstHeaderSectionTitle.includes("Response"),
"The response header section is visible for normal requests"
@ -156,7 +156,11 @@ add_task(async function () {
blockedRequestSize.includes("Blocked"),
"Blocked request shows reason as size"
);
ok(blockedHeadersSectionSize == 1, "Only one header section is showing");
Assert.equal(
blockedHeadersSectionSize,
1,
"Only one header section is showing"
);
ok(
blockedFirstHeaderSectionTitle.includes("Request"),
"The response header section is not visible for blocked requests"

View File

@ -58,7 +58,11 @@ add_task(async function () {
const stackLen = stacktrace ? stacktrace.length : 0;
ok(stacktrace, `Request #${i} has a stacktrace`);
ok(stackLen > 0, `Request #${i} has a stacktrace with ${stackLen} items`);
Assert.greater(
stackLen,
0,
`Request #${i} has a stacktrace with ${stackLen} items`
);
});
// Send a request to reset the HSTS policy to state before the test

View File

@ -72,8 +72,9 @@ add_task(async function () {
function checkColumnsData(columnsData, column, expectedWidth) {
const width = getWidthFromPref(columnsData, column);
const widthsDiff = Math.abs(width - expectedWidth);
ok(
widthsDiff < 2,
Assert.less(
widthsDiff,
2,
`Column ${column} has expected size. Got ${width}, Expected ${expectedWidth}`
);
}

View File

@ -34,8 +34,9 @@ add_task(async function () {
await selectContextMenuItem(monitor, "request-list-header-reset-columns");
ok(
JSON.stringify(prefBefore) === JSON.stringify(Prefs.visibleColumns),
Assert.strictEqual(
JSON.stringify(prefBefore),
JSON.stringify(Prefs.visibleColumns),
"Reset columns item should reset columns pref"
);

View File

@ -135,8 +135,9 @@ async function testRequestWithFormattedView(
1,
"The number of param rows displayed in this tabpanel is incorrect."
);
ok(
tabpanel.querySelector(".empty-notice") === null,
Assert.strictEqual(
tabpanel.querySelector(".empty-notice"),
null,
"The empty notice should not be displayed in this tabpanel."
);
@ -144,8 +145,9 @@ async function testRequestWithFormattedView(
tabpanel.querySelector(".treeTable"),
"The request params box should be displayed."
);
ok(
tabpanel.querySelector(".CodeMirror-code") === null,
Assert.strictEqual(
tabpanel.querySelector(".CodeMirror-code"),
null,
"The request post data editor should not be displayed."
);
@ -204,8 +206,9 @@ async function testRequestWithFormattedView(
rawValue,
"The raw payload data string needs to be correct."
);
ok(
tabpanel.querySelector(".empty-notice") === null,
Assert.strictEqual(
tabpanel.querySelector(".empty-notice"),
null,
"The empty notice should not be displayed in this tabpanel."
);
@ -264,8 +267,9 @@ async function testRequestWithOnlyRawDataView(
paramName,
"The raw payload data string needs to be correct."
);
ok(
tabpanel.querySelector(".empty-notice") === null,
Assert.strictEqual(
tabpanel.querySelector(".empty-notice"),
null,
"The empty notice should not be displayed in this tabpanel."
);
}

View File

@ -54,13 +54,15 @@ add_task(async function () {
document.querySelector("#custom-request-close-button").click();
const finalRequestState = getSelectedRequest(store.getState());
ok(
firstRequestState.id === finalRequestState.id,
Assert.strictEqual(
firstRequestState.id,
finalRequestState.id,
"Original request is selected after cancel button is clicked"
);
ok(
document.querySelector(".headers-overview") !== null,
Assert.notStrictEqual(
document.querySelector(".headers-overview"),
null,
"Request is selected and headers panel is visible"
);

View File

@ -74,9 +74,9 @@ add_task(async function () {
methodField.select();
EventUtils.synthesizeKey("VK_DELETE", {});
ok(
getSelectedRequest(store.getState()).requestHeaders.headers[0] !==
hostHeader,
Assert.notStrictEqual(
getSelectedRequest(store.getState()).requestHeaders.headers[0],
hostHeader,
"Value of Host header was edited and should change"
);
@ -86,15 +86,17 @@ add_task(async function () {
"Position of caret should not change"
);
ok(
getSelectedRequest(store.getState()).method === "",
Assert.strictEqual(
getSelectedRequest(store.getState()).method,
"",
"Value of method header was deleted and should be empty"
);
headersTextarea.focus();
ok(
getSelectedRequest(store.getState()).method === originalMethodValue,
Assert.strictEqual(
getSelectedRequest(store.getState()).method,
originalMethodValue,
"Value of method header should reset to its original value"
);

View File

@ -57,8 +57,9 @@ add_task(async function () {
document.querySelectorAll(".request-list-item")[1].click();
const cloneRequest = getSelectedRequest(store.getState());
ok(
cloneRequest.id.replace(/-clone$/, "") == firstRequest.id,
Assert.equal(
cloneRequest.id.replace(/-clone$/, ""),
firstRequest.id,
"The second XHR request is a clone of the first"
);
@ -73,8 +74,9 @@ add_task(async function () {
document.querySelectorAll(".request-list-item")[0].click();
const resendRequest = getSelectedRequest(store.getState());
ok(
resendRequest.id !== firstRequest.id,
Assert.notStrictEqual(
resendRequest.id,
firstRequest.id,
"The second XHR request was made and is unique"
);
@ -143,8 +145,9 @@ add_task(async function () {
EventUtils.sendMouseEvent({ type: "mousedown" }, newRequest);
const resendRequest = getSelectedRequest(store.getState());
ok(
resendRequest.id !== firstRequest.id,
Assert.notStrictEqual(
resendRequest.id,
firstRequest.id,
"The second XHR request was made and is unique"
);

View File

@ -60,8 +60,9 @@ add_task(async function () {
const cloned = getSelectedRequest(store.getState());
// Compares if the requests have the same cause type (XHR)
ok(
original.cause.type === cloned.cause.type,
Assert.strictEqual(
original.cause.type,
cloned.cause.type,
"Both requests retain the same cause type"
);
@ -125,8 +126,9 @@ add_task(async function () {
EventUtils.sendMouseEvent({ type: "mousedown" }, newRequest);
const request = getSelectedRequest(store.getState());
ok(
original.cause.type === request.cause.type,
Assert.strictEqual(
original.cause.type,
request.cause.type,
"Both requests retain the same cause type"
);

View File

@ -233,8 +233,9 @@ add_task(async function () {
if (stack) {
ok(stacktrace, `Request #${i} has a stacktrace`);
ok(
stackLen > 0,
Assert.greater(
stackLen,
0,
`Request #${i} (${causeType}) has a stacktrace with ${stackLen} items`
);

View File

@ -59,13 +59,15 @@ add_task(async function () {
);
if (headerDocURL === null) {
ok(
learnMoreEl.length === 0,
Assert.strictEqual(
learnMoreEl.length,
0,
'undocumented header does not include a "Learn More" button'
);
} else {
ok(
learnMoreEl[0].getAttribute("title") === headerDocURL,
Assert.strictEqual(
learnMoreEl[0].getAttribute("title"),
headerDocURL,
'documented header includes a "Learn More" button with a link to MDN'
);
}

View File

@ -79,8 +79,9 @@ add_task(async function () {
const searchInput = await waitFor(() =>
document.querySelector(".CodeMirror input[type=search]")
);
ok(
searchInput.ownerDocument.activeElement == searchInput,
Assert.equal(
searchInput.ownerDocument.activeElement,
searchInput,
"search input is focused"
);

View File

@ -121,8 +121,9 @@ add_task(async function () {
const headersValues = document.querySelectorAll(
"#http-custom-headers .tabpanel-summary-container.http-custom-input"
);
ok(
headersValues.length >= 6,
Assert.greaterOrEqual(
headersValues.length,
6,
"The headers length in the form should match the request we clicked"
);

View File

@ -43,8 +43,9 @@ add_task(async function () {
tabpanel.querySelector(".treeTable"),
"The request params doesn't have the intended visibility."
);
ok(
tabpanel.querySelector(".editor-mount") === null,
Assert.strictEqual(
tabpanel.querySelector(".editor-mount"),
null,
"The request post data doesn't have the indented visibility."
);

Some files were not shown because too many files have changed in this diff Show More