Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change updates the
getSiteIcon
logic in two ways:Use
img
elements for testing resource existence rather thanfetch
The previous implementation of
resourceExists
was using thesame-origin
mode for fetch, but that would break when a site used another domain for their icons,static.example.com
orimages.example.com
, for example. There isn't a fetch mode that works here. There's no guarantee that the 2nd origin in question is correctly configured for CORS—so that'scors
andsame-origin
out.navigate
doesn't apply andno-cors
hides thestatus
andstatusText
so we can't confirm that.[1]Handle multiple link elements with
rel=icon
It is very possible and even recommended that there are multiple icons, and if we're going to check that they actually exist, we should fallback to the other images listed.
e.g.:
There is a subtle functionality change here in that the element matching
head > link[rel="shortcut icon"]
will be checked first, but that isn't important, nor should it be.