Bug 1358267 - Abort RDM set size when closing. r=gl
MozReview-Commit-ID: 9noch5Bgu9q
--- 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);
}
},