diff --git a/devtools/client/debugger/src/actions/source-actors.js b/devtools/client/debugger/src/actions/source-actors.js
index 5d8f2de3025d..bc09d8ab9e9e 100644
--- a/devtools/client/debugger/src/actions/source-actors.js
+++ b/devtools/client/debugger/src/actions/source-actors.js
@@ -6,7 +6,7 @@ import {
getSourceActor,
getSourceActorBreakableLines,
getSourceActorBreakpointColumns,
-} from "../reducers/source-actors";
+} from "../selectors/source-actors";
import { memoizeableAction } from "../utils/memoizableAction";
import { PROMISE } from "./utils/middleware/promise";
diff --git a/devtools/client/debugger/src/reducers/source-actors.js b/devtools/client/debugger/src/reducers/source-actors.js
index aeb1b378bef6..9fcd019dcc92 100644
--- a/devtools/client/debugger/src/reducers/source-actors.js
+++ b/devtools/client/debugger/src/reducers/source-actors.js
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
-import { asSettled } from "../utils/async-value";
import {
createInitial,
insertResources,
@@ -10,10 +9,6 @@ import {
removeResources,
hasResource,
getResource,
- getMappedResource,
- makeWeakQuery,
- makeIdQuery,
- makeReduceAllQuery,
} from "../utils/resource";
import { asyncActionAsValue } from "../actions/utils/middleware/promise";
@@ -112,94 +107,3 @@ function updateBreakableLines(state, action) {
return updateResources(state, [{ id: sourceId, breakableLines: value }]);
}
-
-export function resourceAsSourceActor({
- breakpointPositions,
- breakableLines,
- ...sourceActor
-}) {
- return sourceActor;
-}
-
-export function hasSourceActor(state, id) {
- return hasResource(state.sourceActors, id);
-}
-
-export function getSourceActor(state, id) {
- return getMappedResource(state.sourceActors, id, resourceAsSourceActor);
-}
-
-/**
- * Get all of the source actors for a set of IDs. Caches based on the identity
- * of "ids" when possible.
- */
-const querySourceActorsById = makeIdQuery(resourceAsSourceActor);
-
-export function getSourceActors(state, ids) {
- return querySourceActorsById(state.sourceActors, ids);
-}
-
-const querySourcesByThreadID = makeReduceAllQuery(
- resourceAsSourceActor,
- actors => {
- return actors.reduce((acc, actor) => {
- acc[actor.thread] = acc[actor.thread] || [];
- acc[actor.thread].push(actor);
- return acc;
- }, {});
- }
-);
-export function getSourceActorsForThread(state, ids) {
- const sourcesByThread = querySourcesByThreadID(state.sourceActors);
-
- let sources = [];
- for (const id of Array.isArray(ids) ? ids : [ids]) {
- sources = sources.concat(sourcesByThread[id] || []);
- }
- return sources;
-}
-
-const queryThreadsBySourceObject = makeReduceAllQuery(
- actor => ({ thread: actor.thread, source: actor.source }),
- actors =>
- actors.reduce((acc, { source, thread }) => {
- let sourceThreads = acc[source];
- if (!sourceThreads) {
- sourceThreads = [];
- acc[source] = sourceThreads;
- }
-
- sourceThreads.push(thread);
- return acc;
- }, {})
-);
-
-export function getAllThreadsBySource(state) {
- return queryThreadsBySourceObject(state.sourceActors);
-}
-
-export function getSourceActorBreakableLines(state, id) {
- const { breakableLines } = getResource(state.sourceActors, id);
-
- return asSettled(breakableLines);
-}
-
-export function getSourceActorBreakpointColumns(state, id, line) {
- const { breakpointPositions } = getResource(state.sourceActors, id);
-
- return asSettled(breakpointPositions.get(line) || null);
-}
-
-export const getBreakableLinesForSourceActors = makeWeakQuery({
- filter: (state, ids) => ids,
- map: ({ breakableLines }) => breakableLines,
- reduce: items =>
- Array.from(
- items.reduce((acc, item) => {
- if (item && item.state === "fulfilled") {
- acc = acc.concat(item.value);
- }
- return acc;
- }, [])
- ),
-});
diff --git a/devtools/client/debugger/src/selectors/index.js b/devtools/client/debugger/src/selectors/index.js
index 404fe9d48636..583371cf3030 100644
--- a/devtools/client/debugger/src/selectors/index.js
+++ b/devtools/client/debugger/src/selectors/index.js
@@ -6,13 +6,6 @@ export * from "../reducers/expressions";
export * from "../reducers/tabs";
export * from "../reducers/threads";
-export {
- getSourceActor,
- hasSourceActor,
- getSourceActors,
- getSourceActorsForThread,
-} from "../reducers/source-actors";
-
export * from "./ast";
export * from "./breakpoints";
export {
@@ -33,6 +26,7 @@ export * from "./pending-breakpoints";
export * from "./preview";
export * from "./project-text-search";
export * from "./quick-open";
+export * from "./source-actors";
export * from "./source-tree";
export * from "./sources";
export * from "./tabs";
diff --git a/devtools/client/debugger/src/selectors/moz.build b/devtools/client/debugger/src/selectors/moz.build
index fce192344172..6cdca7b5604c 100644
--- a/devtools/client/debugger/src/selectors/moz.build
+++ b/devtools/client/debugger/src/selectors/moz.build
@@ -22,6 +22,7 @@ CompiledModules(
"preview.js",
"project-text-search.js",
"quick-open.js",
+ "source-actors.js",
"source-tree.js",
"sources.js",
"tabs.js",
diff --git a/devtools/client/debugger/src/selectors/source-actors.js b/devtools/client/debugger/src/selectors/source-actors.js
new file mode 100644
index 000000000000..ef7050183ba2
--- /dev/null
+++ b/devtools/client/debugger/src/selectors/source-actors.js
@@ -0,0 +1,108 @@
+/* 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 . */
+
+import { asSettled } from "../utils/async-value";
+import {
+ hasResource,
+ getResource,
+ getMappedResource,
+ makeWeakQuery,
+ makeIdQuery,
+ makeReduceAllQuery,
+} from "../utils/resource";
+
+function resourceAsSourceActor({
+ breakpointPositions,
+ breakableLines,
+ ...sourceActor
+}) {
+ return sourceActor;
+}
+
+export function hasSourceActor(state, id) {
+ return hasResource(state.sourceActors, id);
+}
+
+export function getSourceActor(state, id) {
+ return getMappedResource(state.sourceActors, id, resourceAsSourceActor);
+}
+
+/**
+ * Get all of the source actors for a set of IDs. Caches based on the identity
+ * of "ids" when possible.
+ */
+const querySourceActorsById = makeIdQuery(resourceAsSourceActor);
+
+// Used by sources selectors
+export function getSourceActors(state, ids) {
+ return querySourceActorsById(state.sourceActors, ids);
+}
+
+const querySourcesByThreadID = makeReduceAllQuery(
+ resourceAsSourceActor,
+ actors => {
+ return actors.reduce((acc, actor) => {
+ acc[actor.thread] = acc[actor.thread] || [];
+ acc[actor.thread].push(actor);
+ return acc;
+ }, {});
+ }
+);
+// Used by threads selectors
+export function getSourceActorsForThread(state, ids) {
+ const sourcesByThread = querySourcesByThreadID(state.sourceActors);
+
+ let sources = [];
+ for (const id of Array.isArray(ids) ? ids : [ids]) {
+ sources = sources.concat(sourcesByThread[id] || []);
+ }
+ return sources;
+}
+
+const queryThreadsBySourceObject = makeReduceAllQuery(
+ actor => ({ thread: actor.thread, source: actor.source }),
+ actors =>
+ actors.reduce((acc, { source, thread }) => {
+ let sourceThreads = acc[source];
+ if (!sourceThreads) {
+ sourceThreads = [];
+ acc[source] = sourceThreads;
+ }
+
+ sourceThreads.push(thread);
+ return acc;
+ }, {})
+);
+
+// Used by threads selectors
+export function getAllThreadsBySource(state) {
+ return queryThreadsBySourceObject(state.sourceActors);
+}
+
+export function getSourceActorBreakableLines(state, id) {
+ const { breakableLines } = getResource(state.sourceActors, id);
+
+ return asSettled(breakableLines);
+}
+
+export function getSourceActorBreakpointColumns(state, id, line) {
+ const { breakpointPositions } = getResource(state.sourceActors, id);
+
+ return asSettled(breakpointPositions.get(line) || null);
+}
+
+// Used by sources selectors
+export const getBreakableLinesForSourceActors = makeWeakQuery({
+ filter: (state, ids) => ids,
+ map: ({ breakableLines }) => breakableLines,
+ reduce: items =>
+ Array.from(
+ items.reduce((acc, item) => {
+ if (item && item.state === "fulfilled") {
+ acc = acc.concat(item.value);
+ }
+ return acc;
+ }, [])
+ ),
+});
diff --git a/devtools/client/debugger/src/selectors/sources.js b/devtools/client/debugger/src/selectors/sources.js
index 7d22bd6fef33..c08002f9e7f7 100644
--- a/devtools/client/debugger/src/selectors/sources.js
+++ b/devtools/client/debugger/src/selectors/sources.js
@@ -35,7 +35,7 @@ import {
getSourceActors,
getAllThreadsBySource,
getBreakableLinesForSourceActors,
-} from "../reducers/source-actors";
+} from "../selectors/source-actors";
import { getAllThreads } from "../selectors/threads";
// This is used by tabs selectors