-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Did you check if we could change behavior of existing display? #2
Comments
I'm not sure if having two 'display' members, where maybe order matters, is going to be better than a new member... From the code it should error if the field is not a string. I don't know what will happen if there are two fields with the same name. |
To clarify, in chrome this is where the display is parsed: The JSON deserializer will overwrite old key entries with new ones: So while not an error, only the last entry with a given key will be considered in the blink json parser. I found the same code in webkit: So there is technically a way for us to do this, where developers would have two 'display' fields, and the one that comes last is the one that old browsers parse, and somehow new browsers would be able to pull out the earlier fields and use those (so they could be an array) I still find this a little confusing - I kind of like the suggestion in #10 where we just create a new field here that new browsers will allow use of instead of @mgiuca WDYT here? |
I went to check the JSON spec as to whether this would even be allowed at that basic level: ECMA-404§6:
So it's allowed by JSON, and technically could be allowed by the Manifest spec. However, the Manifest spec currently uses the ECMAScript JSON parser. That parser explicitly parses a JSON object as a JavaScript object, which discards duplicates (preserving the last entry of a set of duplicated keys). So if we wanted to do this, we would have to write our own JSON parser. I don't think it's a very good idea to rely on this ability. As @dmurph shows, JSON processors are likely to store the parsed data in a hash map which discards duplicates and shuffles the order of the keys. Even if we write it correctly, it's confusing for a human reader who may be accustomed to the If we wanted to define two |
I agree. I'm closing this, feel free to re-open if you feel strongly about this :) |
Did you check how the implementations work today in WebKit, Firefox and Chrome? like what happens if you define two "display" members and one with an array instead. Maybe there is a way to change the behavior of "display" without breaking existing implementations?
https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/Modules/applicationmanifest/
https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/common/manifest/
The text was updated successfully, but these errors were encountered: