| 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 20 matching lines...) Expand all Loading... |
| 31 // There are also these departures from the JSON Schema proposal: | 31 // There are also these departures from the JSON Schema proposal: |
| 32 // - function and undefined types are supported | 32 // - function and undefined types are supported |
| 33 // - null counts as 'unspecified' for optional values | 33 // - null counts as 'unspecified' for optional values |
| 34 // - added the 'choices' property, to allow specifying a list of possible types | 34 // - added the 'choices' property, to allow specifying a list of possible types |
| 35 // for a value | 35 // for a value |
| 36 // - by default an "object" typed schema does not allow additional properties. | 36 // - by default an "object" typed schema does not allow additional properties. |
| 37 // if present, "additionalProperties" is to be a schema against which all | 37 // if present, "additionalProperties" is to be a schema against which all |
| 38 // additional properties will be validated. | 38 // additional properties will be validated. |
| 39 //============================================================================== | 39 //============================================================================== |
| 40 | 40 |
| 41 (function() { | 41 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 42 native function GetChromeHidden(); | |
| 43 var chromeHidden = GetChromeHidden(); | |
| 44 | 42 |
| 45 function isInstanceOfClass(instance, className) { | 43 function isInstanceOfClass(instance, className) { |
| 46 if (!instance) | 44 if (!instance) |
| 47 return false; | 45 return false; |
| 48 | 46 |
| 49 if (Object.prototype.toString.call(instance) == "[object " + className + "]") | 47 if (Object.prototype.toString.call(instance) == "[object " + className + "]") |
| 50 return true; | 48 return true; |
| 51 | 49 |
| 52 return isInstanceOfClass(Object.getPrototypeOf(instance), className); | 50 return isInstanceOfClass(Object.getPrototypeOf(instance), className); |
| 53 } | 51 } |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 message: chromeHidden.JSONSchemaValidator.formatError(key, replacements) | 489 message: chromeHidden.JSONSchemaValidator.formatError(key, replacements) |
| 492 }); | 490 }); |
| 493 }; | 491 }; |
| 494 | 492 |
| 495 /** | 493 /** |
| 496 * Resets errors to an empty list so you can call 'validate' again. | 494 * Resets errors to an empty list so you can call 'validate' again. |
| 497 */ | 495 */ |
| 498 chromeHidden.JSONSchemaValidator.prototype.resetErrors = function() { | 496 chromeHidden.JSONSchemaValidator.prototype.resetErrors = function() { |
| 499 this.errors = []; | 497 this.errors = []; |
| 500 }; | 498 }; |
| 501 | |
| 502 })(); | |
| OLD | NEW |