get-installed-related-apps
get-installed-related-apps copied to clipboard
How to compare URL to ID?
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?
The URL spec defines comparing two URLs here, which would apply to point 4.6. Step 4.1 uses string comparison.
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).
@rayankans can you ensure that installedApp’s id is also a URL so that this is well defined?