Skip to content


Browse files Browse the repository at this point in the history
Rewrite processing shortcuts algorithm to be more precise (#832)
Normative changes:

* shortcuts that meet certain failure conditions are ignored.
  * Checks that name and url are present, URL is valid and within scope of the manifest.

Other changes:

* Clarify that the ShortcutItem url member needs to be within scope.
* Rewrite processing shortcuts algorithm as an ordered list.
* Creates a new array and returns it, rather than discarding the result.
* Explicitly says where developer warnings should be issued.

Closes #831
  • Loading branch information
mgiuca committed Dec 9, 2019
1 parent a9d989d commit 83fd72b
Showing 1 changed file with 42 additions and 12 deletions.
54 changes: 42 additions & 12 deletions index.html
Expand Up @@ -1531,7 +1531,7 @@ <h3>
<li>Set <var>manifest</var>["<a>shortcuts</a>"] to the result of
running <a>processing the <code>shortcuts</code> member</a> given
<var>manifest URL</var>, and <code>"shortcuts"</code>.
<var>manifest</var>["<a>shortcuts</a>"] and <var>manifest URL</var>.
<a>Extension point</a>: process any proprietary and/or other
Expand Down Expand Up @@ -2345,17 +2345,43 @@ <h3>
are given by the following algorithm. The algorithm takes a
<a data-cite=
<var>shortcuts</var> as an argument. This algorithm returns an
<a data-cite=
"WEBIDL#sequence-type">sequence</a>&lt;<a>ShortcutItem</a>&gt;. For
each <var>shortcut</var> (<a>ShortcutItem</a>) in the sequence, set
<var>shortcut.icons</var> to the result of running <a>processing
`ImageResource` members</a> given <var>shortcut.icons</var> and
<var>manifest URL</var>. For each <var>shortcut</var>
(<a>ShortcutItem</a>) in the sequence, parse
<var>shortcut</var>["<a>url</a>"] using <var>manifest URL</var> as
the base URL.
<var>shortcuts</var> and a <a>URL</a> <var>manifest URL</var>. This
algorithm returns a <a data-cite=
<li>Let <var>processedShortcuts</var> be a new Array object created
as if by the expression [].
<li>For each <var>shortcut</var> (<a>ShortcutItem</a>) in the
<li>If <var>shortcut</var>["name"] or <var>shortcut</var>["url"]
are undefined, or if <var>shortcut</var>["name"] is the empty
string, <a>issue a developer warning</a> and <a>continue</a>.
<li>Set <var>shortcut</var>["icons"] to the result of running <a>
processing `ImageResource` members</a> given
<var>shortcut</var>["icons"] and <var>manifest URL</var>.
<li>Set <var>shortcut</var>["url"] to the result of
<a>parsing</a> <var>shortcut</var>["url"] using <var>manifest
URL</var> as the base URL. If the result is failure, <a>issue a
developer warning</a> and <a>continue</a>.
<li>If <var>shortcut</var>["url"] is not <a>within scope</a> of
<var>manifest URL</var>, <a>issue a developer warning</a> and <a>
<a>Append</a> <var>shortcut</var> to
<li>Return <var>processedShortcuts</var>.
A user agent SHOULD expose shortcuts via interactions that are
consistent with exposure of an application icon's context menu in the
Expand Down Expand Up @@ -3022,7 +3048,8 @@ <h3>
The <dfn>url</dfn> member of a <a>ShortcutItem</a> is the <a>URL</a>
that opens when the associated shortcut is activated.
<a data-lt="within scope of a manifest">within the application's
scope</a> that opens when the associated shortcut is activated.
<section data-dfn-for="ShortcutItem" data-link-for="ShortcutItem">
Expand Down Expand Up @@ -3886,6 +3913,9 @@ <h3>
<dfn data-cite="INFRA#list-contain">contains</dfn>
<dfn data-cite="INFRA#iteration-continue">continue</dfn>
<li>[[ECMASCRIPT]] defines the following terms:
Expand Down

0 comments on commit 83fd72b

Please sign in to comment.