Bug 1465635 - Ensure removing BrowsingContextTarget front events when destroying it. r=jdescottes

When destroying the target, Target.destroy (for local tabs) only calls DebuggerClient.close,
which isn't going to call `detach`. But we still do need to unregister
the tabNavigated/frameUpdate listener to prevent unecessary event from firing.

Depends on D17609

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-01-30 13:28:29 +00:00
Родитель 6483fbf5a1
Коммит 0b98a1f393
1 изменённых файлов: 11 добавлений и 0 удалений

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

@ -169,6 +169,17 @@ class BrowsingContextTargetFront extends
return response;
}
destroy() {
const promise = super.destroy();
// As detach isn't necessarily called on target's destroy
// (it isn't for local tabs), ensure removing listeners set in attach.
this.off("tabNavigated", this._onTabNavigated);
this.off("frameUpdate", this._onFrameUpdate);
return promise;
}
}
exports.BrowsingContextTargetFront = BrowsingContextTargetFront;