Open reply dialog should be executed even if overlay failed
Reject promise if gr-overlay failed to resolve Bug: Issue 10774 Bug: Issue 12180 Change-Id: I0db37e64245aecc2672999b4de108f308bb0fc11
This commit is contained in:
@@ -1260,7 +1260,8 @@
|
|||||||
* @param {string=} opt_section
|
* @param {string=} opt_section
|
||||||
*/
|
*/
|
||||||
_openReplyDialog(opt_section) {
|
_openReplyDialog(opt_section) {
|
||||||
this.$.replyOverlay.open().then(() => {
|
this.$.replyOverlay.open().finally(() => {
|
||||||
|
// the following code should be executed no matter open succeed or not
|
||||||
this._resetReplyOverlayFocusStops();
|
this._resetReplyOverlayFocusStops();
|
||||||
this.$.replyDialog.open(opt_section);
|
this.$.replyDialog.open(opt_section);
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
|
|||||||
@@ -63,13 +63,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
open(...args) {
|
open(...args) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve, reject) => {
|
||||||
Polymer.IronOverlayBehaviorImpl.open.apply(this, args);
|
Polymer.IronOverlayBehaviorImpl.open.apply(this, args);
|
||||||
if (this._isMobile()) {
|
if (this._isMobile()) {
|
||||||
this.fire('fullscreen-overlay-opened');
|
this.fire('fullscreen-overlay-opened');
|
||||||
this._fullScreenOpen = true;
|
this._fullScreenOpen = true;
|
||||||
}
|
}
|
||||||
this._awaitOpen(resolve);
|
this._awaitOpen(resolve, reject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
* NOTE: (wyatta) Slightly hacky way to listen to the overlay actually
|
* NOTE: (wyatta) Slightly hacky way to listen to the overlay actually
|
||||||
* opening. Eventually replace with a direct way to listen to the overlay.
|
* opening. Eventually replace with a direct way to listen to the overlay.
|
||||||
*/
|
*/
|
||||||
_awaitOpen(fn) {
|
_awaitOpen(fn, reject) {
|
||||||
let iters = 0;
|
let iters = 0;
|
||||||
const step = () => {
|
const step = () => {
|
||||||
this.async(() => {
|
this.async(() => {
|
||||||
@@ -105,11 +105,7 @@
|
|||||||
} else if (iters++ < AWAIT_MAX_ITERS) {
|
} else if (iters++ < AWAIT_MAX_ITERS) {
|
||||||
step.call(this);
|
step.call(this);
|
||||||
} else {
|
} else {
|
||||||
// TODO(crbug.com/gerrit/10774): Once this is confirmed as the root
|
reject(new Error('gr-overlay _awaitOpen failed to resolve'));
|
||||||
// cause of the bug, fix it by either making sure to resolve the fn
|
|
||||||
// function or find a better way to listen on the overlay being
|
|
||||||
// shown.
|
|
||||||
console.warn('gr-overlay _awaitOpen failed to resolve');
|
|
||||||
}
|
}
|
||||||
}, AWAIT_STEP);
|
}, AWAIT_STEP);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user