Bug 1620280 - [devtools] Prevent showing/hiding highlighters when the panels are already destroyed. r=jdescottes

browser_animation_animation-target_select.js was failing on debug builds because of exception during test ends.

Differential Revision: https://phabricator.services.mozilla.com/D91892
This commit is contained in:
Alexandre Poirot 2020-10-05 08:29:12 +00:00
Родитель 2a6162be5b
Коммит 2c5b9717e7
2 изменённых файлов: 10 добавлений и 0 удалений

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

@ -233,6 +233,11 @@ BoxModel.prototype = {
* Hides the box-model highlighter on the currently selected element.
*/
onHideBoxModelHighlighter() {
// As React components aren't destroyed when the panel closes,
// this function may still be called and throw because of destroyed fronts.
if (!this.inspector) {
return;
}
this.inspector.highlighters.hideHighlighterType(
this.inspector.highlighters.TYPES.BOXMODEL
);

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

@ -1927,6 +1927,11 @@ Inspector.prototype = {
* Options passed to the highlighter actor.
*/
onShowBoxModelHighlighterForNode(nodeFront, options) {
// As React components aren't destroyed when the panel closes,
// this function may still be called and throw because of destroyed fronts.
if (this._destroyed) {
return;
}
this.highlighters.showHighlighterTypeForNode(
this.highlighters.TYPES.BOXMODEL,
nodeFront,