w3c / user-timing

User Timing
https://w3c.github.io/user-timing/
Other
26 stars 24 forks source link

It is unclear what "If startOrMeasureOptions is a non-empty PerformanceMeasureOptions object" means #89

Closed smaug---- closed 2 years ago

smaug---- commented 2 years ago

What is a non-empty dictionary? (Maybe it is defined somewhere, but I couldn't find it. The spec links to map's definition of empty.)

yoavweiss commented 2 years ago

^^ @npm1

yoavweiss commented 2 years ago

I think it means 'If startOrMeasureOptions is a dictionary and contains at least one of "detail", "start", "duration" or "end"'.

npm1 commented 2 years ago

That's right, per https://webidl.spec.whatwg.org/#es-dictionary a dictionary is converted to an ordered map. The WebIDL also mentions empty dictionary without defining it: https://webidl.spec.whatwg.org/#:~:text=empty%20dictionary%20value. I think it could be defined and then we can use the definition, but otherwise I'm not sure what else it could mean? Is this somehow ambiguous?

That said, reading the algorithm I think we can actually remove the non-empty check: we should probably perform those checks regardless, i.e. If startOrMeasureOptions is a PerformanceMeasureOptions object.

npm1 commented 2 years ago

Never mind this check is actually required (the default value is {} so we need to ensure that the checks are not performed in that case).

smaug---- commented 2 years ago

I think I can live with https://webidl.spec.whatwg.org/#es-dictionary . It is just unfortunate that it is not defined anywhere what an empty dictionary means.

yoavweiss commented 2 years ago

@smaug---- - Maybe the best path then is to file an issue against infra, defining an empty dict there and then we can point to that definition here?

clelland commented 2 years ago

Or WebIDL -- dictionary is a concept there; infra only has the concept of an ordered map.