Chromium Code Reviews| Index: remoting/webapp/gnubby_auth_handler.js |
| diff --git a/remoting/webapp/gnubby_auth_handler.js b/remoting/webapp/gnubby_auth_handler.js |
| index 848ab1e018b02563b99226426066ddc9aaad8b4d..54fda8a2fb8efe4c62c751bcfdf03a85140be7c9 100644 |
| --- a/remoting/webapp/gnubby_auth_handler.js |
| +++ b/remoting/webapp/gnubby_auth_handler.js |
| @@ -31,7 +31,8 @@ remoting.GnubbyAuthHandler.prototype.onMessage = function(data) { |
| var messageType = getStringAttr(message, 'type'); |
| if (messageType == 'data') { |
| this.sendMessageToGnubbyd_( |
| - getJsonObjectFromString(getStringAttr(message, 'jsonMessage')), |
| + {'type': 'auth-agent@openssh.com', |
|
Sergey Ulanov
2014/03/22 00:45:57
nit: space before 'type'
psj
2014/03/22 01:30:19
Hmm, I mis-remembered the style guide here - the b
|
| + 'data': getArrayAttr(message, 'data')}, |
| this.callback_.bind(this, getNumberAttr(message, 'connectionId'))); |
| } else { |
| console.error('Invalid gnubby-auth message: ' + messageType); |
| @@ -41,15 +42,22 @@ remoting.GnubbyAuthHandler.prototype.onMessage = function(data) { |
| /** |
| * Callback invoked with data to be returned to the host. |
| * @param {number} connectionId The connection id. |
| - * @param {Object} data The JSON object to send to the host. |
| + * @param {Object} response The JSON response with the data to send to the host. |
| * @private |
| */ |
| remoting.GnubbyAuthHandler.prototype.callback_ = |
| - function(connectionId, data) { |
| - var json_data = JSON.stringify(data); |
| - this.clientSession_.sendGnubbyAuthMessage({'type': 'data', |
| - 'connectionId': connectionId, |
| - 'jsonMessage': json_data}); |
| + function(connectionId, response) { |
| + try { |
| + this.clientSession_.sendGnubbyAuthMessage({ |
| + 'type': 'data', |
| + 'connectionId': connectionId, |
| + 'data': getArrayAttr(response, 'data')}); |
|
Sergey Ulanov
2014/03/22 00:45:57
nit: space before }
psj
2014/03/22 01:30:19
Similar to the opening brace, the multiline initia
|
| + } catch (err) { |
| + console.error('gnubby callback failed: ', /** @type {*} */ (err)); |
| + this.clientSession_.sendGnubbyAuthMessage({'type': 'error', |
| + 'connectionId': connectionId}); |
|
Sergey Ulanov
2014/03/22 00:45:57
nit: move type field to match the formatting in li
psj
2014/03/22 01:30:19
Done.
|
| + return; |
| + } |
| }; |
| /** |
| @@ -86,4 +94,4 @@ function onGnubbydDevReply_(jsonObject, callback, reply) { |
| } else { |
| chrome.runtime.sendMessage(kGnubbydStableExtensionId, jsonObject, callback); |
| } |
| -}; |
| +} |