martok / palefill

Inject Polyfills for various web technologies into pages requiring them
https://martok.github.io/palefill/
Mozilla Public License 2.0
79 stars 9 forks source link

Promise.any() Polyfill? #74

Closed Sa-Ja-Di closed 1 year ago

Sa-Ja-Di commented 1 year ago

As soon one thing is fixed (Regex) the next Javascript attack is on its way, seems that now pages require the

Promise.any()

specification. Any chance to add a Polyfill for this too? Test page regarding this can be found in the PM forum post here:

https://forum.palemoon.org/viewtopic.php?f=3&t=29245 (https://bnz.co.nz/)

Or perhaps you can help them out again with your coding magic like you did with the Regex stuff? Moonchild would for sure to be willing to give you a bounty for this too again ;)

Repo page for this issue: https://repo.palemoon.org/MoonchildProductions/UXP/issues/2077

)

Vangelis66 commented 1 year ago

Any chance to add a Polyfill for this too? ... (https://bnz.co.nz/)

... This is a banking site... From a previous issue in this tracker:

..., banking sites are one thing I'm not going to touch.

As for Promise.any() in general, see:
https://github.com/ungap/promise-any

Upstream (github-wc-polyfill) had the following implementation:

if (!('any' in Promise && typeof Promise.any == 'function')) Promise.any = function($) {
    return new Promise(function(D, E, A, L) {
        A = [];
        L = $.map(function($, i) {
            return Promise.resolve($).then(D, function(O) {
                return ((A[i] = O), --L) || E({
                    errors: A
                });
            });
        }).length;
    });
};
martok commented 1 year ago

Resolved by modernising Promises in UXP#2089.

However, that still doesn't resolve the original site because they serve a polyfill that doesn't contain all functions they need. Without that, it would likely work. That's a bug and somebody should tell their web team...

martok commented 6 months ago

Resolved as UXP#2436 by implementing one more Promise feature.