PSA: Shipping non-functional constructors in Web Animations

54 views
Skip to first unread message

Suzy Howlett

unread,
May 25, 2017, 1:58:11 AM5/25/17
to blink-dev
Hi blink-dev,

I am working on implementing some more details of the Web Animations level 1 API. This email is to give you a heads-up that although we're not ready to ship these details, the implementation process has some user-visible changes.

Animation constructor
To be specific, at the moment I am implementing the Animation constructor. Animation was previously shipped as a NoInterfaceObject. I now want to ship a constructor that throws an "Illegal constructor" exception if the WebAnimationsAPI runtime flag is not enabled. This results in the following user-visible change:

Before
> var a = new Animation();
Uncaught ReferenceError: Animation is not defined
    at <anonymous>:1:13

After
> var a = new Animation();
Uncaught TypeError: Failed to construct 'Animation': Illegal constructor
    at <anonymous>:1:9

Upcoming changes
We are also looking at doing the following:
  • Expose constructors for KeyframeEffect, KeyframeEffectReadOnly, DocumentTimeline
  • Make Animation.timeline mutable
  • Expose Document.timeline
  • Allow KeyframeEffect mutation
As much as possible we will keep the implementation behind the WebAnimationsAPI flag. However, one or more of these may have similar user-visible effects.

If you have any questions or concerns, please let me know.

Thanks,
Suzy

Dominic Cooney

unread,
May 25, 2017, 2:55:16 AM5/25/17
to Suzy Howlett, ba...@chromium.org, blink-dev
Could you just use/change the bindings system so you do not have to do that? For example you could put a property in window that is RuntimeEnabled to expose the constructor. Maybe bashi has an even better idea of what the bindings system can do.

If not, why not do an intent to ship for this instead of this FYI?

Dominic

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAFV_mdoTovgB61-r_3uFFgbG-Va7z78gNF2LHsUJzH_T%3DVk8qw%40mail.gmail.com.

Suzy Howlett

unread,
May 29, 2017, 12:44:53 AM5/29/17
to Dominic Cooney, ba...@chromium.org, blink-dev
It would be nifty if this could be done through the bindings system. If there's an easy way to do that, without just adding a feature that will rarely be used, I'm open to changing the approach.

As for the other question, I think this lands in the boundary zone between PSA and Intent. I reasoned that since it did not provide any new capabilities to web developers, then it was suitable for a PSA.

If anyone has any suggestions for how to approach this through the bindings system, or any other ideas, I'll leave this patch open until the end of the week. I'll look at landing it on Friday (APAC time) if there are no objections.

Thanks,
Suzy

Kenichi Ishibashi

unread,
May 29, 2017, 2:19:43 AM5/29/17
to Suzy Howlett, Dominic Cooney, blink-dev, pe...@chromium.org
Chatted peria@ about how to annotate RuntimeEnabled constructor. Maybe an option would be to add RuntimeEnabledConstuctor=foo extended attribute. If the extended attribute exists, all constructors are visible only when the corresponding flag is enabled. It shouldn't be hard to add such extended attribute. WDYT?

PhistucK

unread,
May 29, 2017, 2:28:32 AM5/29/17
to Suzy Howlett, blink-dev

On Thu, May 25, 2017 at 8:57 AM, Suzy Howlett <su...@chromium.org> wrote:
WebAnimationsAPI runtime flag is not enabled

​Is this currently the default?​



PhistucK

Suzy Howlett

unread,
May 29, 2017, 2:32:26 AM5/29/17
to PhistucK, blink-dev
Correct. Some Web Animations behaviour has been shipped, and some is behind the WebAnimationsAPI flag which is disabled by default.

Hitoshi Yoshida

unread,
May 30, 2017, 5:50:08 AM5/30/17
to Suzy Howlett, PhistucK, blink-dev
I found a Blink specific extended attribute "Exposed(Global RuntimeEnabledFeature)"
Does this work for you, Suzy? See the last paragraph of [Exposed] for the details.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Suzy Howlett

unread,
May 31, 2017, 7:53:16 PM5/31/17
to Hitoshi Yoshida, PhistucK, blink-dev
Sorry, I'm out sick unexpectedly. I'll get back to this next week.

Suzy Howlett

unread,
Jun 6, 2017, 2:08:06 AM6/6/17
to Hitoshi Yoshida, PhistucK, blink-dev
Aha! It took a bit of poking around in the generate_global_constructors.py to figure out how to make it work, but yes, this seems to do what I want:

[
    Constructor(....),
    Exposed(Window WebAnimationsAPI),
    ...
] interface Animation : EventTarget {
    ...
}

It didn't seem happy with "Exposed(Global X)" because "Global" is not one of the keys of EXPOSED_EXECUTION_CONTEXT_METHOD. However, Window is the only one we care about in this case, so this is adequate for my purposes.

I've updated my patch at https://codereview.chromium.org/2806623003 and am sending it through a CQ dry run now. I'll send a further update after seeing how that goes.


On Tue, May 30, 2017 at 7:50 PM Hitoshi Yoshida <pe...@chromium.org> wrote:

Suzy Howlett

unread,
Jun 9, 2017, 12:26:46 AM6/9/17
to Hitoshi Yoshida, PhistucK, blink-dev
OK, all signs are that this works. I'd appreciate an extra lgtm from peria@ or someone else on this thread before I submit, but otherwise this is ready to go.
Reply all
Reply to author
Forward
0 new messages