taylorhakes/promise-polyfill

Minified code IE8 error

Closed this issue · 3 comments

ECMAScript 3 does not allow bare keywords in dot notation.
but promise.min.js has code like this

o.prototype.catch=function(e){return //...

It causes an error on IE8. "Expected identifier"

in IE8, catch clause causes new kind of hoisting.
https://bocoup.com/weblog/the-catch-with-try-catch

When use minified code at IE8 (== function handle),

    function i(e, n) {
        for (; 3 === e._state;) e = e._value;
        return 0 === e._state ?
               void e._deferreds.push(n) : (e._handled = !0,
                       void o._immediateFn(function() {
            var t = 1 === e._state ? n.onFulfilled : n.onRejected; // e === undefined !!
            if (null === t) return void(1 === e._state ? r : u)(n.promise, e._value);
            var o;
            try {
                o = t(e._value)
            } catch (e) {
                return void u(n.promise, e)
            }
            r(n.promise, o)
        }))
    }

When _immediateFn function called, I receive error message like this
unable to get property '_state' of undefined or null reference

All catch argument name should be changed.

Thanks for bringing this to my attention. I didn't realize the minify was not supporting ie8. I have fixed it in 6.0.2. e20aa90

@taylorhakes I'm still having the same error as @shortstories where even though --support-ie8 is now sent, I get:

unable to get property '_state' of undefined or null reference