From 80310d0ba606c0adaaca7c91e29b2174a6b98a1c Mon Sep 17 00:00:00 2001 From: Matt Giuca Date: Wed, 25 Jan 2023 13:22:08 +1100 Subject: [PATCH] Editorial: Minor cleanup / refactor of Manifest processing steps (#1066) - Fixed call to "process the id member" (removed the document URL argument which is not actually accepted by that algorithm). - Removed unnecessarily complex for loops over ~2 members when it's more readable to just have a separate step for each member. - Use Respec-style syntax instead of HTML. - Moved default values into individual processing steps. This keeps the relevant info about the default values of members closely related to the other relevant material about that member. It's also consistent with how the rest of the members (e.g. scope) treat default values. And prevents possible errors where the incorrect default value is used by an intermediate step in between assigning the default and assigning the actual value. Pre-work for #668. --- index.html | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index c671d7759..9ad606df2 100644 --- a/index.html +++ b/index.html @@ -502,6 +502,8 @@

|json:ordered map| and [=ordered map=] |manifest:ordered map|:

    +
  1. Set |manifest|["dir"] to "auto". +
  2. If |json|["dir"] doesn't [=map/exist=] or if |json|["dir"] is not a [=string=], return.
  3. @@ -679,6 +681,8 @@

    |json:ordered map| and [=ordered map=] |manifest:ordered map|:

      +
    1. Set |manifest|["display"] to "browser". +
    2. If |json|["display"] doesn't [=map/exist=] or |json|["display"] is not a a [=string=], return.
    3. @@ -773,6 +777,8 @@

      |manifest URL:URL|, and [=URL=] |document URL:URL|:

        +
      1. Set |manifest|["start_url"] to |document URL|. +
      2. If |json|["start_url"] doesn't [=map/exist=] or |json|["start_url"] is not a [=string=], return.
      3. @@ -784,8 +790,8 @@

      4. If |start URL| is failure, return.
      5. -
      6. If |start URL| is not same origin as document - URL, return. +
      7. If |start URL| is not same origin as |document URL|, + return.
      8. Otherwise, set |manifest|["start_url"] to |start URL|.
      9. @@ -1267,21 +1273,14 @@

      -
    4. Let |manifest:ordered map| be a new [=ordered map=] «[ - "display" → "browser", "dir" → "auto", "start_url" → |document URL| - ]». +
    5. Let |manifest:ordered map| be an empty [=ordered map=].
    6. [=Process the `dir` member=] passing |json| and |manifest|.
    7. [=Process the `lang` member=] passing |json| and |manifest|.
    8. -
    9. [=list/For each=] |member:string| of [=list=] « "name", - "short_name" »: -
        -
      1. [=Process a text member=] passing |json|, |manifest|, and - |member|. -
      2. -
      +
    10. [=Process a text member=] passing |json|, |manifest|, and + "name".
    11. [=Process a text member=] passing |json|, |manifest|, and "short_name". @@ -1291,8 +1290,7 @@

    12. [=Process the `start_url` member=] passing |json|, |manifest|, |manifest URL|, and |document URL|.
    13. -
    14. [=Process the `id` member=] passing |json|, |manifest| and - |document URL|. +
    15. [=Process the `id` member=] passing |json| and |manifest|.
    16. If the [=document=]'s [=document|processed manifest=] is not null, and [=document=]'s [=document|processed manifest=]'s id is @@ -1302,13 +1300,11 @@

    17. [=Process the `scope` member=] passing |json|, |manifest|, and |manifest URL|.
    18. -
    19. [=list/For each=] |member:string| of [=list=] « "theme_color", - "background_color" »: -
        -
      1. [=Process a color member=] passing |json|, |manifest|, and - |member|. -
      2. -
      +
    20. [=Process a color member=] passing |json|, |manifest|, and + "theme_color". +
    21. +
    22. [=Process a color member=] passing |json|, |manifest|, and + "background_color".
    23. [=Process the `display` member=] passing |json| and |manifest|.