Giter VIP home page Giter VIP logo

Comments (7)

ysmood avatar ysmood commented on July 16, 2024

Don't worry about the Symbol, the comparison graph is based on Node v5.0+, and will always use the lastest version of Node.

from yaku.

ysmood avatar ysmood commented on July 16, 2024

The readme is updated. You lib passed all tests. Thanks for your report.

from yaku.

hax avatar hax commented on July 16, 2024

Test case "subclass PromiseCapability promise.then TypeError" is still incorrect. It should not throw error. To throw error you need to specify Symbol.species for fake constructor 😈

from yaku.

ysmood avatar ysmood commented on July 16, 2024

But, I read the https://tc39.github.io/ecma262/#sec-newpromisecapability

If IsCallable(promiseCapability.[[Resolve]]) is false, throw a TypeError exception.

The newly created promiseCapability should have a resolve handler.

from yaku.

hax avatar hax commented on July 16, 2024

The test case call promise.then(function () {}) with promise.constructor = function () {}.

See 25.4.5.3 Promise.prototype.then

3 . Let C be ? SpeciesConstructor(promise, %Promise%).

Step 3 passes promise with %Promise% (the original Promise constructor) as defaultConstructor

See 7.3.20 SpeciesConstructor

  1. Assert: Type(O) is Object.
  2. Let C be ? Get(O, "constructor").
  3. If C is undefined, return defaultConstructor.
  4. If Type(C) is not Object, throw a TypeError exception.
  5. Let S be ? Get(C, @@species).
  6. If S is either undefined or null, return defaultConstructor.
  7. If IsConstructor(S) is true, return S.
  8. Throw a TypeError exception.

Step 2: C = function () {}
Step 5: S = undefined
Step 6: return %Promise%

Then NewPromiseCapability is called with original Promise constructor.

from yaku.

ysmood avatar ysmood commented on July 16, 2024

You are right, I added a global Symbol.species to make the test possible: ccd5a01#diff-e2686e2925145c11799d638b2f4706dcR8

But I don't know why my-promise still has 1 failure:

$ npm run no -- test-basic -s my-promise

junit cli > x basic - subclass (21ms)

  <<<<<<< actual
  [ 'subclass',
    undefined,
    'subclass',
    undefined,
    'subclass',
    true,
    true,
    5,
    6 ]
  =======
  [ 'subclass',
    'subclass',
    'subclass',
    'subclass',
    'subclass',
    true,
    true,
    5,
    6 ]
  >>>>>>> expected

  Error: Assertion

from yaku.

hax avatar hax commented on July 16, 2024

I will check it later.

from yaku.

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.