Work-around for Moz bug #608735 #8

wants to merge 2 commits into from

1 participant


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:

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

Nicolas LaCasse and others added some commits Feb 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment