- From: Andreas Tolfsen <ato@mozilla.com>
- Date: Wed, 5 Oct 2016 14:30:50 +0100
- To: public-browser-tools-testing <public-browser-tools-testing@w3.org>
- Cc: Jason Juang <juangj@google.com>, Simon Stewart <simon.m.stewart@gmail.com>
Jason has a largely correct representation of the history here, but I just want to add one point to it. Jason Juang <juangj@google.com> writes: > I think the order of events was: > > - the response used to have a "status" field and a "value" field > - the "status" field was removed in favor of using HTTP status codes > - the "value" field was removed for non-primitive responses because it > seemed redundant to wrap the response in '{"value": ... }' > > I can't quite recall whether there were other arguments for > "unwrapping" the response, other than that it seemed unnecessary at > the time. The fundamental reason why some non-object return values are wrapped in a {value: …} sturct is that JSON parsers more generally can’t agree amongst themselves what top-level types should be allowed in JSON. For example, Get Title returns {value: "Title of document"} when it _could_, had JSON parser implementations been consistent, have returned just a string of "Title of document". Many JSON implementations seem to believe that arrays and objects are the only allowed top-level types, leaving numbers, booleans, and strings to be supported only by some, typically more advanced, JSON parsers. Because it is a design goal of WebDriver to be implementable as a language binding nearly everywhere, preferably without the need to depend on custom JSON parsers, we need to account for these inconsistencies in the protocol design. This is why some values are wrapped the way they are.
Received on Wednesday, 5 October 2016 17:23:19 UTC