Skip to content
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

Work-around for Moz bug #608735 #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nlacasse
Copy link

@nlacasse nlacasse commented Feb 5, 2012

Oh Firefox....

Mozilla bug #608735 has been open for over a year, and it's not clear if it will get fixed soon.

The bug description is basically this:
If an XHR is a CORS request, then xhr.getAllResponseHeaders will always return {}.

xhr.getResponseHeader still works as expected.

The jQuery guys have been complaining about this bug and passing around patches here:
http://bugs.jquery.com/ticket/10338

This patch is my attempt to work around the Mozilla bug. It makes response.getHeader() work as expected for a CORS request, which it currentlyo does not.

This patch does 3 things:

  1. Renames the res variable to xhr in response.js. This makes sense, because it is an xhr, and is less likely to be confused with Response.
  2. Stores the response's xhr in this.xhr, so the Response methods have access to it and don't need to pass it around.
  3. Makes response.getHeader call xhr.getResponseHeader directly if the header isn't in the header hash.

The first 2 were necessary cleanup to make the 3rd possible. It touches a lot of code, but most of the changes are trivial.

Review on Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant