commit 2cb2c86b05424198a6eb62b5c7f782d1bdfdf313
parent 6b7b5631645f96916f651e3fa5d1151a7696a5cd
Author: Alexandre Poirot <poirot.alex@gmail.com>
Date: Mon, 6 Oct 2025 10:19:18 +0000
Bug 1991420 - [devtools] Drop debugger actions as soon as the panel starts destroying. r=devtools-reviewers,nchevobbe
This reuses the existing middle currently only used by the console.
Differential Revision: https://phabricator.services.mozilla.com/D266650
Diffstat:
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/devtools/client/debugger/src/actions/utils/create-store.js b/devtools/client/debugger/src/actions/utils/create-store.js
@@ -6,7 +6,6 @@
/**
* Redux store utils
- * @module utils/create-store
*/
import {
@@ -20,10 +19,9 @@ import { thunk } from "./middleware/thunk";
import { timing } from "./middleware/timing";
import { context } from "./middleware/context";
-/**
- * @memberof utils/create-store
- * @static
- */
+const {
+ ignore,
+} = require("resource://devtools/client/shared/redux/middleware/ignore.js");
/**
* This creates a dispatcher with all the standard middleware in place
@@ -43,6 +41,7 @@ const configureStore = (opts = {}) => {
thunk(opts.makeThunkArgs),
context,
promise,
+ ignore,
// Order is important: services must go last as they always
// operate on "already transformed" actions. Actions going through
diff --git a/devtools/client/debugger/src/main.js b/devtools/client/debugger/src/main.js
@@ -27,6 +27,11 @@ import { initialEventListenerState } from "./reducers/event-listeners";
const {
sanitizeBreakpoints,
} = require("resource://devtools/client/shared/thread-utils.js");
+const {
+ START_IGNORE_ACTION,
+} = require("resource://devtools/client/shared/redux/middleware/ignore.js");
+
+let gStore;
async function syncBreakpoints() {
const breakpoints = await asyncStore.pendingBreakpoints;
@@ -128,6 +133,7 @@ export async function bootstrap({
panel,
initialState
);
+ gStore = store;
const connected = firefox.onConnect(
commands,
@@ -159,7 +165,18 @@ export async function bootstrap({
}
export async function destroy() {
+ // Instruct redux to start ignoring any further action
+ if (gStore) {
+ gStore.dispatch(START_IGNORE_ACTION);
+ gStore = null;
+ }
+
+ // Unregister all listeners set on DevTools RDP client
firefox.onDisconnect();
+
+ // Unmount all React components
unmountRoot();
+
+ // Unregister and cleanup everything about parser, pretty print and source map workers
teardownWorkers();
}