Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1293)

Unified Diff: remoting/webapp/gnubby_auth_handler.js

Issue 205493005: Do minimal processing of gnubby data. Add request timeouts and send error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment changes Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« remoting/host/gnubby_auth_handler_posix.cc ('K') | « remoting/remoting_test.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
-};
+}
« remoting/host/gnubby_auth_handler_posix.cc ('K') | « remoting/remoting_test.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698