get-installed-related-apps icon indicating copy to clipboard operation
get-installed-related-apps copied to clipboard

How to compare URL to ID?

Open foolip opened this issue 5 years ago • 3 comments

There are two places in match an installed app that compare URLs to other URLs or strings:

4.1. If relatedApp’s id is not equal to installedApp’s id, and relatedApp’s url is not equal to installedApp’s id, continue.

4.6. If installedApp’s relatedURLs does not contain manifestURL, return null.

relatedURLs is a list of URLs and manifestURL is a URL per steps for obtaining a manifest, but installedApp’s id isn't a URL. How should equality be determined?

@annevk I can't find a concept in https://url.spec.whatwg.org/ for comparing two URLs for equality, what's the best way to do this? How about URL vs. string, are there established patterns to follow?

foolip avatar Dec 18 '19 12:12 foolip

The URL spec defines comparing two URLs here, which would apply to point 4.6. Step 4.1 uses string comparison.

rayankans avatar Jan 03 '20 13:01 rayankans

Typically you'd parse the string into a URL and then compare per the algorithm pointed out by Rayan, but it depends (e.g., namespaces are always treated as strings).

annevk avatar Jan 03 '20 13:01 annevk

@rayankans can you ensure that installedApp’s id is also a URL so that this is well defined?

foolip avatar Jan 16 '20 11:01 foolip