OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Provides a "bottom half" helper to assist with raw requests. | 6 * @fileoverview Provides a "bottom half" helper to assist with raw requests. |
7 * This fills the same role as the Authenticator-Specific Module component of | 7 * This fills the same role as the Authenticator-Specific Module component of |
8 * U2F documents, although the API is different. | 8 * U2F documents, although the API is different. |
9 */ | 9 */ |
10 'use strict'; | 10 'use strict'; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 * present in the request. | 66 * present in the request. |
67 * @return {HelperReply} The helper error response. | 67 * @return {HelperReply} The helper error response. |
68 */ | 68 */ |
69 function makeHelperErrorResponse(request, code, opt_defaultType) { | 69 function makeHelperErrorResponse(request, code, opt_defaultType) { |
70 var type; | 70 var type; |
71 if (request && request.type) { | 71 if (request && request.type) { |
72 type = request.type.replace(/_request$/, '_reply'); | 72 type = request.type.replace(/_request$/, '_reply'); |
73 } else { | 73 } else { |
74 type = opt_defaultType || 'unknown_type_reply'; | 74 type = opt_defaultType || 'unknown_type_reply'; |
75 } | 75 } |
76 var reply = { | 76 var reply = {'type': type, 'code': /** @type {number} */ (code)}; |
77 'type': type, | |
78 'code': /** @type {number} */ (code) | |
79 }; | |
80 return reply; | 77 return reply; |
81 } | 78 } |
OLD | NEW |