Event: Drop Event.path or change its type |
||||||
Issue description
Event.path is a non-standard method in Event.idl declared as
[MeasureAs=EventPath, CallWith=ScriptState] readonly attribute EventTarget[] path;
I'd like to remove support for WebIDL arrays (such as "EventTarget[]") from Blink, as they were dropped from the spec in 2015.
Since |path| is not part of the spec we need to figure out whether usage is low enough to justify removing it or whether we can just change its type to a sequence<> or a FrozenArray<>.
It's not clear if Source/core/events has active owners, so I'm CC'ing people who either worked on the code or could find people to help with this.
,
Jul 11 2017
,
Jul 11 2017
,
Jul 11 2017
See https://bugs.chromium.org/p/chromium/issues/detail?id=671907. The usage counter is: https://www.chromestatus.com/metrics/feature/popularity#EventPath I think Event#path can be deprecated separately from other Shadow DOM v0 APIs. > whether we can just change its type to a sequence<> or a FrozenArray<>. Is this user visible change?
,
Jul 11 2017
,
Jul 11 2017
Thanks for the explanation, it's nice to know this has already been discussed before. Is 2.19% low enough a number for us to consider deprecating/removing it? >> whether we can just change its type to a sequence<> or a FrozenArray<>. > Is this user visible change? sequences cannot be used as attribute types, and a FrozenArray would make the returned object frozen, which is a user-visible change. Another possibility is to make it an object instead of an EventTarget[] and handle the conversion to an array/sequence in the C++ side (this should be transparent to users I think).
,
Jul 12 2017
2.19% is pretty high. :) I remember that I once tried to deprecate Event.path, but that was objected. :( See https://groups.google.com/a/chromium.org/d/msg/blink-dev/8_x0OHYQdx0/jquuYXWWLOYJ
,
Jul 12 2017
> sequences cannot be used as attribute types, and a FrozenArray would make the returned object frozen, which is a user-visible change. Another possibility is to make it an object instead of an EventTarget[] and handle the conversion to an array/sequence in the C++ side (this should be transparent to users I think). Thank you for the explanation. I understand that this is a user visible change, however, I think the risk is low. As long as we announced the change at blink-dev@, and having an entry in https://www.chromestatus.com/features, I think it is okay to change. I support it. Event.path should be avoided, in favor of Event.deepPath(), anyway.
,
Aug 4 2017
I was considering using an `object' in the IDL file; since this isn't going to be spec'ed, doing so errs on the side of caution and should not have any user-visible changes at all. I may be overlooking it, but I couldn't find any layout tests using Event#path to double-check my patch. Is there something I missed?
,
Aug 6 2017
,
Aug 8 2017
Maybe I've renamed all the usage of Event#path of layout tests with Event#composedPath(). :(
,
Aug 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5232f5ecbe69c962d633d62c3177f7d5f7e6bbbf commit 5232f5ecbe69c962d633d62c3177f7d5f7e6bbbf Author: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> Date: Wed Aug 09 11:27:45 2017 Declare Event#path as an object, not an EventTarget[]. Arrays were removed from WebIDL in 2015, and this is another step towards removing all usages from Blink. Since Event#path is part of Shadow DOM v0 and thus not part of any active spec, take the least disruptive path by turning the EventTarget[] declaration in the IDL into an object. This should not have any user-visible effects, as the C++ side returns the same array it returned before, but manually wrapped inside a ScriptValue. Bug: 740870 Change-Id: Idb0574c4e7e1188f1e4202e9e6cd056582a6e4c1 Reviewed-on: https://chromium-review.googlesource.com/605648 Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Reviewed-by: Hayato Ito <hayato@chromium.org> Cr-Commit-Position: refs/heads/master@{#492942} [add] https://crrev.com/5232f5ecbe69c962d633d62c3177f7d5f7e6bbbf/third_party/WebKit/LayoutTests/shadow-dom/v0/event-path.html [modify] https://crrev.com/5232f5ecbe69c962d633d62c3177f7d5f7e6bbbf/third_party/WebKit/Source/core/events/Event.cpp [modify] https://crrev.com/5232f5ecbe69c962d633d62c3177f7d5f7e6bbbf/third_party/WebKit/Source/core/events/Event.h [modify] https://crrev.com/5232f5ecbe69c962d633d62c3177f7d5f7e6bbbf/third_party/WebKit/Source/core/events/Event.idl
,
Aug 9 2017
I think this is now fixed without any user-visible changes. I also resurrected one of the tests that used to check for Event.path, so hopefully there's some (minimal) coverage now. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by raphael....@intel.com
, Jul 11 2017