Skip to content

Instantly share code, notes, and snippets.

@ojak
Last active December 15, 2015 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojak/5247073 to your computer and use it in GitHub Desktop.
Save ojak/5247073 to your computer and use it in GitHub Desktop.
Test for XHR when server returns when 204 is encountered on Firefox 19. See Firefox Ticket: https://bugzilla.mozilla.org/show_bug.cgi?id=521301 See jQuery Ticket: http://bugs.jquery.com/ticket/13654
GET http://localhost:8082/204 204 No Content error
XML Parsing Error: no element found Location: moz-nullprincipal:{57add04d-95ad-5842-bfe9-8e2e5e563b98} Line Number 1, Column 1:
XMLHttpRequest { readyState=4, timeout=0, withCredentials=false, more...}
[error ]
<!DOCTYPE html>
<html>
<head>
<script>
var xhr = new XMLHttpRequest();
xhr.open( "GET", "http://localhost:8082/204" );
xhr.onsuccess = function() {
console.log( "success", xhr, arguments );
};
xhr.onerror = function() {
console.log( "error", xhr, arguments );
};
xhr.onabort = function() {
console.log( "abort", xhr, arguments );
};
xhr.ontimeout = function() {
console.log( "timeout", xhr, arguments );
};
xhr.send();
</script>
</head>
<body>
See console.
</body>
</html>
http {
# Include default mime types
include mime.types;
server {
listen 8080;
server_name localhost;
# Serve this page
location = /xhr.html {
autoindex on;
default_type text/html;
alias /path/to/test/file/;
}
# Error code tests
location = /200 {
return 200 '';
}
location = /204 {
return 204;
}
}
server {
listen 8082;
server_name localhost;
# Error code tests
location = /200 {
return 200 '';
}
location = /204 {
return 204;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment