Bug 174862

Summary: Performance API: Implement performance.timeOrigin
Product: WebKit Reporter: Nicolas <npm>
Component: PlatformAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, esprehn+autocc, ews-watchlist, igrigorik, joepeck, kondapallykalyan, rniwa, sam, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar, W3CTest, WebExposed, WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
Patch none

Description Nicolas 2017-07-26 07:52:45 PDT
Latest editor draft: https://w3c.github.io/hr-time/

HR-Time-3 introduced this attribute, which is useful for developers to be able to compare timings of entries sourced from different time origins (like windows or workers).

It has already been implemented in Firefox, Edge has it in Preview, and will also be shipped by Chrome[1].

[1] https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/ck9M6Ev21lo
Comment 1 Radar WebKit Bug Importer 2017-07-27 13:46:00 PDT
<rdar://problem/33575468>
Comment 2 Alex Christensen 2021-06-08 17:50:19 PDT
Created attachment 430926 [details]
patch
Comment 3 Ryosuke Niwa 2021-06-08 18:00:53 PDT
Comment on attachment 430926 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=430926&action=review

> Source/WebCore/page/Performance.h:78
> +    DOMHighResTimeStamp timeOrigin() const;

Is this time origin varied across origins?
Otherwise, it can create cross-origin tracking vector, right?
Comment 4 Alex Christensen 2021-06-08 18:40:16 PDT
Comment on attachment 430926 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=430926&action=review

>> Source/WebCore/page/Performance.h:78
>> +    DOMHighResTimeStamp timeOrigin() const;
> 
> Is this time origin varied across origins?
> Otherwise, it can create cross-origin tracking vector, right?

This time stamp is in milliseconds since 1970, so it doesn't identify the user that way.
The value is from the time the DocumentLoader started loading the Document (seen in DOMWindow::performance) or the time that the Worker was created (seen in WorkerGlobalScope::WorkerGlobalScope) which should not lead to a tracking vector.  This value is already indirectly exposed through Performance::now, which is the number of milliseconds since this time.
I'm hoping this is covered by tests.  Waiting on EWS.  If it isn't, I'll write some.
Comment 5 Alex Christensen 2021-06-08 19:56:42 PDT
Created attachment 430935 [details]
Patch
Comment 6 Alex Christensen 2021-06-09 10:01:54 PDT
http://trac.webkit.org/r278665