Skip to content

Commit bf262d5

Browse files
committed
fix uxhr for better CORS check on IE
1 parent b4fbb9a commit bf262d5

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"bower_components"
1616
],
1717
"dependencies" : {
18-
"uxhr": "endel/uxhr#a484e430e224375b786072da5abb94dfd3c68685",
18+
"uxhr": "endel/uxhr#c19c51fdba09065829b4b50968c92c59f7b34dfe",
1919
"qunit": "~1.9.0",
2020
"when": "~2.8.0",
2121
"lodash": "~2.4.0",

dist/dl.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/doubleleft/dl-api-javascript
44
*
55
* @copyright 2014 Doubleleft
6-
* @build 8/4/2014
6+
* @build 8/16/2014
77
*/
88
(function(window) {
99
//
@@ -974,10 +974,12 @@ define(function (require) {
974974
"use strict";
975975

976976
return function (url, data, options) {
977-
978977
data = data || '';
979978
options = options || {};
980979

980+
var uri = document.createElement('a');
981+
uri.href = url;
982+
981983
var complete = options.complete || function(){},
982984
success = options.success || function(){},
983985
error = options.error || function(){},
@@ -987,12 +989,13 @@ define(function (require) {
987989
headers = options.headers || {},
988990
method = options.method || 'GET',
989991
sync = options.sync || false,
992+
isCors = (uri.hostname != location.hostname),
990993
req = (function() {
991994

992-
if (typeof 'XMLHttpRequest' !== 'undefined') {
995+
if (typeof XMLHttpRequest !== 'undefined') {
993996

994997
// CORS (IE8-9)
995-
if (url.indexOf('http') === 0 && typeof XDomainRequest !== 'undefined') {
998+
if (isCors && typeof XDomainRequest !== 'undefined') {
996999
return new XDomainRequest();
9971000
}
9981001

@@ -7852,7 +7855,7 @@ define(function (require) {
78527855
}.call(this));
78537856

78547857
!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h<b.length;h+=1)g[h]=b.charCodeAt(h);return i=a.split(",")[0].split(":")[1].split(";")[0],c?new Blob([d?g:f],{type:i}):(j=new e,j.append(f),j.getBlob(i))};a.HTMLCanvasElement&&!b.toBlob&&(b.mozGetAsFile?b.toBlob=function(a,c,d){d&&b.toDataURL&&f?a(f(this.toDataURL(c,d))):a(this.mozGetAsFile("blob",c))}:b.toDataURL&&f&&(b.toBlob=function(a,b,c){a(f(this.toDataURL(b,c)))})),"function"==typeof define&&define.amd?define(function(){return f}):a.dataURLtoBlob=f}(this);
7855-
/**
7858+
/** @license
78567859
* eventsource.js
78577860
* Available under MIT License (MIT)
78587861
* https://github.com/Yaffle/EventSource/
@@ -8117,7 +8120,7 @@ define(function (require) {
81178120
} else if (field === "retry") {
81188121
initialRetry = getDuration(value, initialRetry);
81198122
retry = initialRetry;
8120-
} else if (field === "heartbeatTimeout") {//!
8123+
} else if (field === "heartbeatTimeout") {
81218124
heartbeatTimeout = getDuration(value, heartbeatTimeout);
81228125
if (timeout !== 0) {
81238126
clearTimeout(timeout);

0 commit comments

Comments
 (0)