Backport bugfix from 0.7.1
This commit is contained in:
parent
5e7f079b43
commit
8f33fa7689
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Typertext",
|
"name": "Typertext",
|
||||||
"version": "0.6.1",
|
"version": "0.6.2",
|
||||||
"homepage": "https://github.com/terribleplan/Typertext",
|
"homepage": "https://github.com/terribleplan/Typertext",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Kegan Myers <kegan@keganmyers.com>"
|
"Kegan Myers <kegan@keganmyers.com>"
|
||||||
|
|
2
build/typertext.d.ts
vendored
2
build/typertext.d.ts
vendored
|
@ -107,7 +107,7 @@ declare module Typertext.Http {
|
||||||
public GetPort(): number;
|
public GetPort(): number;
|
||||||
public GetDomain(): string;
|
public GetDomain(): string;
|
||||||
public GetProtocol(): HttpProtocol;
|
public GetProtocol(): HttpProtocol;
|
||||||
public CrossOriginCheck(url: HttpUrl): boolean;
|
public SameOriginCheck(url: HttpUrl): boolean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module Typertext.Json {
|
declare module Typertext.Json {
|
||||||
|
|
|
@ -266,7 +266,7 @@ var Typertext;
|
||||||
return this.protocol;
|
return this.protocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpUrl.prototype.CrossOriginCheck = function (url) {
|
HttpUrl.prototype.SameOriginCheck = function (url) {
|
||||||
return (this.domain === url.GetDomain() && this.port === url.GetPort() && this.protocol === url.GetProtocol());
|
return (this.domain === url.GetDomain() && this.port === url.GetPort() && this.protocol === url.GetProtocol());
|
||||||
};
|
};
|
||||||
return HttpUrl;
|
return HttpUrl;
|
||||||
|
@ -399,7 +399,7 @@ var Typertext;
|
||||||
var ieLte9 = (ieTestDiv.getElementsByTagName("i").length === 1);
|
var ieLte9 = (ieTestDiv.getElementsByTagName("i").length === 1);
|
||||||
var origin = HttpUrl.FromUrl(window.location.href);
|
var origin = HttpUrl.FromUrl(window.location.href);
|
||||||
|
|
||||||
if (!origin.CrossOriginCheck(origin) || !ieLte9) {
|
if (origin.SameOriginCheck(origin) || !ieLte9) {
|
||||||
return new Typertext.Transport.XHR(method, request, postData, callback);
|
return new Typertext.Transport.XHR(method, request, postData, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
build/typertext.min.js
vendored
2
build/typertext.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -199,7 +199,7 @@ module Typertext.Http {
|
||||||
*
|
*
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
public CrossOriginCheck(url:HttpUrl):boolean {
|
public SameOriginCheck(url:HttpUrl):boolean {
|
||||||
return (this.domain === url.GetDomain() && this.port === url.GetPort() && this.protocol === url.GetProtocol());
|
return (this.domain === url.GetDomain() && this.port === url.GetPort() && this.protocol === url.GetProtocol());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ module Typertext.Transport {
|
||||||
var origin = HttpUrl.FromUrl(window.location.href);
|
var origin = HttpUrl.FromUrl(window.location.href);
|
||||||
|
|
||||||
//If this is a CORS request in a modern browser
|
//If this is a CORS request in a modern browser
|
||||||
if (!origin.CrossOriginCheck(origin) || !ieLte9) {
|
if (origin.SameOriginCheck(origin) || !ieLte9) {
|
||||||
//Just use a standard XHR request
|
//Just use a standard XHR request
|
||||||
return new XHR(method, request, postData, callback);
|
return new XHR(method, request, postData, callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/terribleplan/Typertext.git"
|
"url": "https://github.com/terribleplan/Typertext.git"
|
||||||
},
|
},
|
||||||
"version": "0.6.1",
|
"version": "0.6.2",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4.2",
|
"grunt": "~0.4.2",
|
||||||
"grunt-cli": "~0.1.13",
|
"grunt-cli": "~0.1.13",
|
||||||
|
|
Reference in a new issue