-
Notifications
You must be signed in to change notification settings - Fork 520
XHR API ignores the async argument #417
Comments
There's no support for sync XHR and never will be. On Thursday, October 4, 2012 at 3:07 PM, sankargorthi wrote:
|
That's too bad. I really like zombie and I've been trying to hack the code locally to load our company's application using dojo 1.5.2 (am stuck with using that version as it's an enterprise application). Could you give me any pointers on where I could propagate the sync flag to? I see that the request goes to the EventQueue.prototype.http({ _makeRequest seems to be making a call to Request ... (that's as far as I've got...). Will keep digging. But any pointers would be extremely helpful. |
It's a fairly complex hack because XHR sync has to block other JavaScript and resources from loading (also, why it's recommended to not use it). On Thursday, October 4, 2012 at 7:21 PM, sankargorthi wrote:
|
I understand. However, I'm stuck with using the dojo library and a UI framework that does make a lot of sync requests (we're working on moving them to async, but it'll take some time). In the mean time, I would like to use Cucumber to write test cases and Zombie to visit the pages in the test case implementation as I find them to be the best long term solution to testing our application. I'll work some more on trying to support async==false operations on XHR.open on the fork I've created: https://github.com/sankargorthi/zombie Any comments or suggestions are greatly appreciated and desperately needed. |
I'm writing this mainly for the benefit of others in a similar situation. I'm using Backbone Boilerplate which makes synchronous AJAX requests to grab html template files. The result is I can't test the 'dev' version of my app, and must compile the templates into the JST object prior to testing. |
You need to block the JS runtime while the XHR request is executing. It may be possible with native C code. On Thu, Mar 14, 2013 at 10:09 AM, Chris notifications@github.com wrote:
|
I've forked the project and added some code for supporting sync xhr. It basically does not queue the callbacks but call them directly. It seems to be working for me, implementation has become a little hacky tough. Anyone needing this feature can have a look. |
Hi @assaf |
@ericminio it doesn't return XHR response synchronously, so the only way it could work is if you set And if you handle the response synchronously, good luck figuring out why Zombie says there's a response, but you can't use it. |
It's a pity that zombie will never support basic browser functionality. I wanted to use it to tests, but I simulate fileReadSync for ejs with $.ajax({async: false}) |
When an XHR.open call is made with async ===false, the API ignores it and returns the http event queue object anyway.
This can be experienced when trying to call dojo.require in dojo 1.5.2. This causes the request to be interpreted as a failure (dojo expects the request to be synchronous).
The text was updated successfully, but these errors were encountered: