Commit 689c76ae authored by Romain Courteaud's avatar Romain Courteaud

Ensure iframe methods return RSVP.Queue.

parent f510b4c6
...@@ -505,21 +505,25 @@ ...@@ -505,21 +505,25 @@
gadget_instance.__chan.bind("declareMethod", gadget_instance.__chan.bind("declareMethod",
function (trans, method_name) { function (trans, method_name) {
gadget_instance[method_name] = function () { gadget_instance[method_name] = function () {
var argument_list = arguments; var argument_list = arguments,
return new RSVP.Promise(function (resolve, reject) { wait_promise = new RSVP.Promise(function (resolve, reject) {
gadget_instance.__chan.call({ gadget_instance.__chan.call({
method: "methodCall", method: "methodCall",
params: [ params: [
method_name, method_name,
Array.prototype.slice.call(argument_list, 0)], Array.prototype.slice.call(argument_list, 0)],
success: function (s) { success: function (s) {
resolve(s); resolve(s);
}, },
error: function (e) { error: function (e) {
reject(e); reject(e);
} }
});
});
return new RSVP.Queue()
.push(function () {
return wait_promise;
}); });
});
}; };
return "OK"; return "OK";
}); });
......
...@@ -3248,6 +3248,15 @@ ...@@ -3248,6 +3248,15 @@
.then(function (new_gadget) { .then(function (new_gadget) {
return new RSVP.Queue() return new RSVP.Queue()
// Method returns an RSVP.Queue
.push(function () {
var result = new_gadget.wasReadyCalled();
ok(
result instanceof RSVP.Queue,
"iframe method should return Queue"
);
})
// Check that ready function are called // Check that ready function are called
.push(function () { .push(function () {
return new_gadget.wasReadyCalled(); return new_gadget.wasReadyCalled();
......
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