Commit 6b04c877 authored by Romain Courteaud's avatar Romain Courteaud

Release 3.42.0

parent ff4846ab
Pipeline #8258 failed with stage
in 0 seconds
......@@ -26,7 +26,7 @@ TESTDIR = test
EXAMPLEDIR = examples
EXTERNALDIR = external
VERSION = 3.41.1
VERSION = 3.42.0
JIOVERSION = ${DISTDIR}/jio-v${VERSION}.js
JIOLATEST = ${DISTDIR}/jio-latest.js
JIONODEVERSION = ${DISTDIR}/jio-v${VERSION}-node.js
......
......@@ -385,10 +385,10 @@ define("rsvp/events",
__exports__.EventTarget = EventTarget;
});
define("rsvp/hash",
["rsvp/defer","exports"],
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var defer = __dependency1__.defer;
var Promise = __dependency1__.Promise;
function size(object) {
var s = 0;
......@@ -401,38 +401,61 @@ define("rsvp/hash",
}
function hash(promises) {
var results = {}, deferred = defer(), remaining = size(promises);
if (remaining === 0) {
deferred.resolve({});
function canceller() {
var promise,
key;
for (key in promises) {
if (promises.hasOwnProperty(key)) {
promise = promises[key];
if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') {
promise.cancel();
}
}
}
}
var resolver = function(prop) {
return function(value) {
resolveAll(prop, value);
};
};
return new Promise(function(resolve, reject) {
var results = {}, remaining = size(promises),
promise;
var resolveAll = function(prop, value) {
results[prop] = value;
if (--remaining === 0) {
deferred.resolve(results);
if (remaining === 0) {
resolve(results);
}
};
var rejectAll = function(error) {
deferred.reject(error);
};
function resolver(key) {
return function(value) {
resolveAll(key, value);
};
}
for (var prop in promises) {
if (promises[prop] && typeof promises[prop].then === 'function') {
promises[prop].then(resolver(prop), rejectAll);
} else {
resolveAll(prop, promises[prop]);
function resolveAll(key, value) {
results[key] = value;
if (--remaining === 0) {
resolve(results);
}
}
}
return deferred.promise;
function cancelAll(rejectionValue) {
reject(rejectionValue);
canceller();
}
for (var prop in promises) {
promise = promises[prop];
if (promise && typeof promise.then === 'function') {
promise.then(resolver(prop), cancelAll);
} else {
resolveAll(prop, promise);
}
}
}, canceller
);
}
......@@ -539,6 +562,7 @@ define("rsvp/promise",
// For now, simply reject the promise and does not propagate the cancel
// to parent or children
if (resolved) { return; }
promise.isCancelled = true;
if (canceller !== undefined) {
try {
canceller();
......@@ -570,6 +594,7 @@ define("rsvp/promise",
if (promise.isFulfilled) { return; }
if (promise.isRejected) { return; }
if (promise.isCancelled) { return; }
if (hasCallback) {
try {
......@@ -600,6 +625,7 @@ define("rsvp/promise",
Promise.prototype = {
constructor: Promise,
isCancelled: undefined,
isRejected: undefined,
isFulfilled: undefined,
rejectedReason: undefined,
......@@ -741,7 +767,7 @@ define("rsvp/queue",
ResolvedQueueError.prototype = new Error();
ResolvedQueueError.prototype.constructor = ResolvedQueueError;
var Queue = function() {
var Queue = function(thenable) {
var queue = this,
promise_list = [],
promise,
......@@ -754,11 +780,31 @@ define("rsvp/queue",
}
function canceller() {
for (var i = 0; i < 2; i++) {
promise_list[i].cancel();
for (var i = promise_list.length; i > 0; i--) {
promise_list[i - 1].cancel();
}
}
function checkPromise(next_promise) {
promise_list.push(next_promise);
// Handle pop
promise_list.push(next_promise.then(function (fulfillmentValue) {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
fulfill(fulfillmentValue);
} else {
return fulfillmentValue;
}
}, function (rejectedReason) {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
reject(rejectedReason);
} else {
throw rejectedReason;
}
}));
}
promise = new Promise(function(done, fail) {
fulfill = function (fulfillmentValue) {
if (resolved) {return;}
......@@ -776,13 +822,7 @@ define("rsvp/queue",
};
}, canceller);
promise_list.push(resolve());
promise_list.push(promise_list[0].then(function () {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
fulfill();
}
}));
checkPromise(resolve(thenable));
queue.cancel = function () {
if (resolved) {return;}
......@@ -805,25 +845,9 @@ define("rsvp/queue",
throw new ResolvedQueueError();
}
next_promise = last_promise.then(done, fail);
promise_list.push(next_promise);
// Handle pop
promise_list.push(next_promise.then(function (fulfillmentValue) {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
fulfill(fulfillmentValue);
} else {
return fulfillmentValue;
}
}, function (rejectedReason) {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
reject(rejectedReason);
} else {
throw rejectedReason;
}
}));
checkPromise(last_promise.then(done, fail));
return this;
};
......@@ -10342,10 +10366,7 @@ var Blob = window.Blob,
if (result instanceof RSVP.Queue) {
return result;
}
return new RSVP.Queue()
.push(function returnPushableResult() {
return result;
});
return new RSVP.Queue(result);
}
function declareMethod(klass, name, precondition_function, post_function) {
......@@ -13940,7 +13961,8 @@ var jIO = window.jIO,
function extractPropertyFromFormJSON(json) {
var form = json._embedded._view,
converted_json = {
portal_type: json._links.type.name
portal_type: new URI(json._links.type.href).segment(2)
.replace("portal_types/", "")
},
form_data_json = {},
field,
......
......@@ -8339,10 +8339,7 @@ return new Parser;
if (result instanceof RSVP.Queue) {
return result;
}
return new RSVP.Queue()
.push(function returnPushableResult() {
return result;
});
return new RSVP.Queue(result);
}
function declareMethod(klass, name, precondition_function, post_function) {
......@@ -13425,7 +13422,8 @@ return new Parser;
function extractPropertyFromFormJSON(json) {
var form = json._embedded._view,
converted_json = {
portal_type: json._links.type.name
portal_type: new URI(json._links.type.href).segment(2)
.replace("portal_types/", "")
},
form_data_json = {},
field,
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment