Bug 1665716 - [devtools] Listen to all resources only from one place in the debugger frontend. r=bomsy,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D103876
This commit is contained in:
Alexandre Poirot 2021-02-08 10:12:49 +00:00
parent f9e7f781e5
commit 3c74a1c5d5
2 changed files with 6 additions and 11 deletions

View File

@ -77,12 +77,6 @@ class DebuggerPanel {
registerStoreObserver(this._store, this._onDebuggerStateChange.bind(this));
const resourceWatcher = this.toolbox.resourceWatcher;
await resourceWatcher.watchResources(
[resourceWatcher.TYPES.ERROR_MESSAGE],
{ onAvailable: actions.addExceptionFromResources }
);
return this;
}
@ -273,11 +267,6 @@ class DebuggerPanel {
}
destroy() {
const resourceWatcher = this.toolbox.resourceWatcher;
resourceWatcher.unwatchResources([resourceWatcher.TYPES.ERROR_MESSAGE], {
onAvailable: this._actions.addExceptionFromResources,
});
this.panelWin.Debugger.destroy();
this.emit("destroyed");
}

View File

@ -57,6 +57,9 @@ export async function onConnect(
await resourceWatcher.watchResources([resourceWatcher.TYPES.THREAD_STATE], {
onAvailable: onBreakpointAvailable,
});
await resourceWatcher.watchResources([resourceWatcher.TYPES.ERROR_MESSAGE], {
onAvailable: actions.addExceptionFromResources,
});
}
export function onDisconnect() {
@ -71,6 +74,9 @@ export function onDisconnect() {
resourceWatcher.unwatchResources([resourceWatcher.TYPES.THREAD_STATE], {
onAvailable: onBreakpointAvailable,
});
resourceWatcher.unwatchResources([resourceWatcher.TYPES.ERROR_MESSAGE], {
onAvailable: actions.addExceptionFromResources,
});
sourceQueue.clear();
}