Bug 1444132 - Always wait for full Connector setup in getHarExportConnector. r=jdescottes

MozReview-Commit-ID: 2k18TK78fk8

--HG--
extra : rebase_source : 4bbe481d3724dc7bb3e26eb79bfa8351c22bcf32
This commit is contained in:
Alexandre Poirot 2018-08-01 09:47:20 -07:00
parent d41a01a8c9
commit 2b5681f94c

View File

@ -178,6 +178,9 @@ NetMonitorAPI.prototype = {
*/
async getHarExportConnector() {
if (this.harExportConnector) {
// Ensure waiting for connectBackend completion to prevent "this.connector is null"
// exceptions if getHarExportConnector is called twice during its initialization.
await this.harExportConnectorReady;
return this.harExportConnector;
}
@ -189,7 +192,9 @@ NetMonitorAPI.prototype = {
};
this.harExportConnector = new Connector();
await this.connectBackend(this.harExportConnector, connection);
this.harExportConnectorReady =
this.connectBackend(this.harExportConnector, connection);
await this.harExportConnectorReady;
return this.harExportConnector;
},
};