Bug 1439101 - Port bug 1431960 to TB: Forcibly construct the frame for browser to construct browser binding in preferences subdialog. r=jorgk

This commit is contained in:
Richard Marti 2018-02-17 13:22:46 +01:00
Родитель e8df6b6ebe
Коммит 4f5a651b2b
1 изменённых файлов: 16 добавлений и 1 удалений

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

@ -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();
}
},