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 9b109bfb6bcd276c2d91f69db2b28663caed4e5e..df91335abf2bbb16f25a5c160aa6f04daebc9d82 100644 |
| --- a/chrome/renderer/resources/extensions/json_schema.js |
| +++ b/chrome/renderer/resources/extensions/json_schema.js |
| @@ -280,27 +280,10 @@ chromeHidden.JSONSchemaValidator.prototype.validateObject = function( |
| // If "instanceof" property is set, check that this object inherits from |
| // the specified constructor (function). |
| if (schema.isInstanceOf) { |
| - var isInstance = function() { |
| - var constructor = this[schema.isInstanceOf]; |
| - if (constructor) { |
| - return (instance instanceof constructor); |
| - } |
| - |
| - // Special-case constructors that can not always be found on the global |
| - // object, but for which we to allow validation. |
| - var allowedNamedConstructors = { |
| - "Window": true, |
| - "ImageData": true |
| - } |
| - if (!allowedNamedConstructors[schema.isInstanceOf]) { |
| - throw "Attempt to validate against an instance ctor that could not be" + |
| - "found: " + schema.isInstanceOf; |
| - } |
| - return (schema.isInstanceOf == instance.constructor.name) |
| - }(); |
| - |
| - if (!isInstance) |
| + if (Object.prototype.toString.call(instance) != |
|
arv (Not doing code reviews)
2012/03/05 19:13:07
Maybe we should have walked the prototype chain so
Aaron Boodman
2012/03/05 21:06:08
I agree the recursive search is cooler, but in thi
|
| + "[object " + schema.isInstanceOf + "]") { |
| this.addError(propPath, "notInstance", [schema.isInstanceOf]); |
| + } |
| } |
| // Exit early from additional property check if "type":"any" is defined. |