From 4f5a651b2b63f5fe7b0508ae3ca0ecc63d45a15f Mon Sep 17 00:00:00 2001 From: Richard Marti Date: Sat, 17 Feb 2018 13:22:46 +0100 Subject: [PATCH] Bug 1439101 - Port bug 1431960 to TB: Forcibly construct the frame for browser to construct browser binding in preferences subdialog. r=jorgk --- mail/components/preferences/subdialogs.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mail/components/preferences/subdialogs.js b/mail/components/preferences/subdialogs.js index 12be9c1429..15fd4529e3 100644 --- a/mail/components/preferences/subdialogs.js +++ b/mail/components/preferences/subdialogs.js @@ -71,6 +71,16 @@ SubDialog.prototype = { async open(aURL, aFeatures = null, aParams = null, aClosingCallback = null) { // Wait until frame is ready to prevent browser crash in tests await this._frameCreated; + + if (!this._frame.contentWindow) { + // Given the binding constructor execution is asynchronous, and "load" + // event can be dispatched before the browser element is shown, the + // browser binding might not be constructed at this point. Forcibly + // construct the frame and construct the binding. + // FIXME: Remove this (bug 1437247) + this._frame.getBoundingClientRect(); + } + // If we're open on some (other) URL or we're closing, open when closing has finished. if (this._openedURL || this._isClosing) { if (!this._isClosing) { @@ -511,6 +521,12 @@ var gSubDialog = { return; } + if (this._dialogs.length == 0) { + // When opening the first dialog, show the dialog stack to make sure + // the browser binding can be constructed. + this._dialogStack.hidden = false; + } + this._preloadDialog.open(aURL, aFeatures, aParams, aClosingCallback); this._dialogs.push(this._preloadDialog); this._preloadDialog = new SubDialog({template: this._dialogTemplate, @@ -518,7 +534,6 @@ var gSubDialog = { id: this._nextDialogID++}); if (this._dialogs.length == 1) { - this._dialogStack.hidden = false; this._ensureStackEventListeners(); } },