Chromium Code Reviews| Index: chrome/renderer/resources/extensions/json_schema.js |
| diff --git a/chrome/renderer/resources/extensions/json_schema.js b/chrome/renderer/resources/extensions/json_schema.js |
| index 7770185283aa6bf0e6c0dd9cc28595467b959313..8d85b4f6eec568baba91ead558c4bb06fe5d5551 100644 |
| --- a/chrome/renderer/resources/extensions/json_schema.js |
| +++ b/chrome/renderer/resources/extensions/json_schema.js |
| @@ -40,7 +40,7 @@ |
| // TODO(cduvall): Make this file not depend on chromeHidden. |
| var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| -var loadRefDependency = require('utils').loadRefDependency; |
| +var loadRefType = require('utils').loadRefType; |
| function isInstanceOfClass(instance, className) { |
| if (!instance) |
| @@ -177,8 +177,10 @@ chromeHidden.JSONSchemaValidator.prototype.getAllTypesForSchema = |
| } |
| } |
| if (schema['$ref']) { |
|
not at google - send to devlin
2013/03/21 00:01:13
save a reference to schema['$ref'], it'd make this
cduvall
2013/03/21 00:59:51
Done.
|
| - var refTypes = this.getAllTypesForSchema(this.types[schema['$ref']]); |
| - schemaTypes = schemaTypes.concat(refTypes); |
| + if (!this.types[schema['$ref']]) |
| + this.types[schema['$ref']] = loadRefType(schema['$ref']); |
|
not at google - send to devlin
2013/03/21 00:01:13
CHECK that it found it.
cduvall
2013/03/21 00:59:51
Done.
|
| + schemaTypes = schemaTypes.concat( |
| + this.getAllTypesForSchema(this.types[schema['$ref']])); |
| } |
| return schemaTypes; |
| }; |
| @@ -244,7 +246,8 @@ chromeHidden.JSONSchemaValidator.prototype.validate = |
| // If the schema has a $ref property, the instance must validate against |
| // that schema too. It must be present in this.types to be referenced. |
| if (schema["$ref"]) { |
| - loadRefDependency(schema["$ref"]); |
| + if (!this.types[schema["$ref"]]) |
| + this.types[schema["$ref"]] = loadRefType(schema["$ref"]); |
|
not at google - send to devlin
2013/03/21 00:01:13
save schema[$ref], CHECK
actually this logic is r
cduvall
2013/03/21 00:59:51
I don't think this should CHECK, because it throws
not at google - send to devlin
2013/03/21 01:36:55
ah ok.
|
| if (!this.types[schema["$ref"]]) |
| this.addError(path, "unknownSchemaReference", [ schema["$ref"] ]); |
| else |