Fix logical error in origin check

This commit is contained in:
Kegan Myers 2014-04-17 23:15:48 -05:00
parent fb91130952
commit 1d0ccbbf13
2 changed files with 3 additions and 3 deletions

View File

@ -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());
} }
} }

View File

@ -32,8 +32,8 @@ module Typertext.Transport {
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 this is a CORS request in a modern browser //If this is a standard request, or 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 XHR; return XHR;
} }