Closed codeworrior closed 5 years ago
Good catch! As a spec reviewer I am embarrassed this slipped past my implementations.
I’ll accept a PR, I should have time in the next day or so to fix myself if someone else doesn’t beat me to it
-> PR #339.
Credits for the finding go to @ThomasChadzelek and @PeterBuchholz.
fix released as v4.2.5 🎉
thanks @codeworrior, @ThomasChadzelek and @PeterBuchholz for the PR.
According to draft 4 of the Promise.prototype.finally spec , the
callback
parameter is kind of optional. When it is not a Callable,then
should be invoked with thecallback
"as is", e.g. something like this:I understand that it doesn't seem to be reasonable to use
finally
without acallback
. But generic code that receives some callback as parameter and propagates it to aPromise.prototype.finally
now additionally has to check it for being a function. And I guess, a polyfill in general should be as close to the spec as possible.Chrome 68, Firefox 61, Safari 11.1 all don't fail when executing