[css-houdini-drafts] [css-animationworklet] Verifying the StatefullAnimatior/StatelessAnimator superclass on prototype chain (#850)

majido has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [css-animationworklet] Verifying the StatefullAnimatior/StatelessAnimator superclass on prototype chain  ==
Currently AnimationWorklet differentiate between Stateless/Stateful animators by requiring each specific animator class inherit from a specific superclass. AudioWorklet does something similar with [AudioWorkletProcessor](https://webaudio.github.io/web-audio-api/#audioworkletprocessor).

To specify this correctly we need to check the prototype chain for the registered animator class and see if any ancestor is actually the class we expect a.k.a. `IsSubclassOf(class, expected_ancestor_class)`.

AFAICT, there is no such operation in ECMA262 to achieve this. So for now we have worded the spec to use "[SameValue](https://tc39.github.io/ecma262/#sec-samevalue)" operation and only check the immediate prototype. 

Our options are:

- Ask ECMA262 to add such an operation.
- Implement this in our own spec e.g., by walking up the chain and using the `[SameValue]`.
- Scrap using super-class in our API!


**Note**: I looked at AudioWorklet specification but while their working requires extending AudioWorkletProcessor but the actual [registration](https://webaudio.github.io/web-audio-api/#dom-audioworkletglobalscope-registerprocessor) algorithm does not actually check the prototype chain to verify this and also Chrome implementation does not check it. So AFAICT basically they have the same problem if they are to implement this correctly.


Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/850 using your GitHub account

Received on Monday, 14 January 2019 19:48:48 UTC