tc39 / proposal-shadowrealm

ECMAScript Proposal, specs, and reference implementation for Realms
https://tc39.es/proposal-shadowrealm/
1.41k stars 67 forks source link

Web Integration: Performance mixin? #387

Closed mgaudet closed 5 months ago

mgaudet commented 1 year ago

In #331 a few performance related PRs were merged; but I don't think any of them merged an actual performance object. In the hr-time spec that's the

partial interface mixin WindowOrWorkerGlobalScope {
  [Replaceable] readonly attribute Performance performance;
};

If we want to expose the Performance interfaces, we need a Performance object to act as receiver for some of the methods of interest.

caridy commented 5 months ago

cc @ptomato

ptomato commented 5 months ago

@caridy @leobalter Whoops, this looks like my mistake. Performance is still marked as Exposed=(Window,Worker) in WPT's IDL files, which is what I based my research on for the list of included APIs. But it looks like it should be Exposed=* as per https://github.com/w3c/hr-time/pull/130 and https://github.com/w3c/performance-timeline/pull/193. I'll go through the other PRs listed in #331 and see if there's any other discrepancies.

mgaudet commented 5 months ago

To be clear, based on the rationale in #393, performance shouldn't be included (and in general, I'd support its exclusion).

caridy commented 5 months ago

I don't think performance violate the criteria that we are using for inclusion/exclusion. Does it break confidentiality? Is performance.memory.usedJSHeapSize and co. problematic from that perspective?

Update: after further review of the new API (https://developer.mozilla.org/en-US/docs/Web/API/Performance/measureUserAgentSpecificMemory), that seems a lot more problematic. Certainly leaking origin information.

mgaudet commented 5 months ago

Also just generally “host access”

caridy commented 5 months ago

I have added my notes on performance here https://github.com/tc39/proposal-shadowrealm/blob/main/apis.md#performance-api

caridy commented 5 months ago

@ptomato is there anything else pending to exclude performance from the initial list?

ptomato commented 5 months ago

Yes, we should remove the [Exposed=*] annotations from the W3C specs for performance and its properties.

ptomato commented 5 months ago

I found that these were already reverted.

(So that's why they didn't show up in WPT's IDL files! ref https://github.com/tc39/proposal-shadowrealm/issues/387#issuecomment-1930519059)

So I think we're good in terms of excluding performance from the initial list.