Bug 1566435 - Make netmonitor destroy codepath synchronous. r=Honza

Differential Revision: https://phabricator.services.mozilla.com/D38370

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-07-17 16:57:53 +00:00
Родитель bffc60754d
Коммит 7d4d01eb1d
6 изменённых файлов: 16 добавлений и 17 удалений

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

@ -3576,11 +3576,11 @@ Toolbox.prototype = {
settleAll(outstanding)
.catch(console.error)
.then(() => {
const api = this._netMonitorAPI;
this._netMonitorAPI = null;
return api ? api.destroy() : null;
}, console.error)
.then(() => {
if (this._netMonitorAPI) {
this._netMonitorAPI.destroy();
this._netMonitorAPI = null;
}
this._removeWindowListeners();
this._removeChromeEventHandlerEvents();

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

@ -29,10 +29,9 @@ NetMonitorPanel.prototype = {
return this;
},
async destroy() {
await this.panelWin.Netmonitor.destroy();
destroy() {
this.panelWin.Netmonitor.destroy();
this.emit("destroyed");
return this;
},
};

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

@ -80,13 +80,13 @@ NetMonitorAPI.prototype = {
/**
* Clean up (unmount from DOM, remove listeners, disconnect).
*/
async destroy() {
destroy() {
this.off(EVENTS.PAYLOAD_READY, this.onPayloadReady);
await this.connector.disconnect();
this.connector.disconnect();
if (this.harExportConnector) {
await this.harExportConnector.disconnect();
this.harExportConnector.disconnect();
}
},

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

@ -68,14 +68,14 @@ NetMonitorApp.prototype = {
/**
* Clean up (unmount from DOM, remove listeners, disconnect).
*/
async destroy() {
destroy() {
unmountComponentAtNode(this.mount);
// Make sure to destroy the API object. It's usually destroyed
// in the Toolbox destroy method, but we need it here for case
// where the Network panel is initialized without the toolbox
// and running in a tab (see initialize.js for details).
await this.api.destroy();
this.api.destroy();
},
/**

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

@ -37,7 +37,7 @@ class ChromeConnector {
this.connector.willNavigate(this.willNavigate);
}
async disconnect() {
disconnect() {
this.connector.disconnect();
}

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

@ -88,12 +88,12 @@ class FirefoxConnector {
}
}
async disconnect() {
disconnect() {
if (this.actions) {
this.actions.batchReset();
}
await this.removeListeners();
this.removeListeners();
if (this.emulationFront) {
this.emulationFront.destroy();
@ -162,7 +162,7 @@ class FirefoxConnector {
await this.webConsoleClient.startListeners(["DocumentEvents"]);
}
async removeListeners() {
removeListeners() {
if (this.tabTarget) {
this.tabTarget.off("close", this.disconnect);
if (this.webSocketFront) {