w3c / longtasks

Long Task API
https://w3c.github.io/longtasks/
Other
247 stars 32 forks source link

toJSON #37

Closed npm1 closed 5 years ago

npm1 commented 6 years ago

toJSON() is now mandatory for PerformanceEntry. Should it also be explicitly added to the interface declarations for PerformanceLongTaskTiming and TaskAttributionTiming, which have additional attributes?

marcoscaceres commented 6 years ago

It's inherited from PerformanceEntry, so should just work. No need to add it again.

npm1 commented 6 years ago

Yes, technically, but the implementation needs to be different because of the addition of new members in those interfaces. Does this deserve a mention in the spec?

domenic commented 6 years ago

My reading of https://heycam.github.io/webidl/#Default is that the additional attributes will not be included unless you give the subclasses their own toJSON() methods. This makes sense, as it doesn't do runtime polymorphic enumeration of all properties, but instead uses the static list encoded into its implementation.

npm1 commented 6 years ago

Sorry, I didn't follow up on this before. From the last comment, I take it that we would prefer to add toJSON in the IDL of the interface that inherits from another which already has toJSON, if it has additional attributes?