Skip to content

Commit

Permalink
Bugfix: allSettled is not registered when finally is missing (#127)
Browse files Browse the repository at this point in the history
On XP Firefox 52, `Promise.prototype.finally` and `Promise.allSettled` are both undefined.

The current polyfill behavior will only register the `finally` fn and not `allSettled`.
  • Loading branch information
DSergiu authored Oct 22, 2021
1 parent c161f25 commit c00e112
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ var globalNS = (function() {
// https://github.com/taylorhakes/promise-polyfill/issues/114
if (typeof globalNS['Promise'] !== 'function') {
globalNS['Promise'] = Promise;
} else if (!globalNS.Promise.prototype['finally']) {
globalNS.Promise.prototype['finally'] = promiseFinally;
} else if (!globalNS.Promise.allSettled) {
globalNS.Promise.allSettled = allSettled;
} else {
if (!globalNS.Promise.prototype['finally']) {
globalNS.Promise.prototype['finally'] = promiseFinally;
}
if (!globalNS.Promise.allSettled) {
globalNS.Promise.allSettled = allSettled;
}
}

0 comments on commit c00e112

Please sign in to comment.