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

Release 3.42.0

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