From b0b846d8921b6062f3a98a12a96b8074bfd1541d Mon Sep 17 00:00:00 2001 From: Chun-Min Chang Date: Wed, 9 Oct 2019 16:36:12 -0700 Subject: [PATCH] Update type of MediaMetadata's artwork Since the entries in the MediaMetadata's `artwork` are frozen in the current spec [1], the type of the attribute `artwork` must be `FrozenArray` rather than `FrozenArray`, otherwise the entries of artwork can not be frozen [2]. This change will address issue #237 The `artwork` in `MediaMetadataInit` and `MediaMetadata` will be clearly different after changing the `artwork` in `MediaMetadata` to `FrozenArray`, hence the _getter_, _setter_ of `artwork` and the _convert artwork algorithm_ should be updated to match the change. This change will address issue #176 [1] https://github.com/web-platform-tests/wpt/blob/801a2b3b5e1cd0192f31890ddf9ee7b4d0ad9e89/mediasession/mediametadata.html#L148 [2] https://tc39.es/ecma262/#sec-object.freeze --- index.bs | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/index.bs b/index.bs index 52eacb2..6c7f034 100644 --- a/index.bs +++ b/index.bs @@ -903,7 +903,7 @@ interface MediaMetadata { attribute DOMString title; attribute DOMString artist; attribute DOMString album; - attribute FrozenArray<MediaImage> artwork; + attribute FrozenArray<object> artwork; }; dictionary MediaMetadataInit { @@ -933,7 +933,8 @@ dictionary MediaMetadataInit {

A {{MediaMetadata}} has an associated list of artwork - images. + images which is a list of type object on the interface + but a list of type {{MediaImage}} internally.

@@ -971,9 +972,10 @@ dictionary MediaMetadataInit {

  • Run the convert artwork algorithm with init's - {{MediaMetadataInit/artwork}} as input and set - metadata's artwork images as the - result if it succeeded. + {{MediaMetadataInit/artwork}} as input, + where the input is a list of type {{MediaImage}}, + and set metadata's artwork images + as the result if it succeeded.
  • Return metadata. @@ -982,7 +984,8 @@ dictionary MediaMetadataInit {

    When the convert artwork algorithm with input parameter is -invoked, the user agent MUST run the following steps: +invoked, where the input is a list of type {{MediaImage}}, +the user agent MUST run the following steps:
    1. Let output be an empty list of type {{MediaImage}}. @@ -1050,7 +1053,7 @@ invoked, the user agent MUST run the following steps: images. On getting, it MUST return the result of the following steps:
      1. - Let frozenArtwork be an empty list of type {{MediaImage}}. + Let frozenArtwork be an empty list of type object.
      2. For each entry in the {{MediaMetadata}}'s image's {{MediaImage/type}} to entry's {{MediaImage/type}}.
      3. +
      4. + Convert image into an object + whose type is object. +
      5. - Call Object.freeze on image, to prevent - accidental mutation by scripts. + Call Object.freeze on the object, + to prevent accidental mutation by scripts.
      6. - Append image to frozenArtwork. + Append the object to frozenArtwork.
    2. @@ -1089,10 +1096,18 @@ invoked, the user agent MUST run the following steps: Create a frozen array from frozenArtwork.
    - On setting, it MUST run the - convert artwork algorithm with the new value as input, and - set the {{MediaMetadata}}'s artwork images as the - result if it succeeded. + On setting, it MUST run the following steps: +
      +
    1. + Convert the frozenArtwork from a list of type object + into a list of type {{MediaImage}}. +
    2. +
    3. + Run convert artwork algorithm with the converted list as + input, and set the {{MediaMetadata}}'s + artwork images as the result if it succeeded. +
    4. +