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 // ----------------------------------------------------------------------------- | 5 // ----------------------------------------------------------------------------- |
6 // NOTE: If you change this file you need to touch renderer_resources.grd to | 6 // NOTE: If you change this file you need to touch renderer_resources.grd to |
7 // have your change take effect. | 7 // have your change take effect. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 | 9 |
10 //============================================================================== | 10 //============================================================================== |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 * the input values. | 117 * the input values. |
118 */ | 118 */ |
119 chromeHidden.JSONSchemaValidator.getType = function(value) { | 119 chromeHidden.JSONSchemaValidator.getType = function(value) { |
120 var s = typeof value; | 120 var s = typeof value; |
121 | 121 |
122 if (s == "object") { | 122 if (s == "object") { |
123 if (value === null) { | 123 if (value === null) { |
124 return "null"; | 124 return "null"; |
125 } else if (Object.prototype.toString.call(value) == "[object Array]") { | 125 } else if (Object.prototype.toString.call(value) == "[object Array]") { |
126 return "array"; | 126 return "array"; |
| 127 } else if (typeof(ArrayBuffer) != "undefined" && |
| 128 value.constructor == ArrayBuffer) { |
| 129 return "binary"; |
127 } | 130 } |
128 } else if (s == "number") { | 131 } else if (s == "number") { |
129 if (value % 1 == 0) { | 132 if (value % 1 == 0) { |
130 return "integer"; | 133 return "integer"; |
131 } | 134 } |
132 } | 135 } |
133 | 136 |
134 return s; | 137 return s; |
135 }; | 138 }; |
136 | 139 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 message: chromeHidden.JSONSchemaValidator.formatError(key, replacements) | 501 message: chromeHidden.JSONSchemaValidator.formatError(key, replacements) |
499 }); | 502 }); |
500 }; | 503 }; |
501 | 504 |
502 /** | 505 /** |
503 * Resets errors to an empty list so you can call 'validate' again. | 506 * Resets errors to an empty list so you can call 'validate' again. |
504 */ | 507 */ |
505 chromeHidden.JSONSchemaValidator.prototype.resetErrors = function() { | 508 chromeHidden.JSONSchemaValidator.prototype.resetErrors = function() { |
506 this.errors = []; | 509 this.errors = []; |
507 }; | 510 }; |
OLD | NEW |