Bug 1567860 - Make changes view destroy codepath synchronous. r=rcaliman

The fronts are destroyed when the toolbox closes and when a front is destroyed,
all its listeners are removed. So there is no real value in trying to unregister
them. On top of that, this destroy method is called by Inspector.destroy
and doesn't wait for its completion.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-07-25 11:54:20 +00:00
Родитель 2ee4c1769e
Коммит 91c0c3d8b5
1 изменённых файлов: 1 добавлений и 6 удалений

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

@ -228,14 +228,9 @@ class ChangesView {
/**
* Destruction function called when the inspector is destroyed.
*/
async destroy() {
destroy() {
this.store.dispatch(resetChanges());
// ensure we finish waiting for the front before destroying.
const changesFront = await this.changesFrontPromise;
changesFront.off("add-change", this.onAddChange);
changesFront.off("clear-changes", this.onClearChanges);
this.document = null;
this.inspector = null;
this.store = null;