Re: [w3c/browser-payment-api] The myth of JSON-serializable object (#307)

Or perhaps it would be simpler to just precisely define a validation along the lines of this:

The value must satisfy:
 - has typeof of "number", "string", "boolean", or "object"
 - if it's "object":
    - it's prototype is Object.prototype or Array.prototype
    - all it's ownProperties recursively satisfy these rules
    - if the prototype is Array.prototype:
        - it's only ownProperties are 'length' and all the integers between 0 and length-1
 - there are no cycles

I'm guessing we might end up with such an implementation in blink, so perhaps making a definition that's somewhat redundant with the JSON spec (and so requiring a dedicated test suite separate from test262) is the more practical option?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/307#issuecomment-263951495

Received on Wednesday, 30 November 2016 18:20:41 UTC