🌐 AI搜索 & 代理 主页
Skip to content

Deferred: behavior different from ECMAScript Promise for objects with [[Call]] #3596

@akihikodaki

Description

@akihikodaki

Description

jQuery's Deferred is expected to be a close approximation to Promise of ECMAScript 2016 Language Specification. Promise defined in ECMAScript 2016 tests onFulfilled, onRejected and then are objects with [[Call]].
However, isFunction, used in the Deferred, tests toStringTag, which is irrelevant from the definition. As the result, Deferred shows different behaviors for some objects such as GeneratorFunction.

Link to test case

https://jsbin.com/civabuxabe/1/edit?js,console
Expected [object Generator] { ... }, but results in 0.

jQuery.Deferred()
  .resolve(0)
  .then(function *() {})
  .then(console.log);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions