OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Routines used to validate and normalize arguments. | 5 // Routines used to validate and normalize arguments. |
6 | 6 |
7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 8 var chrome = requireNative('chrome').GetChrome(); |
8 | 9 |
9 // TODO(benwells): unit test this file. | 10 // TODO(benwells): unit test this file. |
10 // JSONSchemaValidator is not loaded in unit tests. | 11 // JSONSchemaValidator is not loaded in unit tests. |
11 var validate; | 12 var validate; |
12 if (chromeHidden.JSONSchemaValidator) { | 13 if (chromeHidden.JSONSchemaValidator) { |
13 var schemaValidator = new chromeHidden.JSONSchemaValidator(); | 14 var schemaValidator = new chromeHidden.JSONSchemaValidator(); |
14 | 15 |
15 // Validate arguments. | 16 // Validate arguments. |
16 validate = function(args, parameterSchemas) { | 17 validate = function(args, parameterSchemas) { |
17 if (args.length > parameterSchemas.length) | 18 if (args.length > parameterSchemas.length) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return true; | 154 return true; |
154 } | 155 } |
155 } | 156 } |
156 return false; | 157 return false; |
157 }; | 158 }; |
158 | 159 |
159 exports.isFunctionSignatureAmbiguous = isFunctionSignatureAmbiguous; | 160 exports.isFunctionSignatureAmbiguous = isFunctionSignatureAmbiguous; |
160 exports.normalizeArgumentsAndValidate = normalizeArgumentsAndValidate; | 161 exports.normalizeArgumentsAndValidate = normalizeArgumentsAndValidate; |
161 exports.schemaValidator = schemaValidator; | 162 exports.schemaValidator = schemaValidator; |
162 exports.validate = validate; | 163 exports.validate = validate; |
OLD | NEW |