mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 992371 - Avoid promise rejection messages from FxAccounts. r=ttaubert
This commit is contained in:
parent
2c4b311956
commit
df6265d9a7
@ -177,7 +177,7 @@ let gFxAccounts = {
|
|||||||
|
|
||||||
// If the user is signed into their Firefox account and we are not
|
// If the user is signed into their Firefox account and we are not
|
||||||
// currently in customization mode, show their email address.
|
// currently in customization mode, show their email address.
|
||||||
fxAccounts.getSignedInUser().then(userData => {
|
let doUpdate = userData => {
|
||||||
// Reset the button to its original state.
|
// Reset the button to its original state.
|
||||||
this.button.setAttribute("label", defaultLabel);
|
this.button.setAttribute("label", defaultLabel);
|
||||||
this.button.removeAttribute("tooltiptext");
|
this.button.removeAttribute("tooltiptext");
|
||||||
@ -194,6 +194,15 @@ let gFxAccounts = {
|
|||||||
this.button.setAttribute("tooltiptext", userData.email);
|
this.button.setAttribute("tooltiptext", userData.email);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
fxAccounts.getSignedInUser().then(userData => {
|
||||||
|
doUpdate(userData);
|
||||||
|
}).then(null, error => {
|
||||||
|
// This is most likely in tests, were we quickly log users in and out.
|
||||||
|
// The most likely scenario is a user logged out, so reflect that.
|
||||||
|
// Bug 995134 calls for better errors so we could retry if we were
|
||||||
|
// sure this was the failure reason.
|
||||||
|
doUpdate(null);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -669,6 +669,13 @@ FxAccountsInternal.prototype = {
|
|||||||
this.pollTimeRemaining = this.POLL_SESSION;
|
this.pollTimeRemaining = this.POLL_SESSION;
|
||||||
if (!currentState.whenVerifiedDeferred) {
|
if (!currentState.whenVerifiedDeferred) {
|
||||||
currentState.whenVerifiedDeferred = Promise.defer();
|
currentState.whenVerifiedDeferred = Promise.defer();
|
||||||
|
// This deferred might not end up with any handlers (eg, if sync
|
||||||
|
// is yet to start up.) This might cause "A promise chain failed to
|
||||||
|
// handle a rejection" messages, so add an error handler directly
|
||||||
|
// on the promise to log the error.
|
||||||
|
currentState.whenVerifiedDeferred.promise.then(null, err => {
|
||||||
|
log.info("the wait for user verification was stopped: " + err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user