Commit 110f3121 authored by Alexandre Poirot's avatar Alexandre Poirot
Browse files

Bug 1569676 - Make memory panel's destroy synchronous. r=jdescottes

The memory actor is a target scoped one and they are all destroyed
when the toolbox closes. So memory actor's destroy method is called.
It then calls bridge's destroy, which also detach the actor if it was
attached.

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

--HG--
extra : moz-landing-system : lando
parent 00643d0c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ const initialize = async function() {
  window.gStore = store;
};

const destroy = async function() {
const destroy = function() {
  const ok = ReactDOM.unmountComponentAtNode(root);
  assert(
    ok,
+12 −15
Original line number Diff line number Diff line
@@ -52,15 +52,15 @@ MemoryPanel.prototype = {
    return this._toolbox.target;
  },

  async destroy() {
  destroy() {
    // Make sure this panel is not already destroyed.
    if (this._destroyer) {
      return this._destroyer;
    if (this._destroyed) {
      return;
    }
    this._destroyed = true;

    await this.panelWin.gFront.detach();
    this.initializer.destroy();

    this._destroyer = this.initializer.destroy().then(() => {
    // Destroy front to ensure packet handler is removed from client
    this.panelWin.gFront.destroy();
    this.panelWin.gHeapAnalysesClient.destroy();
@@ -68,9 +68,6 @@ MemoryPanel.prototype = {
    this._opening = null;
    this.isReady = false;
    this.emit("destroyed");
    });

    return this._destroyer;
  },
};