-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sync xhr in Firefox #47
base: gh-pages
Are you sure you want to change the base?
Conversation
See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest > Note: Starting with Gecko 11.0 (Firefox 11.0 / Thunderbird 11.0 / > SeaMonkey 2.8), Gecko no longer lets you use the withCredentials > attribute when performing synchronous requests. Attempting to do so > throws an NS_ERROR_DOM_INVALID_ACCESS_ERR exception.
Thanks for the PR, though is sync+withCreds xhr allowed in other browsers? |
@jpillora According to W3C spec it is not allowed https://www.w3.org/TR/XMLHttpRequest/#the-withcredentials-attribute
In reality only Firefox enforces this rule so far UPD: I think there is no need to support the functionality that is against the spec even if other browsers are not too strict to the spec yet. So I would merge my pull request without any doubts. But of course you might consider to add browser detection to cover the bug |
Same in chrome now... xhook.before is not working |
Hi There @mnaoumov I've looked at this PR and could not get a failing test case to work. I've modified the test to check that the request does finish and it passes even with a sync XHR. Here is the code for that test: it('sync XHR should not fail', function(done) {
var xhr = new XMLHttpRequest();
xhr.open('GET', '../example/example1.txt', false);
xhr.onload = function() {
expect(xhr.responseText).to.contain('the first text file');
done();
};
xhr.send();
}); Is this still a problem for you? Could you provide a small example where this isn't working? Thanks! |
8977fc1
to
8ec0324
Compare
0d383e5
to
b68decc
Compare
6047ce7
to
07a4ac7
Compare
Fixes #46