Skip to content

Commit

Permalink
Editorial: Minor cleanup / refactor of Manifest processing steps (#1066)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
mgiuca authored Jan 25, 2023
1 parent 7d41b99 commit 80310d0
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ <h3>
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>Set |manifest|["dir"] to "auto".
</li>
<li>If |json|["dir"] doesn't [=map/exist=] or if |json|["dir"] is not
a [=string=], return.
</li>
Expand Down Expand Up @@ -679,6 +681,8 @@ <h3>
|json:ordered map| and [=ordered map=] |manifest:ordered map|:
</p>
<ol class="algorithm">
<li>Set |manifest|["display"] to "browser".
</li>
<li>If |json|["display"] doesn't [=map/exist=] or |json|["display"]
is not a a [=string=], return.
</li>
Expand Down Expand Up @@ -773,6 +777,8 @@ <h3>
|manifest URL:URL|, and [=URL=] |document URL:URL|:
</p>
<ol class="algorithm">
<li>Set |manifest|["start_url"] to |document URL|.
</li>
<li>If |json|["start_url"] doesn't [=map/exist=] or
|json|["start_url"] is not a [=string=], return.
</li>
Expand All @@ -784,8 +790,8 @@ <h3>
</li>
<li>If |start URL| is failure, return.
</li>
<li>If |start URL| is not <a>same origin</a> as <var>document
URL</var>, return.
<li>If |start URL| is not <a>same origin</a> as |document URL|,
return.
</li>
<li>Otherwise, set |manifest|["start_url"] to |start URL|.
</li>
Expand Down Expand Up @@ -1267,21 +1273,14 @@ <h3>
</li>
</ol>
</li>
<li>Let |manifest:ordered map| be a new [=ordered map=] «[
"display" → "browser", "dir" → "auto", "start_url" → |document URL|
]».
<li>Let |manifest:ordered map| be an empty [=ordered map=].
</li>
<li>[=Process the `dir` member=] passing |json| and |manifest|.
</li>
<li>[=Process the `lang` member=] passing |json| and |manifest|.
</li>
<li>[=list/For each=] |member:string| of [=list=] « "name",
"short_name" »:
<ol>
<li>[=Process a text member=] passing |json|, |manifest|, and
|member|.
</li>
</ol>
<li>[=Process a text member=] passing |json|, |manifest|, and
"name".
</li>
<li>[=Process a text member=] passing |json|, |manifest|, and
"short_name".
Expand All @@ -1291,8 +1290,7 @@ <h3>
<li>[=Process the `start_url` member=] passing |json|, |manifest|,
|manifest URL|, and |document URL|.
</li>
<li>[=Process the `id` member=] passing |json|, |manifest| and
|document URL|.
<li>[=Process the `id` member=] passing |json| and |manifest|.
</li>
<li>If the [=document=]'s [=document|processed manifest=] is not
null, and [=document=]'s [=document|processed manifest=]'s id is
Expand All @@ -1302,13 +1300,11 @@ <h3>
<li>[=Process the `scope` member=] passing |json|, |manifest|, and
|manifest URL|.
</li>
<li>[=list/For each=] |member:string| of [=list=] « "theme_color",
"background_color" »:
<ol>
<li>[=Process a color member=] passing |json|, |manifest|, and
|member|.
</li>
</ol>
<li>[=Process a color member=] passing |json|, |manifest|, and
"theme_color".
</li>
<li>[=Process a color member=] passing |json|, |manifest|, and
"background_color".
</li>
<li>[=Process the `display` member=] passing |json| and |manifest|.
</li>
Expand Down

0 comments on commit 80310d0

Please sign in to comment.