Bug 1881701 - Automatically fix new issues raised in devtools. r=devtools-reviewers,frontend-codestyle-reviewers,mossop,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D249956
This commit is contained in:
committed by
mbanner@mozilla.com
parent
ce1e9e39d2
commit
ee9933d77b
@@ -178,7 +178,12 @@ export default [
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["client/framework/**"],
|
||||
files: [
|
||||
// Bug 1467784 - Fix these instances to have strict enabled.
|
||||
"client/framework/**",
|
||||
"client/shared/components/object-inspector/**",
|
||||
"client/shared/components/test/node/stubs/object-inspector/",
|
||||
],
|
||||
rules: {
|
||||
strict: "off",
|
||||
},
|
||||
|
||||
@@ -275,7 +275,9 @@ async function onTracingToggled() {
|
||||
function onDocumentEventAvailable(events) {
|
||||
for (const event of events) {
|
||||
// Only consider top level document, and ignore remote iframes top document
|
||||
if (!event.targetFront.isTopLevel) continue;
|
||||
if (!event.targetFront.isTopLevel) {
|
||||
continue;
|
||||
}
|
||||
// The browser toolbox debugger doesn't support the iframe dropdown.
|
||||
// you will always see all the sources of all targets of your debugging context.
|
||||
//
|
||||
|
||||
@@ -488,7 +488,9 @@ function findSourceInThreadItem(source, threadItem) {
|
||||
const groupItem = threadItem.children.find(item => {
|
||||
return item.groupName == group;
|
||||
});
|
||||
if (!groupItem) return null;
|
||||
if (!groupItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const parentPath = path.substring(0, path.lastIndexOf("/"));
|
||||
|
||||
@@ -503,7 +505,9 @@ function findSourceInThreadItem(source, threadItem) {
|
||||
const directoryItem = groupItem._allGroupDirectoryItems.find(item => {
|
||||
return item.type == "directory" && item.path == parentPath;
|
||||
});
|
||||
if (!directoryItem) return null;
|
||||
if (!directoryItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return directoryItem.children.find(item => {
|
||||
return item.type == "source" && item.source == source;
|
||||
|
||||
@@ -196,7 +196,9 @@ function update(state = initialState(), action) {
|
||||
case "SET_SELECTED_LOCATION": {
|
||||
// Traces are reference to the generated location only, so ignore any original source being selected
|
||||
// and wait for SET_GENERATED_SELECTED_LOCATION instead.
|
||||
if (action.location.source.isOriginal) return state;
|
||||
if (action.location.source.isOriginal) {
|
||||
return state;
|
||||
}
|
||||
|
||||
// Ignore if the currently selected trace matches the new location.
|
||||
if (
|
||||
|
||||
@@ -15,7 +15,9 @@ import { createSelector } from "devtools/client/shared/vendor/reselect";
|
||||
export const getSelectedFrame = createSelector(
|
||||
(state, thread) => state.pause.threads[thread || getCurrentThread(state)],
|
||||
threadPauseState => {
|
||||
if (!threadPauseState) return null;
|
||||
if (!threadPauseState) {
|
||||
return null;
|
||||
}
|
||||
const { selectedFrameId, frames } = threadPauseState;
|
||||
if (frames) {
|
||||
return frames.find(frame => frame.id == selectedFrameId);
|
||||
|
||||
@@ -195,7 +195,7 @@ class ObjectInspector extends Component {
|
||||
const length = roots.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
let rootItem = roots[i];
|
||||
const rootItem = roots[i];
|
||||
|
||||
if (evaluations.has(rootItem.path)) {
|
||||
roots[i] = getEvaluatedItem(rootItem, evaluations);
|
||||
@@ -371,7 +371,7 @@ const OI = connect(mapStateToProps, actions)(ObjectInspector);
|
||||
module.exports = props => {
|
||||
const { roots, standalone = false } = props;
|
||||
|
||||
if (roots.length == 0) {
|
||||
if (!roots.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ function reducer(state = initialOIState(), action = {}) {
|
||||
path,
|
||||
updateObject(obj, property, null)
|
||||
),
|
||||
watchpoints: watchpoints,
|
||||
watchpoints,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -106,11 +106,11 @@ function mergeResponses(responses) {
|
||||
data.ownProperties = { ...data.ownProperties, ...response.ownProperties };
|
||||
}
|
||||
|
||||
if (response.privateProperties && response.privateProperties.length > 0) {
|
||||
if (response.privateProperties && response.privateProperties.length) {
|
||||
data.privateProperties = response.privateProperties;
|
||||
}
|
||||
|
||||
if (response.ownSymbols && response.ownSymbols.length > 0) {
|
||||
if (response.ownSymbols && response.ownSymbols.length) {
|
||||
data.ownSymbols = response.ownSymbols;
|
||||
}
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ function makeDefaultPropsBucket(propertiesNames, parent, ownProperties) {
|
||||
ownProperties
|
||||
);
|
||||
|
||||
if (defaultProperties.length > 0) {
|
||||
if (defaultProperties.length) {
|
||||
const defaultPropertiesNode = createNode({
|
||||
parent,
|
||||
name: "<default properties>",
|
||||
|
||||
@@ -342,7 +342,7 @@ const previewers = {
|
||||
|
||||
grip.preview = {
|
||||
kind: "ArrayLike",
|
||||
length: length,
|
||||
length,
|
||||
};
|
||||
|
||||
if (depth > 1) {
|
||||
@@ -462,7 +462,7 @@ const previewers = {
|
||||
|
||||
grip.preview = {
|
||||
kind: "MapLike",
|
||||
size: size,
|
||||
size,
|
||||
};
|
||||
|
||||
if (depth > 1) {
|
||||
@@ -908,7 +908,7 @@ function GenericObject(objectActor, grip, depth) {
|
||||
const privatePropertiesSymbols = ObjectUtils.getSafePrivatePropertiesSymbols(
|
||||
obj
|
||||
);
|
||||
if (privatePropertiesSymbols.length > 0) {
|
||||
if (privatePropertiesSymbols.length) {
|
||||
preview.privatePropertiesLength = privatePropertiesSymbols.length;
|
||||
preview.privateProperties = [];
|
||||
|
||||
@@ -945,7 +945,7 @@ function GenericObject(objectActor, grip, depth) {
|
||||
}
|
||||
|
||||
const symbols = ObjectUtils.getSafeOwnPropertySymbols(obj);
|
||||
if (symbols.length > 0) {
|
||||
if (symbols.length) {
|
||||
preview.ownSymbolsLength = symbols.length;
|
||||
preview.ownSymbols = [];
|
||||
|
||||
@@ -1244,7 +1244,7 @@ previewers.Object = [
|
||||
const privatePropertiesSymbols = ObjectUtils.getSafePrivatePropertiesSymbols(
|
||||
obj
|
||||
);
|
||||
if (privatePropertiesSymbols.length > 0) {
|
||||
if (privatePropertiesSymbols.length) {
|
||||
preview.privatePropertiesLength = privatePropertiesSymbols.length;
|
||||
}
|
||||
} else if (className == "Attr") {
|
||||
|
||||
@@ -299,7 +299,7 @@ function enumMapEntries(objectActor, depth) {
|
||||
const entries = getMapEntries(objectActor);
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const [key, value] of entries) {
|
||||
yield [key, value].map(val => gripFromEntry(objectActor, val, depth));
|
||||
}
|
||||
@@ -335,7 +335,7 @@ function enumStorageEntries(objectActor, depth) {
|
||||
keys.push(rawObj.key(i));
|
||||
}
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const key of keys) {
|
||||
const value = rawObj.getItem(key);
|
||||
yield [key, value].map(val => gripFromEntry(objectActor, val, depth));
|
||||
@@ -366,7 +366,7 @@ function enumURLSearchParamsEntries(objectActor, depth) {
|
||||
const entries = [...waiveXrays(URLSearchParams.prototype.entries.call(objectActor.rawObj))];
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const [key, value] of entries) {
|
||||
yield [key, value];
|
||||
}
|
||||
@@ -398,7 +398,7 @@ function enumFormDataEntries(objectActor, depth) {
|
||||
const entries = [...waiveXrays(FormData.prototype.entries.call(objectActor.rawObj))];
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const [key, value] of entries) {
|
||||
yield [key, value];
|
||||
}
|
||||
@@ -428,7 +428,7 @@ function enumHeadersEntries(objectActor, depth) {
|
||||
const entries = [...waiveXrays(Headers.prototype.entries.call(objectActor.rawObj))];
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const [key, value] of entries) {
|
||||
yield [key, value];
|
||||
}
|
||||
@@ -454,7 +454,7 @@ function enumHighlightRegistryEntries(objectActor, depth) {
|
||||
: [];
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const [key, value] of entries) {
|
||||
yield [key, gripFromEntry(objectActor, value, depth)];
|
||||
}
|
||||
@@ -470,7 +470,7 @@ function enumHighlightRegistryEntries(objectActor, depth) {
|
||||
value: {
|
||||
type: "highlightRegistryEntry",
|
||||
preview: {
|
||||
key: key,
|
||||
key,
|
||||
value: gripFromEntry(objectActor, value, depth),
|
||||
},
|
||||
},
|
||||
@@ -488,7 +488,7 @@ function enumMidiInputMapEntries(objectActor, depth) {
|
||||
);
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const [key, value] of entries) {
|
||||
yield [key, gripFromEntry(objectActor, value, depth)];
|
||||
}
|
||||
@@ -515,7 +515,7 @@ function enumMidiOutputMapEntries(objectActor, depth) {
|
||||
);
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const [key, value] of entries) {
|
||||
yield [key, gripFromEntry(objectActor, value, depth)];
|
||||
}
|
||||
@@ -553,7 +553,7 @@ function enumWeakMapEntries(objectActor, depth) {
|
||||
const entries = getWeakMapEntries(objectActor.rawObj);
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
yield entries[i].map(val => gripFromEntry(objectActor, val, depth));
|
||||
}
|
||||
@@ -601,7 +601,7 @@ function enumSetEntries(objectActor, depth) {
|
||||
);
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const item of values) {
|
||||
yield gripFromEntry(objectActor, item, depth);
|
||||
}
|
||||
@@ -638,7 +638,7 @@ function enumWeakSetEntries(objectActor, depth) {
|
||||
const keys = getWeakSetEntries(objectActor.rawObj);
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const item of keys) {
|
||||
yield gripFromEntry(objectActor, item, depth);
|
||||
}
|
||||
@@ -658,7 +658,7 @@ function enumWeakSetEntries(objectActor, depth) {
|
||||
}
|
||||
|
||||
function enumCustomStateSetEntries(objectActor, depth) {
|
||||
let { rawObj } = objectActor;
|
||||
const { rawObj } = objectActor;
|
||||
// We need to waive `rawObj` as we can't get the iterator from the Xray for SetLike (See Bug 1173651).
|
||||
// We also need to waive Xrays on the result of the call to `values` as we don't have
|
||||
// Xrays to Iterator objects (see Bug 1023984)
|
||||
@@ -667,7 +667,7 @@ function enumCustomStateSetEntries(objectActor, depth) {
|
||||
);
|
||||
|
||||
return {
|
||||
[Symbol.iterator]: function*() {
|
||||
*[Symbol.iterator]() {
|
||||
for (const item of values) {
|
||||
yield gripFromEntry(objectActor, item, depth);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
import { TEST_PAGE_HTML, CONTEXTS, AllObjects } from "resource://testing-common/AllJavascriptTypes.mjs";
|
||||
export { CONTEXTS } from "resource://testing-common/AllJavascriptTypes.mjs";
|
||||
import { ObjectUtils } from "resource://gre/modules/ObjectUtils.sys.mjs";
|
||||
import { TEST_PAGE_HTML, CONTEXTS, AllObjects } from "resource://testing-common/AllJavascriptTypes.mjs";
|
||||
import { AddonTestUtils } from "resource://testing-common/AddonTestUtils.sys.mjs"
|
||||
|
||||
// Name of the environment variable to set while running the test to update the expected values
|
||||
const UPDATE_SNAPSHOT_ENV = "UPDATE_SNAPSHOT";
|
||||
|
||||
const { AddonTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/AddonTestUtils.sys.mjs"
|
||||
);
|
||||
export { CONTEXTS } from "resource://testing-common/AllJavascriptTypes.mjs";
|
||||
|
||||
// To avoid totally unrelated exceptions about missing appinfo when running from xpcshell tests
|
||||
const isXpcshell = Services.env.exists("XPCSHELL_TEST_PROFILE_DIR");
|
||||
@@ -54,7 +52,7 @@ function init(testScope) {
|
||||
});
|
||||
|
||||
// Lookup for all preferences to toggle in order to have all the expected objects type functional
|
||||
let prefValues = new Map();
|
||||
const prefValues = new Map();
|
||||
for (const { prefs } of AllObjects) {
|
||||
if (!prefs) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user