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

Ensure iframe methods return RSVP.Queue.

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