Show More
@@ -51,7 +51,7 b' define([' | |||
|
51 | 51 | |
|
52 | 52 | CommManager.prototype.register_comm = function (comm) { |
|
53 | 53 | // Register a comm in the mapping |
|
54 | this.comms[comm.comm_id] = comm; | |
|
54 | this.comms[comm.comm_id] = new Promise(function(resolve) {resolve(comm);}); | |
|
55 | 55 | comm.kernel = this.kernel; |
|
56 | 56 | return comm.comm_id; |
|
57 | 57 | }; |
@@ -66,12 +66,13 b' define([' | |||
|
66 | 66 | CommManager.prototype.comm_open = function (msg) { |
|
67 | 67 | var content = msg.content; |
|
68 | 68 | var that = this; |
|
69 | ||
|
70 | return utils.load_class(content.target_name, content.target_module, | |
|
69 | var comm_id = content.comm_id; | |
|
70 | ||
|
71 | this.comms[comm_id] = utils.load_class(content.target_name, content.target_module, | |
|
71 | 72 | this.targets).then(function(target) { |
|
72 | 73 | |
|
73 |
var comm = new Comm(content.target_name, |
|
|
74 | that.register_comm(comm); | |
|
74 | var comm = new Comm(content.target_name, comm_id); | |
|
75 | comm.kernel = that.kernel; | |
|
75 | 76 | try { |
|
76 | 77 | target(comm, msg); |
|
77 | 78 | } catch (e) { |
@@ -83,33 +84,40 b' define([' | |||
|
83 | 84 | } |
|
84 | 85 | return comm; |
|
85 | 86 | }, utils.reject('Could not open comm', true)); |
|
87 | return this.comms[comm_id]; | |
|
86 | 88 | }; |
|
87 | 89 | |
|
88 |
CommManager.prototype.comm_close = function |
|
|
90 | CommManager.prototype.comm_close = function(msg) { | |
|
89 | 91 | var content = msg.content; |
|
90 |
|
|
|
91 | if (comm === undefined) { | |
|
92 | if (!this.comms[content.comm_id]) { | |
|
93 | console.error('Comm promise not found for comm id ' + content.comm_id); | |
|
92 | 94 | return; |
|
93 | 95 | } |
|
94 | this.unregister_comm(comm); | |
|
95 | try { | |
|
96 | comm.handle_close(msg); | |
|
97 |
|
|
|
98 | console.log("Exception closing comm: ", e, e.stack, msg); | |
|
99 | } | |
|
96 | ||
|
97 | this.comms[content.comm_id].then(function(comm) { | |
|
98 | this.unregister_comm(comm); | |
|
99 | try { | |
|
100 | comm.handle_close(msg); | |
|
101 | } catch (e) { | |
|
102 | console.log("Exception closing comm: ", e, e.stack, msg); | |
|
103 | } | |
|
104 | }); | |
|
100 | 105 | }; |
|
101 | 106 | |
|
102 |
CommManager.prototype.comm_msg = function |
|
|
107 | CommManager.prototype.comm_msg = function(msg) { | |
|
103 | 108 | var content = msg.content; |
|
104 |
|
|
|
105 | if (comm === undefined) { | |
|
109 | if (!this.comms[content.comm_id]) { | |
|
110 | console.error('Comm promise not found for comm id ' + content.comm_id); | |
|
106 | 111 | return; |
|
107 | 112 | } |
|
108 | try { | |
|
109 | comm.handle_msg(msg); | |
|
110 |
|
|
|
111 | console.log("Exception handling comm msg: ", e, e.stack, msg); | |
|
112 | } | |
|
113 | ||
|
114 | this.comms[content.comm_id].then(function(comm) { | |
|
115 | try { | |
|
116 | comm.handle_msg(msg); | |
|
117 | } catch (e) { | |
|
118 | console.log("Exception handling comm msg: ", e, e.stack, msg); | |
|
119 | } | |
|
120 | }); | |
|
113 | 121 | }; |
|
114 | 122 | |
|
115 | 123 | //----------------------------------------------------------------------- |
@@ -182,8 +190,9 b' define([' | |||
|
182 | 190 | |
|
183 | 191 | Comm.prototype.handle_msg = function (msg) { |
|
184 | 192 | var that = this; |
|
185 | this.msg_promise.then(function() { | |
|
193 | this.msg_promise = this.msg_promise.then(function() { | |
|
186 | 194 | that._maybe_callback('msg', msg); |
|
195 | return Promise.resolve(); | |
|
187 | 196 | }); |
|
188 | 197 | }; |
|
189 | 198 |
@@ -26,9 +26,7 b' casper.notebook_test(function () {' | |||
|
26 | 26 | 'Widget float textbox exists.'); |
|
27 | 27 | |
|
28 | 28 | this.cell_element_function(float_text.index, float_text.query, 'val', ['']); |
|
29 | console.log('send keys'); | |
|
30 | 29 | this.sendKeys(float_text.query, '1.05'); |
|
31 | console.log('send keys done'); | |
|
32 | 30 | }); |
|
33 | 31 | |
|
34 | 32 | this.wait_for_widget(float_text); |
General Comments 0
You need to be logged in to leave comments.
Login now