Bug 1420037 - Fix netmonitor "dataProvider is null" exception on DAMP. r=Honza
MozReview-Commit-ID: EhCSSV0ZFrB
--- a/devtools/client/netmonitor/src/connector/firefox-connector.js
+++ b/devtools/client/netmonitor/src/connector/firefox-connector.js
@@ -78,16 +78,17 @@ class FirefoxConnector {
this.removeListeners();
this.tabTarget.off("will-navigate");
this.tabTarget = null;
this.webConsoleClient = null;
this.timelineFront = null;
this.dataProvider = null;
+ this.panel = null;
}
pause() {
this.removeListeners();
}
resume() {
this.addListeners();
@@ -124,21 +125,25 @@ class FirefoxConnector {
}
navigate() {
if (this.dataProvider.isPayloadQueueEmpty()) {
this.onReloaded();
return;
}
let listener = () => {
- if (!this.dataProvider.isPayloadQueueEmpty()) {
+ if (this.dataProvider && !this.dataProvider.isPayloadQueueEmpty()) {
return;
}
window.off(EVENTS.PAYLOAD_READY, listener);
- this.onReloaded();
+ // Netmonitor may already be destroyed,
+ // so do not try to notify the listeners
+ if (this.dataProvider) {
+ this.onReloaded();
+ }
};
window.on(EVENTS.PAYLOAD_READY, listener);
}
onReloaded() {
this.panel.emit("reloaded");
}