GithubHelp home page GithubHelp logo

Comments (6)

stefanpenner avatar stefanpenner commented on June 9, 2024

promise is defined as the argument:

function getThen(promise) {

And there is no Promise.then.

from es6-promise.

stefanpenner avatar stefanpenner commented on June 9, 2024

We can likely fast path that codepath with some extra checks. Will investigate in the AM

from es6-promise.

hilbix avatar hilbix commented on June 9, 2024

If this is an issue at the "then"able check on resolve(value), then can it be, that IE11 in fact has some issues with objectOrFunction returning true where it shoudn't (i.E. when value===void 0)?

} else if (objectOrFunction(value)) {
handleMaybeThenable(promise, value, getThen(value));

Usually value.then (which is returned by getThen(value)) should give undefined and not throw. Because throwing makes the Promise to recject.

from es6-promise.

stefanpenner avatar stefanpenner commented on June 9, 2024

@hilbix do you have a scenario in mind where that would occur?

from es6-promise.

hilbix avatar hilbix commented on June 9, 2024

@stefanpenner Not particular. This is what I see in the code, not by direct observation. Sorry. Perhaps I was't clear enough to express my thoughts, so 2nd try here ;)

The OP writes, that promise is undefined in getThen(). AFAICS the only code which calls getThen() is the snippet:

handleMaybeThenable(promise, value, getThen(value));

However this is guarded by objectOrFunction(value), hence this must return true on the given value:

export function objectOrFunction(x) {
let type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}

Even if null is not void 0 and redefined to something weird, the typeof x should not give object nor function for non-objects and non-functions. However if it is an object or function, an access to .then should not throw, either.

Well, yes, we can create objects and functions which do not allow access to the property .then. But this then is by purpose, read, perhaps it's better when it throws!

So what's left?

The only thing I can think of is, that, perhaps, the OP returned some IE11-special object from the Promise, which gives either function or object on typeof, but IE11 disallows access to property .then.

In that case, the OP should, please, tell us which type of object the promise was, because this is very esoteric, so hard to find out.

Read: There definitively is too few information to be able to solve this riddle here.

from es6-promise.

stefanpenner avatar stefanpenner commented on June 9, 2024

the OP returned some IE11-special object

@hilbix I agree with your analysis.

from es6-promise.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.