| Summary: | Deferred then() throws when called as an unbound method | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Mark Macdonald <mamacdon> |
| Component: | Client | Assignee: | Simon Kaegi <simon_kaegi> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | grant_gayed, simon_kaegi |
| Version: | 2.0 | ||
| Target Milestone: | 3.0 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Mark Macdonald
Grant's fix is to wrap Orion Deferred's implementation of this() with .bind, so it always receives the proper context. However, that causes one of the unit tests dealing with cancellation to fail. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=79fe18727b49d8186a54e9474df4293c51478a5f ^^ We might have to revisit this given the test failure. I guess we could make the value of "thisCancel" be different depending on whether then() was being called on a promise or not. But I really have no idea what the intended semantics are here. :( Being able to call "then" as a pure function is not strictly part of Promises A+ but still worthwhile. For semantics... A user might customize the "cancel" method of a promise so we need to still honor that customization when "then" is called as a function instead of as a method. I've changed the use of "this" in "then" to instead use "_this". "promise.cancel" now uses getter and setters to ensure Deferred.cancel === promise.cancel |