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

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-07-25 11:54:11 +00:00
Родитель 23b65ca007
Коммит 371c9012b2
2 изменённых файлов: 9 добавлений и 12 удалений

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

@ -1615,7 +1615,7 @@ Inspector.prototype = {
const ruleViewSideBarDestroyer = this.ruleViewSideBar
? this.ruleViewSideBar.destroy()
: null;
const markupDestroyer = this._destroyMarkup();
this._destroyMarkup();
this.teardownToolbar();
@ -1643,7 +1643,6 @@ Inspector.prototype = {
this.telemetry = null;
this._panelDestroyer = promise.all([
markupDestroyer,
sidebarDestroyer,
ruleViewSideBarDestroyer,
]);

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

@ -271,7 +271,7 @@ MarkupView.prototype = {
* destroyed while still initializing (and making protocol requests).
*/
_handleRejectionIfNotDestroyed: function(e) {
if (!this._destroyer) {
if (!this._destroyed) {
console.error(e);
}
},
@ -798,7 +798,7 @@ MarkupView.prototype = {
const onShow = this.showNode(selection.nodeFront, { slotted, smoothScroll })
.then(() => {
// We could be destroyed by now.
if (this._destroyer) {
if (this._destroyed) {
return promise.reject("markupview destroyed");
}
@ -1408,7 +1408,7 @@ MarkupView.prototype = {
}
this._waitForChildren().then(() => {
if (this._destroyer) {
if (this._destroyed) {
// Could not fully update after markup mutations, the markup-view was destroyed
// while waiting for children. Bail out silently.
return;
@ -1508,7 +1508,7 @@ MarkupView.prototype = {
return this._waitForChildren()
.then(() => {
if (this._destroyer) {
if (this._destroyed) {
return promise.reject("markupview destroyed");
}
return this._ensureVisible(node);
@ -1535,7 +1535,7 @@ MarkupView.prototype = {
*/
_expandContainer: function(container) {
return this._updateChildren(container, { expand: true }).then(() => {
if (this._destroyer) {
if (this._destroyed) {
// Could not expand the node, the markup-view was destroyed in the meantime. Just
// silently give up.
return;
@ -2200,11 +2200,11 @@ MarkupView.prototype = {
* Tear down the markup panel.
*/
destroy: function() {
if (this._destroyer) {
return this._destroyer;
if (this._destroyed) {
return;
}
this._destroyer = promise.resolve();
this._destroyed = true;
this._clearBriefBoxModelTimer();
@ -2280,8 +2280,6 @@ MarkupView.prototype = {
this._lastDropTarget = null;
this._lastDragTarget = null;
return this._destroyer;
},
/**