From eb86fc20725ad7e5bb3c1a25bee9d47fad344577 Mon Sep 17 00:00:00 2001 From: Chun-Min Chang Date: Wed, 9 Oct 2019 16:36:12 -0700 Subject: [PATCH 1/5] 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 | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/index.bs b/index.bs index 6468441..51bc5f6 100644 --- a/index.bs +++ b/index.bs @@ -1063,7 +1063,7 @@ interface MediaMetadata { attribute DOMString title; attribute DOMString artist; attribute DOMString album; - attribute FrozenArray<MediaImage> artwork; + attribute FrozenArray<object> artwork; [SameObject] readonly attribute FrozenArray<ChapterInformation> chapterInfo; }; @@ -1095,7 +1095,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.

@@ -1139,9 +1140,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.
  • Let chapters be an empty list of type {{ChapterInformation}}. @@ -1164,7 +1166,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}}. @@ -1230,7 +1233,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(O)}} on image, to prevent accidental - mutation by scripts. + Perform [=!=] SetIntegrityLevel(frozenArtwork, "frozen").
      6. - Append the object to frozenArtwork. + Set the {{MediaMetadata}}'s converted artwork images to frozenArtwork.
    2. - Create a frozen array from frozenArtwork. + Return the {{MediaMetadata}}'s converted artwork images.
    On setting, it MUST run the following steps:
    1. - Convert the frozenArtwork from a list of type object - into a list of type {{MediaImage}}. + Let convertedArtwork be the result of converting + the new value input into a sequence of type {{MediaImage}}.
    2. - Run convert artwork algorithm with the converted list as + Run convert artwork algorithm with the converted sequence as input, and set the {{MediaMetadata}}'s - artwork images as the result if it succeeded. + artwork images as the result if it succeeds. +
    3. +
    4. + Set the {{MediaMetadata}}'s converted artwork images to undefined.

    @@ -1384,11 +1379,12 @@ dictionary ChapterInformationInit {
  • Let {{ChapterInformationInit/artwork}} be the result of running the - convert artwork algorithm. + convert artwork algorithm with init's + {{ChapterInformation/artwork}} as input.
  • Set chapterInfo's artwork - images to the result of [=Create a frozen array|creating a frozen + images be the result of [=Create a frozen array|creating a frozen array=] from {{ChapterInformationInit/artwork}}.
  • From 6224a4b2bbf5569a96bcf07803d4052cedd4726b Mon Sep 17 00:00:00 2001 From: youenn Date: Sun, 29 Sep 2024 11:49:21 -0700 Subject: [PATCH 4/5] cleanup --- index.bs | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/index.bs b/index.bs index 4c946e3..6755a87 100644 --- a/index.bs +++ b/index.bs @@ -1095,9 +1095,10 @@ dictionary MediaMetadataInit {

    - A {{MediaMetadata}} has an associated sequence of artwork - images, which is a sequence of type {{MediaImage}}. - A {{MediaMetadata}} also has has an associated + A {{MediaMetadata}} has an associated sequence of artwork images, which is a sequence of type + {{MediaImage}}. A {{MediaMetadata}} also has has an associated converted artwork images which is initially undefined.

    @@ -1167,8 +1168,8 @@ dictionary MediaMetadataInit {

    When the convert artwork algorithm with input parameter is -invoked, where the input is a sequence of type {{MediaImage}}, -the user agent MUST run the following steps: +invoked, where the input is a sequence of type {{MediaImage}}, the +user agent MUST run the following steps:
    1. Let output be an empty list of type {{MediaImage}}. @@ -1234,8 +1235,8 @@ the user agent MUST run the following steps: images. On getting, it MUST run the following steps:
      1. - If the {{MediaMetadata}}'s converted artwork images is undefined, - run the following steps: + If the {{MediaMetadata}}'s converted artwork images is + undefined, run the following steps:
        1. Let frozenArtwork be a Javascript Array value. @@ -1245,10 +1246,12 @@ the user agent MUST run the following steps: for="MediaMetadata">artwork images, perform the following steps:
          1. - Convert entry into a Javascript object named image. + Convert entry into a Javascript object named + image.
          2. - Perform [=!=] SetIntegrityLevel(image, + Perform [=!=] SetIntegrityLevel(image, "frozen"), to prevent accidental mutation by scripts.
          3. @@ -1257,10 +1260,13 @@ the user agent MUST run the following steps:
        2. - Perform [=!=] SetIntegrityLevel(frozenArtwork, "frozen"). + Perform [=!=] SetIntegrityLevel(frozenArtwork, + "frozen").
        3. - Set the {{MediaMetadata}}'s converted artwork images to frozenArtwork. + Set the {{MediaMetadata}}'s converted artwork images to + frozenArtwork.
      2. @@ -1271,8 +1277,8 @@ the user agent MUST run the following steps: On setting, it MUST run the following steps:
        1. - Let convertedArtwork be the result of converting - the new value input into a sequence of type {{MediaImage}}. + Let convertedArtwork be the result of converting the new value + input into a sequence of type {{MediaImage}}.
        2. Run convert artwork algorithm with the converted sequence as @@ -1280,7 +1286,8 @@ the user agent MUST run the following steps: artwork images as the result if it succeeds.
        3. - Set the {{MediaMetadata}}'s converted artwork images to undefined. + Set the {{MediaMetadata}}'s converted artwork images to + undefined.

        @@ -1384,7 +1391,7 @@ dictionary ChapterInformationInit {
      3. Set chapterInfo's artwork - images be the result of [=Create a frozen array|creating a frozen + images to the result of [=Create a frozen array|creating a frozen array=] from {{ChapterInformationInit/artwork}}.
      4. From 6f5ac6373d5680753fbd24749e2cec01fab9d969 Mon Sep 17 00:00:00 2001 From: youenn Date: Sun, 29 Sep 2024 12:07:54 -0700 Subject: [PATCH 5/5] Add convert links --- index.bs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/index.bs b/index.bs index 6755a87..0b9abdc 100644 --- a/index.bs +++ b/index.bs @@ -1235,19 +1235,19 @@ user agent MUST run the following steps: images. On getting, it MUST run the following steps:
        1. - If the {{MediaMetadata}}'s converted artwork images is + If the {{MediaMetadata}}'s converted artwork images is undefined, run the following steps:
          1. - Let frozenArtwork be a Javascript Array value. + Let frozenArtwork be a JavaScript Array value.
          2. For each entry in the {{MediaMetadata}}'s artwork images, perform the following steps:
            1. - Convert entry into a Javascript object named - image. + Let image be the result of [=converted to a JavaScript + value|converting to a JavaScript object=] entry.
            2. Perform [=!=] converted artwork images.
            - On setting, it MUST run the following steps: + On setting, it MUST run the following steps with value being the + new value being set:
            1. - Let convertedArtwork be the result of converting the new value - input into a sequence of type {{MediaImage}}. + Let convertedArtwork be the result of [=converted to an IDL + value|converting=] value to a sequence of type {{MediaImage}}.
            2. - Run convert artwork algorithm with the converted sequence as - input, and set the {{MediaMetadata}}'s - artwork images as the result if it succeeds. + Run convert artwork algorithm with convertedArtwork, and + set the {{MediaMetadata}}'s artwork images as + the result if it succeeds.
            3. Set the {{MediaMetadata}}'s converted artwork images to