Update build 0.6.1
This commit is contained in:
parent
e5476e81f6
commit
8a52c39b37
|
@ -253,6 +253,22 @@ var Typertext;
|
||||||
HttpUrl.prototype.ToString = function () {
|
HttpUrl.prototype.ToString = function () {
|
||||||
return Typertext.Http.HttpProtocol[this.protocol] + "://" + this.domain + ((this.port == HttpUrl.DefaultPort(this.protocol)) ? "" : ":" + this.port) + this.path + HttpUrl.EncodeQueryString(this.queryString);
|
return Typertext.Http.HttpProtocol[this.protocol] + "://" + this.domain + ((this.port == HttpUrl.DefaultPort(this.protocol)) ? "" : ":" + this.port) + this.path + HttpUrl.EncodeQueryString(this.queryString);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HttpUrl.prototype.GetPort = function () {
|
||||||
|
return this.port;
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpUrl.prototype.GetDomain = function () {
|
||||||
|
return this.domain;
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpUrl.prototype.GetProtocol = function () {
|
||||||
|
return this.protocol;
|
||||||
|
};
|
||||||
|
|
||||||
|
HttpUrl.prototype.CrossOriginCheck = function (url) {
|
||||||
|
return (this.domain === url.GetDomain() && this.port === url.GetPort() && this.protocol === url.GetProtocol());
|
||||||
|
};
|
||||||
return HttpUrl;
|
return HttpUrl;
|
||||||
})();
|
})();
|
||||||
Http.HttpUrl = HttpUrl;
|
Http.HttpUrl = HttpUrl;
|
||||||
|
@ -366,20 +382,31 @@ var Typertext;
|
||||||
var Typertext;
|
var Typertext;
|
||||||
(function (Typertext) {
|
(function (Typertext) {
|
||||||
(function (Transport) {
|
(function (Transport) {
|
||||||
|
var HttpUrl = Typertext.Http.HttpUrl;
|
||||||
|
|
||||||
var TransportChooser = (function () {
|
var TransportChooser = (function () {
|
||||||
function TransportChooser() {
|
function TransportChooser() {
|
||||||
}
|
}
|
||||||
TransportChooser.Transport = function (method, request, postData, callback) {
|
TransportChooser.Transport = function (method, request, postData, callback) {
|
||||||
var ieLte9 = false;
|
var ieTestDiv = document.createElement("div");
|
||||||
var isXdomain = false;
|
ieTestDiv.innerHTML = "<!--[if lte IE 7]><i></i><![endif]-->";
|
||||||
var isXprotocol = false;
|
|
||||||
|
|
||||||
if (!ieLte9) {
|
if (ieTestDiv.getElementsByTagName("i").length === 1) {
|
||||||
return new Typertext.Transport.XDR(method, request, postData, callback);
|
throw {};
|
||||||
} else if (isXdomain && !isXprotocol) {
|
}
|
||||||
|
|
||||||
|
ieTestDiv.innerHTML = "<!--[if lte IE 9]><i></i><![endif]-->";
|
||||||
|
var ieLte9 = (ieTestDiv.getElementsByTagName("i").length === 1);
|
||||||
|
var origin = HttpUrl.FromUrl(window.location.href);
|
||||||
|
|
||||||
|
if (!origin.CrossOriginCheck(url) || !ieLte9) {
|
||||||
return new Typertext.Transport.XHR(method, request, postData, callback);
|
return new Typertext.Transport.XHR(method, request, postData, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (origin.GetProtocol() === request.GetProtocol()) {
|
||||||
|
return new Typertext.Transport.XDR(method, request, postData, callback);
|
||||||
|
}
|
||||||
|
|
||||||
throw {};
|
throw {};
|
||||||
};
|
};
|
||||||
return TransportChooser;
|
return TransportChooser;
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue