Commit 44fb0e89 authored by Romain Courteaud's avatar Romain Courteaud

renderjs: 0.29.0

parent 0098821d
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -300,24 +300,28 @@ ...@@ -300,24 +300,28 @@
postMessage({ id: id, callback: cbName, params: v}); postMessage({ id: id, callback: cbName, params: v});
}, },
error: function(error, message) { error: function(error, message) {
completed = true;
// verify in table // verify in table
if (!inTbl[id]) throw "error called for nonexistent message: " + id; if (!inTbl[id]) throw "error called for nonexistent message: " + id;
// remove transaction from table
delete inTbl[id];
// send error // send error
postMessage({ id: id, error: error, message: message }); postMessage({ id: id, error: error, message: message });
completed = true;
// remove transaction from table
delete inTbl[id];
}, },
complete: function(v) { complete: function(v) {
completed = true;
// verify in table // verify in table
if (!inTbl[id]) throw "complete called for nonexistent message: " + id; if (!inTbl[id]) throw "complete called for nonexistent message: " + id;
// remove transaction from table
delete inTbl[id];
// send complete // send complete
postMessage({ id: id, result: v }); postMessage({ id: id, result: v });
completed = true;
// remove transaction from table
delete inTbl[id];
}, },
delayReturn: function(delay) { delayReturn: function(delay) {
if (typeof delay === 'boolean') { if (typeof delay === 'boolean') {
...@@ -2785,10 +2789,11 @@ if (typeof document.contains !== 'function') { ...@@ -2785,10 +2789,11 @@ if (typeof document.contains !== 'function') {
local_transaction_dict[transaction_id] = local_transaction_dict[transaction_id] =
root_gadget[v[0]].apply(root_gadget, v[1]) root_gadget[v[0]].apply(root_gadget, v[1])
.push(function handleMethodCallSuccess() { .push(function handleMethodCallSuccess() {
trans.complete.apply(trans, arguments);
// drop the promise reference, to allow garbage collection // drop the promise reference, to allow garbage collection
delete local_transaction_dict[transaction_id]; delete local_transaction_dict[transaction_id];
trans.complete.apply(trans, arguments); })
}, function handleMethodCallError(e) { .push(undefined, function handleMethodCallError(e) {
var error_type = convertObjectToErrorType(e), var error_type = convertObjectToErrorType(e),
message; message;
if (e instanceof Error) { if (e instanceof Error) {
...@@ -2800,12 +2805,19 @@ if (typeof document.contains !== 'function') { ...@@ -2800,12 +2805,19 @@ if (typeof document.contains !== 'function') {
} else { } else {
message = e; message = e;
} }
// drop the promise reference, to allow garbage collection try {
delete local_transaction_dict[transaction_id];
trans.error({ trans.error({
type: error_type, type: error_type,
msg: message msg: message
}); });
} catch (new_error) {
trans.error({
type: convertObjectToErrorType(new_error),
msg: new_error.toString()
});
}
// drop the promise reference, to allow garbage collection
delete local_transaction_dict[transaction_id];
}); });
trans.delayReturn(true); trans.delayReturn(true);
}); });
......
{ {
"name": "renderjs", "name": "renderjs",
"version": "0.28.0", "version": "0.29.0",
"description": "RenderJs provides HTML5 gadgets", "description": "RenderJs provides HTML5 gadgets",
"main": "dist/renderjs-latest.js", "main": "dist/renderjs-latest.js",
"dependencies": { "dependencies": {
......
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