refactor($http) Simplify code by removing workarounds for older versions of Internet Explorer

This removes a workaround for IE 8 and and error handling for IE6.

Closes #9300
This commit is contained in:
Rouven Weßling
2014-09-26 16:01:54 +02:00
committed by Igor Minar
parent d9457aa288
commit f52203ce71
2 changed files with 3 additions and 23 deletions

View File

@@ -1,10 +0,0 @@
@ngdoc error
@name $httpBackend:noxhr
@fullName Unsupported XHR
@description
This error occurs in browsers that do not support XmlHttpRequest. AngularJS
supports Safari, Chrome, Firefox, Opera, IE8 and higher, and mobile browsers
(Android, Chrome Mobile, iOS Safari). To avoid this error, use an officially
supported browser.

View File

@@ -1,17 +1,7 @@
'use strict';
function createXhr(method) {
//if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
//is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
//if it is available
if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
!window.XMLHttpRequest)) {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
return new window.XMLHttpRequest();
}
throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
function createXhr() {
return new window.XMLHttpRequest();
}
/**
@@ -59,7 +49,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
});
} else {
var xhr = createXhr(method);
var xhr = createXhr();
xhr.open(method, url, true);
forEach(headers, function(value, key) {