Skip to content
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

Are PerformanceResourceTiming instances supposed to have a serializer? #3

Closed
siusin opened this issue Dec 11, 2014 · 4 comments
Closed
Assignees

Comments

@siusin
Copy link
Contributor

siusin commented Dec 11, 2014

Quoted from the discussion in public-web-perf@w3.org [1].

@bzbarsky

It appears that IE has a toJSON method on these that affects what JSON.stringify returns. I see nothing like that in the spec; is it supposed to be there?

@jainarvind

So should I add the toJSON() method to PerformanceResourceTiming object and define is as:
toJSON() method:
Returns a json object representing the PerformanceResourceTiming object.

In fact should I define it on PerformanceEntry itself (as well as on window.performance.timing) to cover all Performance objects?

@bzbarsky

What you should do is define a serializer. See http://heycam.github.io/webidl/#idl-serializers and I suspect what you want here is:
serializer = { attribute };
for interfaces that don't inherit from something that needs serialization but want to serialize all their own attributes or
serializer = { inherit, attribute };

for ones that want to serialize their own attributes plus whatever their parent interface serializes. This will automatically create a toJSON method that does the right things for you.

I suggest you test what UAs do and whether the spec you write is compatible with that.

Gecko does have a serializer on PerformanceEntry and on PerformanceTiming, for what that's worth.

[1] http://lists.w3.org/Archives/Public/public-web-perf/2014Aug/thread.html#msg0

@igrigorik
Copy link
Member

👍

@plehegar
Copy link
Member

Merged #6

@bzbarsky
Copy link

bzbarsky commented Feb 1, 2015

@plehegar Is there a reason to list all the attributes manually instead of just saying "all attributes"? Seems like this is a recipe for getting things out of sync.

Also, don't you need a serializer on PerformanceEntry too? Using "inherit" is not valid IDL unless there is an ancestor with a serializer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants