w3c / web-share-target

Web API proposal for receiving shared data
https://w3c.github.io/web-share-target/
Other
191 stars 20 forks source link

Should fail checks at manifest parse time, not launch time #25

Closed mgiuca closed 6 years ago

mgiuca commented 6 years ago

There are a number of cases where the launching algorithm can fail, due to an invalid url_template, with no satisfactory way to give feedback to the user or developer. Instead of failing these checks silently at launch time, we should specify checks at manifest parse time, and if the template is invalid, specify that it be ignored (i.e., not registered) and that a developer warning be issued.

mgiuca commented 6 years ago

An interesting edge case is the manifest scope check:

If final URL is not within scope of manifest's scope URL, abort these steps.

This check is done after placeholder substitution, which means you could theoretically have a scope of "/foo/bar" and a url_template of "/foo/{text}", and then if the shared text starts with "bar" it will succeed, but otherwise will fail. That is kind of bad. By moving the checks to manifest parse time, we will have to apply the check to the URL template, not the final URL, but that is good because it rules out cases such as the above.