Bug 1344286 - Fix eslint errors from devtools files ignored previously; r=gregtatum,ntim

MozReview-Commit-ID: CXVyorSle4l

--HG--
extra : rebase_source : e74c20b2eeeeaf082be073a36da3f6fc4b57ab43
This commit is contained in:
Hemanth Kumar Veeranki 2018-06-16 15:45:58 +05:30
parent 51fdfe5279
commit 46eb6c4e9d
17 changed files with 141 additions and 128 deletions

View file

@ -101,7 +101,6 @@ browser/extensions/formautofill/phonenumberutils/PhoneNumberMetaData.jsm
# devtools/ exclusions
devtools/client/inspector/markup/test/doc_markup_events_*.html
devtools/client/inspector/rules/test/doc_media_queries.html
devtools/client/memory/test/chrome/*.html
devtools/client/performance/components/test/test_jit_optimizations_01.html
devtools/client/responsive.html/test/browser/touch.html
devtools/client/shared/components/test/mochitest/*.html

View file

@ -16,7 +16,8 @@ Test that children pointers show up at the correct times.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -52,8 +53,7 @@ Test that children pointers show up at the correct times.
ok(container.querySelector(".children-pointer"),
"Do show children pointer when non-inverted and have children");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -16,7 +16,8 @@ Test that we don't display `JS::ubi::RootList` for the root, and instead show "G
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -33,7 +34,7 @@ Test that we don't display `JS::ubi::RootList` for the root, and instead show "G
"Should not display `JS::ubi::RootList`");
ok(container.textContent.includes("GC Roots"),
"Should display `GC Roots` instead");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -16,7 +16,8 @@ Test that we show a place holder for a subtree we are lazily fetching.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -26,19 +27,20 @@ Test that we show a place holder for a subtree we are lazily fetching.
const expanded = new Set();
expanded.add(root.nodeId);
await renderComponent(DominatorTreeComponent(immutableUpdate(TEST_DOMINATOR_TREE_PROPS, {
dominatorTree: immutableUpdate(TEST_DOMINATOR_TREE_PROPS.dominatorTree, {
expanded,
root,
state: dominatorTreeState.INCREMENTAL_FETCHING,
activeFetchRequestCount: 1,
}),
})), container);
await renderComponent(DominatorTreeComponent(immutableUpdate(
TEST_DOMINATOR_TREE_PROPS, {
dominatorTree: immutableUpdate(TEST_DOMINATOR_TREE_PROPS.dominatorTree, {
expanded,
root,
state: dominatorTreeState.INCREMENTAL_FETCHING,
activeFetchRequestCount: 1,
}),
})), container);
ok(container.querySelector(".subtree-fetching"),
"Expanded nodes with more children available, but no children " +
"loaded, should get a placeholder");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -16,7 +16,8 @@ Test that we show a link to load more children when some (but not all) are loade
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -29,16 +30,17 @@ Test that we show a link to load more children when some (but not all) are loade
const expanded = new Set();
expanded.add(root.nodeId);
await renderComponent(DominatorTreeComponent(immutableUpdate(TEST_DOMINATOR_TREE_PROPS, {
dominatorTree: immutableUpdate(TEST_DOMINATOR_TREE_PROPS.dominatorTree, {
expanded,
root,
}),
})), container);
await renderComponent(DominatorTreeComponent(immutableUpdate(
TEST_DOMINATOR_TREE_PROPS, {
dominatorTree: immutableUpdate(TEST_DOMINATOR_TREE_PROPS.dominatorTree, {
expanded,
root,
}),
})), container);
ok(container.querySelector(".more-children"),
"Should get a link to load more children");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -16,7 +16,8 @@ Test that expanded DominatorTreeItems are correctly rendered and updated
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -32,7 +33,7 @@ Test that expanded DominatorTreeItems are correctly rendered and updated
const expanded = new Set();
expanded.add(root.nodeId);
let component = await renderComponent(
await renderComponent(
DominatorTreeComponent(immutableUpdate(
TEST_DOMINATOR_TREE_PROPS,
{
@ -64,8 +65,7 @@ Test that expanded DominatorTreeItems are correctly rendered and updated
"Should display only one row");
is(container.querySelectorAll(".arrow.open").length, 0,
"Should display no expanded arrow");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -15,7 +15,8 @@ Test that rendering a dominator tree error is handled correctly.
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
ok(React, "Should get React");
ok(Heap, "Should get Heap");
@ -38,7 +39,7 @@ Test that rendering a dominator tree error is handled correctly.
ok(container.querySelector(".error"), "Should render an error view");
ok(container.textContent.includes(errorMessage),
"Should see our error message");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -14,12 +14,12 @@ Test that the currently selected view is rendered.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
ok(React, "Should get React");
ok(Heap, "Should get Heap");
const errorMessage = "Something went wrong!";
const container = document.getElementById("container");
// Dominator tree view.
@ -66,7 +66,7 @@ Test that the currently selected view is rendered.
ok(container.querySelector("[data-state=initial]"),
"With no snapshot, nor a diffing, should render initial prompt.");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -15,11 +15,12 @@ but not in other dominator tree states.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
for (let state of [dominatorTreeState.COMPUTING, dominatorTreeState.FETCHING]) {
for (const state of [dominatorTreeState.COMPUTING, dominatorTreeState.FETCHING]) {
await renderComponent(Heap(immutableUpdate(TEST_HEAP_PROPS, {
view: { state: viewState.DOMINATOR_TREE, },
snapshot: immutableUpdate(TEST_HEAP_PROPS.snapshot, {
@ -35,13 +36,17 @@ but not in other dominator tree states.
`Should show a throbber for state = ${state}`);
}
for (let state of [dominatorTreeState.LOADED, dominatorTreeState.INCREMENTAL_FETCHING]) {
for (
const state of [
dominatorTreeState.LOADED, dominatorTreeState.INCREMENTAL_FETCHING
]) {
await renderComponent(Heap(immutableUpdate(TEST_HEAP_PROPS, {
view: { state: viewState.DOMINATOR_TREE, },
snapshot: immutableUpdate(TEST_HEAP_PROPS.snapshot, {
dominatorTree: immutableUpdate(TEST_HEAP_PROPS.snapshot.dominatorTree, {
state,
activeFetchRequestCount: state === dominatorTreeState.INCREMENTAL_FETCHING ? 1 : undefined,
activeFetchRequestCount:
state === dominatorTreeState.INCREMENTAL_FETCHING ? 1 : undefined,
}),
}),
})), container);
@ -62,7 +67,7 @@ but not in other dominator tree states.
ok(!container.querySelector(".devtools-throbber"),
`Should not show a throbber for ERROR state`);
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -14,7 +14,8 @@ Test that we show the "hey you're not recording allocation stacks" message at th
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -109,7 +110,7 @@ Test that we show the "hey you're not recording allocation stacks" message at th
ok(!container.querySelector(".no-allocation-stacks"),
"When there isn't census data, we should not show the message");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -14,7 +14,8 @@ Test that we show a message when the census results are empty.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -110,17 +111,17 @@ Test that we show a message when the census results are empty.
await renderComponent(Heap(immutableUpdate(TEST_HEAP_PROPS, {
snapshot: immutableUpdate(TEST_HEAP_PROPS.snapshot, {
census: immutableUpdate(TEST_HEAP_PROPS.snapshot.census, immutableUpdate(emptyCensus, {
filter: "zzzz"
})),
census: immutableUpdate(
TEST_HEAP_PROPS.snapshot.census, immutableUpdate(emptyCensus, {
filter: "zzzz"
})),
}),
})), container);
ok(container.querySelector(".empty"),
"When the report is empty in census view w/ filter, we show the empty message");
ok(container.textContent.includes(L10N.getStr("heapview.none-match")));
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -15,59 +15,58 @@ Test to verify the delete button calls the onDelete handler for an item
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
try {
const container = document.getElementById("container");
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
let deletedSnapshots = [];
const deletedSnapshots = [];
let snapshots = [ TEST_SNAPSHOT, TEST_SNAPSHOT, TEST_SNAPSHOT ]
.map((snapshot, index) => immutableUpdate(snapshot, {
index: snapshot.index + index
}));
const snapshots = [ TEST_SNAPSHOT, TEST_SNAPSHOT, TEST_SNAPSHOT ]
.map((snapshot, index) => immutableUpdate(snapshot, {
index: snapshot.index + index
}));
await renderComponent(
List({
itemComponent: SnapshotListItem,
onClick: noop,
onDelete: (item) => deletedSnapshots.push(item),
items: snapshots
}),
container
);
await renderComponent(
List({
itemComponent: SnapshotListItem,
onClick: noop,
onDelete: (item) => deletedSnapshots.push(item),
items: snapshots
}),
container
);
let deleteButtons = container.querySelectorAll('.delete');
const deleteButtons = container.querySelectorAll(".delete");
is(container.querySelectorAll('.snapshot-list-item').length, 3,
"There are 3 list items\n");
is(deletedSnapshots.length, 0,
"Not snapshots have been deleted\n");
is(container.querySelectorAll(".snapshot-list-item").length, 3,
"There are 3 list items\n");
is(deletedSnapshots.length, 0,
"Not snapshots have been deleted\n");
deleteButtons[1].click();
deleteButtons[1].click();
is(deletedSnapshots.length, 1, "One snapshot was deleted\n");
is(deletedSnapshots[0], snapshots[1],
"Deleted snapshot was added to the deleted list\n");
is(deletedSnapshots.length, 1, "One snapshot was deleted\n");
is(deletedSnapshots[0], snapshots[1],
"Deleted snapshot was added to the deleted list\n");
deleteButtons[0].click();
deleteButtons[0].click();
is(deletedSnapshots.length, 2, "Two snapshots were deleted\n");
is(deletedSnapshots[1], snapshots[0],
"Deleted snapshot was added to the deleted list\n");
is(deletedSnapshots.length, 2, "Two snapshots were deleted\n");
is(deletedSnapshots[1], snapshots[0],
"Deleted snapshot was added to the deleted list\n");
deleteButtons[2].click();
deleteButtons[2].click();
is(deletedSnapshots.length, 3, "Three snapshots were deleted\n");
is(deletedSnapshots[2], snapshots[2],
"Deleted snapshot was added to the deleted list\n");
} catch(e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();
}
};
is(deletedSnapshots.length, 3, "Three snapshots were deleted\n");
is(deletedSnapshots[2], snapshots[2],
"Deleted snapshot was added to the deleted list\n");
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();
}
};
</script>
</pre>
</body>

View file

@ -23,7 +23,8 @@ Test that the ShortestPaths component properly renders a graph of the merged sho
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -38,7 +39,7 @@ Test that the ShortestPaths component properly renders a graph of the merged sho
let found2to3 = false;
const tspans = [...container.querySelectorAll("tspan")];
for (let el of tspans) {
for (const el of tspans) {
const text = el.textContent.trim();
dumpn("tspan's text = " + text);
@ -99,8 +100,7 @@ Test that the ShortestPaths component properly renders a graph of the merged sho
ok(found1to2, "Should have rendered edge 1->2");
ok(found1to3, "Should have rendered edge 1->3");
ok(found2to3, "Should have rendered edge 2->3");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -23,7 +23,8 @@ Test that the ShortestPaths component renders a suggestion to select a node when
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
@ -33,7 +34,7 @@ Test that the ShortestPaths component renders a suggestion to select a node when
ok(container.textContent.includes(L10N.getStr("shortest-paths.select-node")),
"The node selection prompt is displayed");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -16,37 +16,37 @@ path.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
try {
const container = document.getElementById("container");
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
await renderComponent(
SnapshotListItem(TEST_SNAPSHOT_LIST_ITEM_PROPS),
container
);
await renderComponent(
SnapshotListItem(TEST_SNAPSHOT_LIST_ITEM_PROPS),
container
);
ok(container.querySelector('.delete'),
"Should have delete button when there is a path");
ok(container.querySelector(".delete"),
"Should have delete button when there is a path");
const pathlessProps = immutableUpdate(
TEST_SNAPSHOT_LIST_ITEM_PROPS,
{item: immutableUpdate(TEST_SNAPSHOT, {path: null})}
);
const pathlessProps = immutableUpdate(
TEST_SNAPSHOT_LIST_ITEM_PROPS,
{item: immutableUpdate(TEST_SNAPSHOT, {path: null})}
);
await renderComponent(
SnapshotListItem(pathlessProps),
container
);
await renderComponent(
SnapshotListItem(pathlessProps),
container
);
ok(!container.querySelector('.delete'),
"No delete button should be found if there is no path\n");
} catch(e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();
}
};
ok(!container.querySelector(".delete"),
"No delete button should be found if there is no path\n");
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();
}
};
</script>
</pre>
</body>

View file

@ -14,13 +14,14 @@ Test that the Toolbar component shows the view switcher only at the appropriate
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
// Census and dominator tree views.
for (let view of [viewState.CENSUS, viewState.DOMINATOR_TREE]) {
for (const view of [viewState.CENSUS, viewState.DOMINATOR_TREE]) {
await renderComponent(Toolbar(immutableUpdate(TEST_TOOLBAR_PROPS, {
view: { state: view },
})), container);
@ -35,7 +36,7 @@ Test that the Toolbar component shows the view switcher only at the appropriate
ok(!container.querySelector("#select-view"),
"The view selector is NOT shown in the DIFFING view");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();

View file

@ -20,19 +20,19 @@ Test that the Tree Map correctly renders onto 2 managed canvases.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
window.onload = async function () {
"use strict";
window.onload = async function() {
try {
const container = document.getElementById("container");
await renderComponent(TreeMap(TEST_TREE_MAP_PROPS), container);
let treeMapContainer = container.querySelector(".tree-map-container");
const treeMapContainer = container.querySelector(".tree-map-container");
ok(treeMapContainer, "Component creates a container");
let canvases = treeMapContainer.querySelectorAll("canvas");
const canvases = treeMapContainer.querySelectorAll("canvas");
is(canvases.length, 2, "Creates 2 canvases");
} catch(e) {
} catch (e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
SimpleTest.finish();