[RuntimeEnabled] does not work with enum values |
|||
Issue descriptionChrome Version: M69 OS: All Example CL: https://chromium-review.googlesource.com/c/chromium/src/+/1119565 enum MediaKeySessionType { "temporary", "persistent-license", [RuntimeEnabled=EncryptedMediaPersistentUsageRecordSession] "persistent-usage-record", }; MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary") Now without enabling EncryptedMediaPersistentUsageRecordSession, if I run m.createSession('persistent-usage-record') I get a DOMException (Unsupported session type), while ideally I should get a TypeError: ... The provided value 'persistent-usage-record' is not a valid enum valud of tyep MEdiaKeySessionType. Also, the use of [RuntimeEnabled] on enum values is not documented at https://chromium.googlesource.com/chromium/src/+/50.0.2661.2/third_party/WebKit/Source/bindings/idl-extended-attributes.md#RuntimeEnabled_i_m_a_c -
,
Aug 9
,
Aug 9
We are sorry, but the extended attributes on enumeration values are invalid syntax, and the IDL compiler should stop with an error. https://heycam.github.io/webidl/#idl-enums Our IDL parser just accepts them accidentally, and it should be fixed not to allow them. Please check the value with the runtime enabled flag in the receiver's implementation, as you do in MediaKeys::createSession().
,
Aug 9
Thanks for the clarification! I'll drop the [RuntimeEnabled] attribute on the new enum from my CL, but keep the C++ check.
,
Aug 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/36fcc8ace288e10163895764608c716b8eccd9f5 commit 36fcc8ace288e10163895764608c716b8eccd9f5 Author: Hitoshi Yoshida <peria@chromium.org> Date: Fri Aug 10 01:53:24 2018 IDL parser: Drop accepting extended attributes on enum values For now, IDL parser allows to put extended attributes on enum values, that is syntactically invalid in Web IDL spec [1]. In Blink, other IDL compiler parts ignore them, and no IDL files have them. In order to avoid misleading developers, this CL makes IDL parser to disallow extended attributes on enum values. [1] https://heycam.github.io/webidl/#idl-enums Bug: 871867 Change-Id: Ic57406ce3ff94a0c1a4cf38da12b217c05667eb0 Reviewed-on: https://chromium-review.googlesource.com/1169482 Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Hitoshi Yoshida <peria@chromium.org> Cr-Commit-Position: refs/heads/master@{#582009} [modify] https://crrev.com/36fcc8ace288e10163895764608c716b8eccd9f5/tools/idl_parser/idl_parser.py |
|||
►
Sign in to add a comment |
|||
Comment 1 by fs...@chromium.org
, Aug 8Status: Available (was: Untriaged)