Closed npm1 closed 4 years ago
I'm not sure that the relevant global object is obvious even in the case of user timing because you can call another realm's user timing API like this: iframe.contentWindow.performance.measure(~)
.
Hmm interesting. But relevant global object
of a platform object
is always defined, so perhaps what needs to change is not this spec. Instead, every spec that creates a new PerformanceEntry
must specify the realm under which that object is being constructed, as specified in https://heycam.github.io/webidl/#new. This way there'd be no confusion about what the relevant global object
is. Does that make sense?
Hmm interesting. But
relevant global object
of aplatform object
is always defined, so perhaps what needs to change is not this spec. Instead, every spec that creates a newPerformanceEntry
must specify the realm under which that object is being constructed, as specified in https://heycam.github.io/webidl/#new. This way there'd be no confusion about what therelevant global object
is. Does that make sense?
Yes, that would do. I think I had pointed that out somewhere but can't find where.
Closing as the ones remaining are tracked on separate issues.
Currently, the algorithm to queue an entry only receives the
newEntry
. This algorithm then proceeds to obtain the relevant global object from the entry. This should work fine for cases like UserTiming, when mark() and measure() are called via JavaScript and it's clear what the relevant global object is. However, there are other cases like Paint Timing and Long Tasks, where the relevant global object is not clear at all since the calls occur on the event loop processing model.Therefore, we should add a parameter to this algorithm which contains the relevant global object, and we should make sure that all of the callers use those two parameters (i.e. the entry and the global object). An alternative would be to make the second parameter optional and only use it when needed, but I think it's probably better to make this parameter required so that are callers are properly thinking about what the global object should be.