API: Make search engine favicon configurable #1657
Merged
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.
I really like the new Omnibar search engine icon feature!
One issue I had is that I have numerous search engines configured where the
search_url
does not match the site it's searching.For example, I use a Google Custom Search engine to search the Arch Linux forums, where the
search_url
ishttps://cse.google.com/cse/publicurl?cx=xxxxx&q=
. With the old behavior, the Omnibar showed a Google favicon, but I want it to show an Arch Linux favicon.New Behavior
With this change, users calling
addSearchAlias
can directly specify the desired favicon via thefavicon_url
property of the newoptions
argument. For example:This is also useful when a site's favicon isn't accessible at the standard
/favicon.ico
path. For example, Dribbble's/favicon.ico
returns a 404 error; the actual favicon URL ishttps://cdn.dribbble.com/assets/favicon-b38525134603b9513174ec887944bde1a869eb6cd414f4d640ee48ab2a15a26b.ico
.Finally, this makes it possible to use an image encoded in a data URI as a favicon, which is useful if you want to use a custom favicon that's not hosted on the web.
Implementation Notes
I added a new
options
argument toapi.addSearchAlias()
which accepts an object containing thefavicon_url
key. I took this approach rather than adding a single argument specifically for the newfavicon_url
option because the function signature was already getting very long. Accepting anoptions
object will make it easier to add additional options in the future without making the signature even longer.