Closed kumavis closed 8 years ago
Hi thanks for the PR. I would say, even if the previous behavior was maybe not the good one, this is probably a breaking change since the ('on', fn(request)) is now called only when send() is called.
What do you think?
Tested it on one of our projects and it works well
tests are failing on node 0.12, I believe this is due to the change between setTimeout and process.nextTick
I would not bare understand the problem fully, node-mitm is pretty hacky already so it might just be a complex timers issue.
Maybe switch back to process.nextTick for now?
Maybe we also need a specific async test, for consistency
yeah i found the test failures to be a bit mysterious.. seems unrelated but I assume they were passing previously -- however the change I made is only in browser.js
so its not run in the node tests, right?
yeah here is the same failure from 10 days ago https://travis-ci.org/algolia/faux-jax/jobs/104474441 from https://github.com/algolia/faux-jax/compare/89637d387fd4...049d2e6c2d14
must be a race condition?
PR is ok on my side when tested, I upgraded the master branch of faux-jax to handle the thrown exception
Merged, I will add you as a collaborator to the project also, so you can contribute... MOAR
Added you to both github and npm, feel free to do a release:
That's it :)
Where are you using faux-jax?
Thanks : )
I'm working on a chrome extension that extends the normal web api with support for Ethereum, a blockchain based decentralized app platform. The ecosystem is quite early, and many ethereum apps attempt to connect to the network the same way they've been developed, connecting directly to localhost. I used faux-jax
to optionally man-in-the-middle connections to the localhost and handle them normally. There are some chrome apis for doing this from an extension but they fail if CORS preflight fails. To be honest I can't believe you can actually overwrite window.XMLHttpRequest
, but that is the world today.
I also noticed you have an oakland.js shirt -- cool!
To be honest I can't believe you can actually overwrite window.XMLHttpRequest, but that is the world today
Yes, we even wrote something as a tiny module to do so in very old browsers you do not want to know about but here it is: https://github.com/algolia/writable-window-method
I also noticed you have an oakland.js shirt -- cool!
Yes as a "fan" of @substack :)
writable-window-method
woah. nope, no thanks. I am able to pretend IE doesnt exist and I'm happier for it.
This change allows synchronous xhr results to be submitted synchronously if
request.respond
is called in the same frame as therequest
event was emitted.conversely, this also guarantees async xhrs are guaranteed to be async even if
request.respond
is called in the same frame as therequest
event was emitted.Added a test to ensure this behavior. All tests pass.