Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite processing shortcuts algorithm to be more precise #832

Merged
merged 5 commits into from
Dec 9, 2019

Conversation

mgiuca
Copy link
Collaborator

@mgiuca mgiuca commented Dec 6, 2019

This change (choose one):

  • Breaks existing normative behavior (please add label "breaking")
  • Adds new normative requirements
  • Adds new normative recommendations or optional items
  • Makes only editorial changes (only changes informative sections, or
    changes normative sections without changing behavior)
  • Is a "chore" (metadata, formatting, fixing warnings, etc).

Implementation commitment (delete if not making normative changes):

To my knowledge, no vendor has implemented this yet, so it is safe to change without getting commitment. This is a very small change to add some new error cases which result in the shortcut items being ignored.

Commit message:

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


Preview | Diff

index.html Outdated
Comment on lines 2359 to 2361
<li>If <var>shortcut</var>["name"] or <var>shortcut</var>["url"]
are undefined, <a>issue a developer warning</a> and
<a>continue</a>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undefined or the empty string perhaps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this, but for consistency we don't seem to check for empty string anywhere else in the file (e.g., for the name field at the top level). Do you think it's worth inconsistent treatment here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do check for empty strings where it makes sense, like the Web Share Target spec. I think it makes sense here.

We don't do it elsewhere because manifest properties are interpretable without name, so we don't want to invalidate the whole manifest when its name is empty. In this case, it's seems to be implied that if the name of a ShortcutItem is the empty string, it's invalid.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on warnings for missing and empty. We were actually talking about this internally as we build out the implementation in Windows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Added "or if name is the empty string". Web Share Target is a reasonable precedent (even though it's not in the manifest spec yet).

Copy link
Collaborator

@aarongustafson aarongustafson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mgiuca
Copy link
Collaborator Author

mgiuca commented Dec 9, 2019

Taking @aarongustafson 's LGTM as still valid since the only change I made he was in agreement.

@dominickng
Copy link
Collaborator

LGTM, thanks!

@mgiuca mgiuca merged commit 83fd72b into w3c:gh-pages Dec 9, 2019
@marcoscaceres
Copy link
Member

Gentle reminder to please avoid using the (mostly) deprecated data-cite="spec#whatever" feature. ReSpec's xref feature now handles that for us automagically and it avoids bugs.

If you need to look up a term, you can do directly from ReSpec's Pill's "Search Definitions" option. Or, alternatively, head over to https://respec.org/xref/ to search for terms and "how to cite" them :)

christianliebel pushed a commit to christianliebel/manifest that referenced this pull request May 27, 2020
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 w3c#831
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Steps for processing shortcut member are very vague
4 participants