javascript - Q- a resolved promise not calling the next task, Safari 6.1 + and 7+ -


We have a class as part of a larger framework, and we use Q as our instrument library .

We have a function that you see below. This._ getData () gives a promise, and 'again' all other functions get a value properly and return it.

Everything Most of the time.

Sometimes in Safari 6.1+ and 7+ (primarily when the data is not yet in the cache, i.e. the first time any request is made), the first promise (this._ getData () ) and completed (I created a local log to make sure it), but none of the 'again' is said. Q does not pass the entire task in the next task.

A bug that looked like in Q v0.8, which was fixed in v0.9, but we upgraded to v0.9 and did not solve this problem.

Here's the code:

  some asynchronous: function () {var promise = this._getData (). Then (this._doSomething_1). Then (This._doSomething_2) .then (...). Then (...). Then (this._doSomething_n) .fail (this._onFail); Return promise; }  

It is interesting to note that after the bug, the queue is completely broken. This may have been broken before the request due to some other reason that failed to use the Q, but we do not see any exceptions.

Completely broken, I mean that on any page usually Q (and when the bug is not there), if you type it in the console:

  Q (1) .then (function () {console.log ('has happened');});  

Then you will see the console log.

However, when a bug occurs, it does not happen.

Even trying is:

  var promise = Q (1); promise. Then (function () {console.log ('has happened');}); // Nothing promises promise.isFulfilled () / / true  

which looks like the Q is just stuck in some strange situation where it believes that it is not really When it is not really, then it never goes to the next task.

This is actually what we are really experiencing, because it _getData () creates a new promise, makes an AJAX call on the server and passes the resolved object to resolve the callback, and successfully resolves the promise - but none of the following actions is called.

If anyone has to face it and how to fix it, or how it is known how to continue debugging it

Update: After debugging further, it surely shows that the Q gets slammed on one task, and therefore is never able to move forward.


Comments