Bug 1358267 - Abort RDM set size when closing. r=gl
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 01 Jun 2017 09:48:42 -0500
changeset 412843 8882fa7e5464ef55adf47ee47eea2aa4f48d7744
parent 412842 8814375529f130f680f1257c14a678bbc65ce440
child 412844 5cc0b9a19f37a067c4a511b0d489e0b3b272584f
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1358267
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1358267 - Abort RDM set size when closing. r=gl MozReview-Commit-ID: 9noch5Bgu9q
devtools/client/responsivedesign/responsivedesign.jsm
--- a/devtools/client/responsivedesign/responsivedesign.jsm
+++ b/devtools/client/responsivedesign/responsivedesign.jsm
@@ -358,17 +358,19 @@ ResponsiveUI.prototype = {
                 "max-height: none;" +
                 "min-height: 0;";
     debug("RESET STACK SIZE");
     this.stack.setAttribute("style", style);
 
     // Wait for resize message before stopping in the child when testing,
     // but only if we should expect to still get a message.
     if (flags.testing && this.tab.linkedBrowser.messageManager) {
+      debug("CLOSE: WAIT ON CONTENT RESIZE");
       yield this.waitForMessage("ResponsiveMode:OnContentResize");
+      debug("CLOSE: CONTENT RESIZE DONE");
     }
 
     if (this.isResizing) {
       this.stopResizing();
     }
 
     // Remove listeners.
     this.menulist.removeEventListener("select", this.boundPresetSelected, true);
@@ -400,29 +402,34 @@ ResponsiveUI.prototype = {
     this.container.removeAttribute("responsivemode");
     this.stack.removeAttribute("responsivemode");
 
     ActiveTabs.delete(this.tab);
     if (this.touchEventSimulator) {
       this.touchEventSimulator.stop();
     }
 
+    debug("CLOSE: WAIT ON CLIENT CLOSE");
     yield this.client.close();
+    debug("CLOSE: CLIENT CLOSE DONE");
     this.client = this.emulationFront = null;
 
     this._telemetry.toolClosed("responsive");
 
     if (this.tab.linkedBrowser && this.tab.linkedBrowser.messageManager) {
       let stopped = this.waitForMessage("ResponsiveMode:Stop:Done");
       this.tab.linkedBrowser.messageManager.sendAsyncMessage("ResponsiveMode:Stop");
+      debug("CLOSE: WAIT ON STOP");
       yield stopped;
+      debug("CLOSE: STOP DONE");
     }
 
     this.hideNewUINotification();
 
+    debug("CLOSE: DONE, EMIT OFF");
     this.inited = null;
     ResponsiveUIManager.emit("off", { tab: this.tab });
   }),
 
   waitForMessage(message) {
     return new Promise(resolve => {
       let listener = () => {
         this.mm.removeMessageListener(message, listener);
@@ -1124,16 +1131,20 @@ ResponsiveUI.prototype = {
     };
   },
 
   /**
    * Change the size of the viewport.
    */
   setViewportSize({ width, height }) {
     debug(`SET SIZE TO ${width} x ${height}`);
+    if (this.closing) {
+      debug(`ABORT SET SIZE, CLOSING`);
+      return;
+    }
     if (width) {
       this.setWidth(width);
     }
     if (height) {
       this.setHeight(height);
     }
   },