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

Replaceable attribute window.performance #1193

Closed
legendecas opened this issue Sep 18, 2022 · 2 comments
Closed

Replaceable attribute window.performance #1193

legendecas opened this issue Sep 18, 2022 · 2 comments

Comments

@legendecas
Copy link

https://webidl.spec.whatwg.org/#Replaceable defines that a replaceable attribute should be an IDL attribute (accessor pair defined on the prototype instead of the instance objects), whilst it can be replaced with shadowing the prototype accessor when setting the corresponding property on the platform object, like the https://webidl.spec.whatwg.org/#example-fe2bdbf4 shows.

window.performance is defined as a replaceable attribute on WindowOrWorkerGlobalScope. Major browser implementations (Chrome, Safari, Firefox) seem to be diverging from the definition of a replaceable attribute:

window. hasOwnProperty('performance'); // => true, should be false according to the definition.
Object.getPrototypeOf(window).hasOwnProperty('performance'); // => false, should be true

Is this an implementation bug, or should we update the spec to reflect what the reality is?

Refs: nodejs/node#44483 (comment)

@petervanderbeken
Copy link

petervanderbeken commented Sep 18, 2022

window. hasOwnProperty('performance'); // => true, should be false according to the definition.

Interface members for interfaces marked with [Global] are properties on the instance object instead of on the interface prototype object. (see https://webidl.spec.whatwg.org/#es-attributes and step 10 in https://webidl.spec.whatwg.org/#es-platform-objects). [Replaceable] really only changes the behaviour of the attribute's setter (see step 4.5.5 in https://webidl.spec.whatwg.org/#dfn-attribute-setter).

@domenic domenic closed this as completed Sep 18, 2022
@legendecas
Copy link
Author

Thank you for the clarification.

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

No branches or pull requests

3 participants