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|:
+ - Set |manifest|["dir"] to "auto".
+
- If |json|["dir"] doesn't [=map/exist=] or if |json|["dir"] is not
a [=string=], return.
@@ -679,6 +681,8 @@
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
+ - Set |manifest|["display"] to "browser".
+
- If |json|["display"] doesn't [=map/exist=] or |json|["display"]
is not a a [=string=], return.
@@ -773,6 +777,8 @@
|manifest URL:URL|, and [=URL=] |document URL:URL|:
+ - Set |manifest|["start_url"] to |document URL|.
+
- If |json|["start_url"] doesn't [=map/exist=] or
|json|["start_url"] is not a [=string=], return.
@@ -784,8 +790,8 @@
- If |start URL| is failure, return.
- - If |start URL| is not same origin as document
- URL, return.
+
- If |start URL| is not same origin as |document URL|,
+ return.
- Otherwise, set |manifest|["start_url"] to |start URL|.
@@ -1267,21 +1273,14 @@
-
- Let |manifest:ordered map| be a new [=ordered map=] «[
- "display" → "browser", "dir" → "auto", "start_url" → |document URL|
- ]».
+
- Let |manifest:ordered map| be an empty [=ordered map=].
- [=Process the `dir` member=] passing |json| and |manifest|.
- [=Process the `lang` member=] passing |json| and |manifest|.
- - [=list/For each=] |member:string| of [=list=] « "name",
- "short_name" »:
-
- - [=Process a text member=] passing |json|, |manifest|, and
- |member|.
-
-
+ - [=Process a text member=] passing |json|, |manifest|, and
+ "name".
- [=Process a text member=] passing |json|, |manifest|, and
"short_name".
@@ -1291,8 +1290,7 @@
- [=Process the `start_url` member=] passing |json|, |manifest|,
|manifest URL|, and |document URL|.
- - [=Process the `id` member=] passing |json|, |manifest| and
- |document URL|.
+
- [=Process the `id` member=] passing |json| and |manifest|.
- If the [=document=]'s [=document|processed manifest=] is not
null, and [=document=]'s [=document|processed manifest=]'s id is
@@ -1302,13 +1300,11 @@
- [=Process the `scope` member=] passing |json|, |manifest|, and
|manifest URL|.
- - [=list/For each=] |member:string| of [=list=] « "theme_color",
- "background_color" »:
-
- - [=Process a color member=] passing |json|, |manifest|, and
- |member|.
-
-
+ - [=Process a color member=] passing |json|, |manifest|, and
+ "theme_color".
+
+ - [=Process a color member=] passing |json|, |manifest|, and
+ "background_color".
- [=Process the `display` member=] passing |json| and |manifest|.