...
 
Commits (2)
......@@ -6936,7 +6936,7 @@ var UriTemplate = (function () {
// Allow xhr2 to export XMLHttpRequest
module = {};
// Generated by CoffeeScript 1.12.2
// Generated by CoffeeScript 1.12.7
(function() {
var InvalidStateError, NetworkError, ProgressEvent, SecurityError, SyntaxError, XMLHttpRequest, XMLHttpRequestEventTarget, XMLHttpRequestUpload, http, https, os, url,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
......@@ -7261,7 +7261,7 @@ var UriTemplate = (function () {
'access-control-request-method': true,
connection: true,
'content-length': true,
// cookie: true,
cookie: true,
cookie2: true,
date: true,
dnt: true,
......@@ -7279,7 +7279,7 @@ var UriTemplate = (function () {
};
XMLHttpRequest.prototype._privateHeaders = {
// 'set-cookie': true,
'set-cookie': true,
'set-cookie2': true
};
......@@ -7301,6 +7301,7 @@ var UriTemplate = (function () {
};
XMLHttpRequest.prototype._sendHttp = function(data) {
var that;
if (this._sync) {
throw new Error("Synchronous XHR processing not implemented");
}
......@@ -7310,9 +7311,11 @@ var UriTemplate = (function () {
} else {
data || (data = '');
}
this.upload._setData(data);
this._finalizeHeaders();
this._sendHxxpRequest();
that = this;
this.upload._setData(data, function() {
that._finalizeHeaders();
return that._sendHxxpRequest();
});
return void 0;
};
......@@ -7647,11 +7650,13 @@ var UriTemplate = (function () {
XMLHttpRequest.XMLHttpRequest = XMLHttpRequest;
XMLHttpRequest.FormData = FormData;
SecurityError = (function(superClass) {
extend(SecurityError, superClass);
function SecurityError() {
SecurityError.__super__.constructor.apply(this, arguments);
SecurityError.__super__.constructor.call(this);
}
return SecurityError;
......@@ -7664,7 +7669,7 @@ var UriTemplate = (function () {
extend(InvalidStateError, superClass);
function InvalidStateError() {
InvalidStateError.__super__.constructor.apply(this, arguments);
InvalidStateError.__super__.constructor.call(this);
}
return InvalidStateError;
......@@ -7688,7 +7693,7 @@ var UriTemplate = (function () {
extend(NetworkError, superClass);
function NetworkError() {
NetworkError.__super__.constructor.apply(this, arguments);
NetworkError.__super__.constructor.call(this);
}
return NetworkError;
......@@ -7701,7 +7706,7 @@ var UriTemplate = (function () {
extend(SyntaxError, superClass);
function SyntaxError() {
SyntaxError.__super__.constructor.apply(this, arguments);
SyntaxError.__super__.constructor.call(this);
}
return SyntaxError;
......@@ -7751,10 +7756,10 @@ var UriTemplate = (function () {
return void 0;
};
XMLHttpRequestUpload.prototype._setData = function(data) {
var body, i, j, k, offset, ref, ref1, view;
XMLHttpRequestUpload.prototype._setData = function(data, cb) {
var body, i, j, k, offset, ref, ref1, that, view;
if (typeof data === 'undefined' || data === null) {
return;
return cb();
}
if (typeof data === 'string') {
if (data.length !== 0) {
......@@ -7778,10 +7783,23 @@ var UriTemplate = (function () {
body[i] = view[i + offset];
}
this._body = body;
} else if (data instanceof FormData) {
body = '';
this._contentType = data.getHeaders()['content-type'];
data.on('data', function(data) {
return body += data.toString();
});
that = this;
data.on('end', function() {
that._body = body;
return cb();
});
data.resume();
return;
} else {
throw new Error("Unsupported send() data " + data);
}
return void 0;
return cb();
};
XMLHttpRequestUpload.prototype._finalizeHeaders = function(headers, loweredHeaders) {
......@@ -7810,7 +7828,8 @@ var UriTemplate = (function () {
XMLHttpRequest.XMLHttpRequestUpload = XMLHttpRequestUpload;
}).call(this);/*
}).call(this);
/*
* Copyright 2013, Nexedi SA
*
* This program is free software: you can Use, Study, Modify and Redistribute
......@@ -8052,7 +8071,6 @@ parse: function parse(input) {
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
_token_stack:
var lex = function () {
var token;
token = lexer.lex() || EOF;
......@@ -10653,13 +10671,20 @@ var XMLHttpRequest = global.XMLHttpRequest || module.exports,
* See https://www.nexedi.com/licensing for rationale and options.
*/
/*global window */
(function (window, jIO, Blob) {
/*global window, ArrayBuffer */
(function (window, jIO, Blob, ArrayBuffer) {
"use strict";
var FormData,
originalAjax;
function convertToBlob(evt, convert) {
if (convert && evt.target.response instanceof ArrayBuffer) {
evt.target.response = new Blob([evt.target.response]);
}
return evt;
}
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/
// Using_XMLHttpRequest#Submitting_forms_and_uploading_files
FormData = function FormData() {
......@@ -10678,11 +10703,17 @@ var XMLHttpRequest = global.XMLHttpRequest || module.exports,
originalAjax = jIO.util.ajax;
jIO.util.ajax = function ajax(param) {
var convertToArrayBuffer = param.dataType === 'blob';
if (convertToArrayBuffer) {
param.dataType = 'arraybuffer';
}
if (param.data instanceof Blob) {
// Blob is not supported by xhr2, so convert to ArrayBuffer instead
return jIO.util.readBlobAsArrayBuffer(param.data).then(function (data) {
param.data = data.target.result;
return originalAjax(param);
return originalAjax(param).then(function (evt) {
return convertToBlob(evt, convertToArrayBuffer);
});
});
}
......@@ -10698,10 +10729,12 @@ var XMLHttpRequest = global.XMLHttpRequest || module.exports,
return originalAjax(param);
}
return originalAjax(param);
return originalAjax(param).then(function (evt) {
return convertToBlob(evt, convertToArrayBuffer);
});
};
}(window, window.jIO, window.Blob));
}(window, window.jIO, window.Blob, ArrayBuffer));
// Define a global variable to allow storages to access jIO
var jIO = window.jIO,
......@@ -13801,6 +13834,7 @@ var jIO = window.jIO,
if (options.headers === undefined) {
options.headers = {};
}
options.headers.Accept = "*/*";
options.headers['X-ACCESS-TOKEN'] = storage._access_token;
options.xhrFields.withCredentials = false;
} else {
......
......@@ -6274,7 +6274,6 @@ parse: function parse(input) {
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
_token_stack:
var lex = function () {
var token;
token = lexer.lex() || EOF;
......@@ -13003,6 +13002,7 @@ return new Parser;
if (options.headers === undefined) {
options.headers = {};
}
options.headers.Accept = "*/*";
options.headers['X-ACCESS-TOKEN'] = storage._access_token;
options.xhrFields.withCredentials = false;
} else {
......
......@@ -6936,7 +6936,7 @@ var UriTemplate = (function () {
// Allow xhr2 to export XMLHttpRequest
module = {};
// Generated by CoffeeScript 1.12.2
// Generated by CoffeeScript 1.12.7
(function() {
var InvalidStateError, NetworkError, ProgressEvent, SecurityError, SyntaxError, XMLHttpRequest, XMLHttpRequestEventTarget, XMLHttpRequestUpload, http, https, os, url,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
......@@ -7261,7 +7261,7 @@ var UriTemplate = (function () {
'access-control-request-method': true,
connection: true,
'content-length': true,
// cookie: true,
cookie: true,
cookie2: true,
date: true,
dnt: true,
......@@ -7279,7 +7279,7 @@ var UriTemplate = (function () {
};
XMLHttpRequest.prototype._privateHeaders = {
// 'set-cookie': true,
'set-cookie': true,
'set-cookie2': true
};
......@@ -7301,6 +7301,7 @@ var UriTemplate = (function () {
};
XMLHttpRequest.prototype._sendHttp = function(data) {
var that;
if (this._sync) {
throw new Error("Synchronous XHR processing not implemented");
}
......@@ -7310,9 +7311,11 @@ var UriTemplate = (function () {
} else {
data || (data = '');
}
this.upload._setData(data);
this._finalizeHeaders();
this._sendHxxpRequest();
that = this;
this.upload._setData(data, function() {
that._finalizeHeaders();
return that._sendHxxpRequest();
});
return void 0;
};
......@@ -7647,11 +7650,13 @@ var UriTemplate = (function () {
XMLHttpRequest.XMLHttpRequest = XMLHttpRequest;
XMLHttpRequest.FormData = FormData;
SecurityError = (function(superClass) {
extend(SecurityError, superClass);
function SecurityError() {
SecurityError.__super__.constructor.apply(this, arguments);
SecurityError.__super__.constructor.call(this);
}
return SecurityError;
......@@ -7664,7 +7669,7 @@ var UriTemplate = (function () {
extend(InvalidStateError, superClass);
function InvalidStateError() {
InvalidStateError.__super__.constructor.apply(this, arguments);
InvalidStateError.__super__.constructor.call(this);
}
return InvalidStateError;
......@@ -7688,7 +7693,7 @@ var UriTemplate = (function () {
extend(NetworkError, superClass);
function NetworkError() {
NetworkError.__super__.constructor.apply(this, arguments);
NetworkError.__super__.constructor.call(this);
}
return NetworkError;
......@@ -7701,7 +7706,7 @@ var UriTemplate = (function () {
extend(SyntaxError, superClass);
function SyntaxError() {
SyntaxError.__super__.constructor.apply(this, arguments);
SyntaxError.__super__.constructor.call(this);
}
return SyntaxError;
......@@ -7751,10 +7756,10 @@ var UriTemplate = (function () {
return void 0;
};
XMLHttpRequestUpload.prototype._setData = function(data) {
var body, i, j, k, offset, ref, ref1, view;
XMLHttpRequestUpload.prototype._setData = function(data, cb) {
var body, i, j, k, offset, ref, ref1, that, view;
if (typeof data === 'undefined' || data === null) {
return;
return cb();
}
if (typeof data === 'string') {
if (data.length !== 0) {
......@@ -7778,10 +7783,23 @@ var UriTemplate = (function () {
body[i] = view[i + offset];
}
this._body = body;
} else if (data instanceof FormData) {
body = '';
this._contentType = data.getHeaders()['content-type'];
data.on('data', function(data) {
return body += data.toString();
});
that = this;
data.on('end', function() {
that._body = body;
return cb();
});
data.resume();
return;
} else {
throw new Error("Unsupported send() data " + data);
}
return void 0;
return cb();
};
XMLHttpRequestUpload.prototype._finalizeHeaders = function(headers, loweredHeaders) {
......@@ -7810,7 +7828,8 @@ var UriTemplate = (function () {
XMLHttpRequest.XMLHttpRequestUpload = XMLHttpRequestUpload;
}).call(this);/*
}).call(this);
/*
* Copyright 2013, Nexedi SA
*
* This program is free software: you can Use, Study, Modify and Redistribute
......@@ -8052,7 +8071,6 @@ parse: function parse(input) {
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
_token_stack:
var lex = function () {
var token;
token = lexer.lex() || EOF;
......@@ -10653,13 +10671,20 @@ var XMLHttpRequest = global.XMLHttpRequest || module.exports,
* See https://www.nexedi.com/licensing for rationale and options.
*/
/*global window */
(function (window, jIO, Blob) {
/*global window, ArrayBuffer */
(function (window, jIO, Blob, ArrayBuffer) {
"use strict";
var FormData,
originalAjax;
function convertToBlob(evt, convert) {
if (convert && evt.target.response instanceof ArrayBuffer) {
evt.target.response = new Blob([evt.target.response]);
}
return evt;
}
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/
// Using_XMLHttpRequest#Submitting_forms_and_uploading_files
FormData = function FormData() {
......@@ -10678,11 +10703,17 @@ var XMLHttpRequest = global.XMLHttpRequest || module.exports,
originalAjax = jIO.util.ajax;
jIO.util.ajax = function ajax(param) {
var convertToArrayBuffer = param.dataType === 'blob';
if (convertToArrayBuffer) {
param.dataType = 'arraybuffer';
}
if (param.data instanceof Blob) {
// Blob is not supported by xhr2, so convert to ArrayBuffer instead
return jIO.util.readBlobAsArrayBuffer(param.data).then(function (data) {
param.data = data.target.result;
return originalAjax(param);
return originalAjax(param).then(function (evt) {
return convertToBlob(evt, convertToArrayBuffer);
});
});
}
......@@ -10698,10 +10729,12 @@ var XMLHttpRequest = global.XMLHttpRequest || module.exports,
return originalAjax(param);
}
return originalAjax(param);
return originalAjax(param).then(function (evt) {
return convertToBlob(evt, convertToArrayBuffer);
});
};
}(window, window.jIO, window.Blob));
}(window, window.jIO, window.Blob, ArrayBuffer));
// Define a global variable to allow storages to access jIO
var jIO = window.jIO,
......@@ -13801,6 +13834,7 @@ var jIO = window.jIO,
if (options.headers === undefined) {
options.headers = {};
}
options.headers.Accept = "*/*";
options.headers['X-ACCESS-TOKEN'] = storage._access_token;
options.xhrFields.withCredentials = false;
} else {
......
......@@ -6274,7 +6274,6 @@ parse: function parse(input) {
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
_token_stack:
var lex = function () {
var token;
token = lexer.lex() || EOF;
......@@ -13003,6 +13002,7 @@ return new Parser;
if (options.headers === undefined) {
options.headers = {};
}
options.headers.Accept = "*/*";
options.headers['X-ACCESS-TOKEN'] = storage._access_token;
options.xhrFields.withCredentials = false;
} else {
......
......@@ -42,6 +42,7 @@
if (options.headers === undefined) {
options.headers = {};
}
options.headers.Accept = "*/*";
options.headers['X-ACCESS-TOKEN'] = storage._access_token;
options.xhrFields.withCredentials = false;
} else {
......