Bug 1751851 - [devtools] Migrate all event-listeners selectors to a selector module. r=bomsy

I'm also sorting the import from index.js in order to help the maintenance of this list.

Differential Revision: https://phabricator.services.mozilla.com/D136855
This commit is contained in:
Alexandre Poirot 2022-01-27 08:31:39 +00:00
Родитель b44cd5b678
Коммит d922ca4ee4
5 изменённых файлов: 29 добавлений и 65 удалений

Просмотреть файл

@ -35,20 +35,4 @@ function update(state = initialEventListenerState(), action) {
}
}
export function getActiveEventListeners(state) {
return state.eventListenerBreakpoints.active;
}
export function getEventListenerBreakpointTypes(state) {
return state.eventListenerBreakpoints.categories;
}
export function getEventListenerExpanded(state) {
return state.eventListenerBreakpoints.expanded;
}
export function shouldLogEventBreakpoints(state) {
return state.eventListenerBreakpoints.logEventBreakpoints;
}
export default update;

Просмотреть файл

@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
export function getActiveEventListeners(state) {
return state.eventListenerBreakpoints.active;
}
export function getEventListenerBreakpointTypes(state) {
return state.eventListenerBreakpoints.categories;
}
export function getEventListenerExpanded(state) {
return state.eventListenerBreakpoints.expanded;
}
export function shouldLogEventBreakpoints(state) {
return state.eventListenerBreakpoints.logEventBreakpoints;
}

Просмотреть файл

@ -1,38 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { getSymbols, getSource, getSelectedFrame, getCurrentThread } from ".";
import { findClosestClass } from "../utils/ast";
export function inComponent(state) {
const thread = getCurrentThread(state);
const selectedFrame = getSelectedFrame(state, thread);
if (!selectedFrame) {
return;
}
const source = getSource(state, selectedFrame.location.sourceId);
if (!source) {
return;
}
const symbols = getSymbols(state, source);
if (!symbols || symbols.loading) {
return;
}
const closestClass = findClosestClass(symbols, selectedFrame.location);
if (!closestClass) {
return null;
}
const inReactFile = symbols.framework == "React";
const { parent } = closestClass;
const isComponent = parent && parent.name.includes("Component");
if (inReactFile && isComponent) {
return closestClass.name;
}
}

Просмотреть файл

@ -5,7 +5,6 @@
export * from "../reducers/expressions";
export * from "../reducers/sources";
export * from "../reducers/tabs";
export * from "../reducers/event-listeners";
export * from "../reducers/pause";
export * from "../reducers/threads";
export * from "../reducers/breakpoints";
@ -31,23 +30,18 @@ export {
} from "../reducers/quick-open";
export * from "./ast";
export { getXHRBreakpoints, shouldPauseOnAnyXHR } from "./breakpoints";
export {
getClosestBreakpoint,
getBreakpointAtLocation,
getBreakpointsAtLine,
getClosestBreakpointPosition,
} from "./breakpointAtLocation";
export {
getVisibleBreakpoints,
getFirstVisibleBreakpoints,
} from "./visibleBreakpoints";
export { inComponent } from "./inComponent";
export { isSelectedFrameVisible } from "./isSelectedFrameVisible";
export { getCallStackFrames } from "./getCallStackFrames";
export { getBreakpointSources } from "./breakpointSources";
export * from "./event-listeners";
export { getCallStackFrames } from "./getCallStackFrames";
export { isLineInScope } from "./isLineInScope";
export { getXHRBreakpoints, shouldPauseOnAnyXHR } from "./breakpoints";
export * from "./visibleColumnBreakpoints";
export { isSelectedFrameVisible } from "./isSelectedFrameVisible";
export {
getSelectedFrame,
getSelectedFrames,
@ -55,6 +49,11 @@ export {
} from "./pause";
export * from "./tabs";
export * from "./threads";
export {
getVisibleBreakpoints,
getFirstVisibleBreakpoints,
} from "./visibleBreakpoints";
export * from "./visibleColumnBreakpoints";
import { objectInspector } from "devtools/client/shared/components/reps/index";

Просмотреть файл

@ -10,8 +10,8 @@ CompiledModules(
"breakpointAtLocation.js",
"breakpoints.js",
"breakpointSources.js",
"event-listeners.js",
"getCallStackFrames.js",
"inComponent.js",
"index.js",
"isLineInScope.js",
"isSelectedFrameVisible.js",