src/javascript/xhr/XMLHttpRequest.js
function _p(prop, value) {
			if (!props.hasOwnProperty(prop)) {
				return;
			}
			if (arguments.length === 1) { // get
				return Env.can('define_property') ? props[prop] : self[prop];
			} else { // set
				if (Env.can('define_property')) {
					props[prop] = value;
				} else {
					self[prop] = value;
				}
			}
		}
function _p(prop, value) {
			if (!props.hasOwnProperty(prop)) {
				return;
			}
			if (arguments.length === 1) { // get
				return Env.can('define_property') ? props[prop] : self[prop];
			} else { // set
				if (Env.can('define_property')) {
					props[prop] = value;
				} else {
					self[prop] = value;
				}
			}
		}
/* this is nice, but maybe too lengthy

if supported by JS version, set getters/setters for specific properties
o.defineProperty(this, 'readyState', {
configurable: false,

get: function() {
return _p('readyState');
}
});

o.defineProperty(this, 'timeout', {
configurable: false,

get: function() {
return _p('timeout');
},

set: function(value) {

if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}

timeout still should be measured relative to the start time of request
_timeoutset_time = (new Date).getTime();

_p('timeout', value);
}
});

the withCredentials attribute has no effect when fetching same-origin resources
o.defineProperty(this, 'withCredentials', {
configurable: false,

get: function() {
return _p('withCredentials');
},

set: function(value) {
1-2
if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}

3-4
if (_anonymous_flag || _sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}

5
_p('withCredentials', value);
}
});

o.defineProperty(this, 'status', {
configurable: false,

get: function() {
return _p('status');
}
});

o.defineProperty(this, 'statusText', {
configurable: false,

get: function() {
return _p('statusText');
}
});

o.defineProperty(this, 'responseType', {
configurable: false,

get: function() {
return _p('responseType');
},

set: function(value) {
1
if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}

2
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}

3
_p('responseType', value.toLowerCase());
}
});

o.defineProperty(this, 'responseText', {
configurable: false,

get: function() {
1
if (!~o.inArray(_p('responseType'), ['', 'text'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}

2-3
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}

return _p('responseText');
}
});

o.defineProperty(this, 'responseXML', {
configurable: false,

get: function() {
1
if (!~o.inArray(_p('responseType'), ['', 'document'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}

2-3
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}

return _p('responseXML');
}
});

o.defineProperty(this, 'response', {
configurable: false,

get: function() {
if (!!~o.inArray(_p('responseType'), ['', 'text'])) {
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
return '';
}
}

if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
return null;
}

return _p('response');
}
});