Skip to content

feat: Favicon Fallback Handling & Offline Icon Support#99

Open
Rudresh-11 wants to merge 3 commits intoprem-k-r:mainfrom
Rudresh-11:feat/improved-favicon
Open

feat: Favicon Fallback Handling & Offline Icon Support#99
Rudresh-11 wants to merge 3 commits intoprem-k-r:mainfrom
Rudresh-11:feat/improved-favicon

Conversation

@Rudresh-11
Copy link

@Rudresh-11 Rudresh-11 commented Dec 4, 2025

📌 Description

This PR introduces improved favicon handling for shortcuts.
The previous Google favicon endpoint returned blank or generic fallback icons, which prevented the offline indicator from displaying correctly.
This update implements a new detection mechanism and a more reliable fallback workflow.

Key changes:

  • Added logic to detect generic fallback globe icons returned by Google.
  • Added automatic replacement with a custom offline icon when a favicon cannot be resolved.
  • Improved shortcut icon rendering consistency across all websites.
  • Updated internal logic inside getLogoHtml() without modifying external CSS or project structure.

🎨 Visual Changes (Screenshots / Videos)

image

🔗 Related Issues


✅ Checklist

  • I have read and followed the Contributing Guidelines.
  • My code follows the project's coding style and conventions.
  • I have tested my changes thoroughly to ensure expected behavior.
  • I have verified compatibility across Chrome and Firefox.
  • I have attached relevant visual evidence.
  • I have updated the CHANGELOG.md under the appropriate categories with all my changes in this PR.

Summary by CodeRabbit

  • Bug Fixes

    • Improved favicon loading reliability with a more robust endpoint for faster, more consistent icon display
    • Enhanced offline icon behavior for shortcuts with automatic fallback to local icons when external sources fail
  • Documentation

    • Changelog updated to reflect these improvements

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 4, 2025

Walkthrough

Replaces the legacy Google favicon endpoint with unavatar.io for hostname favicon resolution and adds explicit onerror handling that falls back to an offline SVG. Updates CHANGELOG to document the change.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added an "Improved" subsection noting the switch from Google's favicon endpoint to unavatar.io and improved offline icon display logic.
Favicon resolution logic
scripts/shortcuts.js
Replaced Google favicon fetch with a computed faviconUrl using unavatar.io; returns an <img> using that URL; added onerror handler to clear itself and substitute an offline SVG fallback; preserved alt and class attributes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review scripts/shortcuts.js onerror handler to ensure it clears to avoid loops and fallback SVG renders correctly.
  • Verify faviconUrl generation handles edge cases (subdomains, missing/invalid hostnames).
  • Confirm CHANGELOG entry wording and placement.

Poem

🐰 I hopped to fetch a tiny crest,
Unavatar kindly did the rest,
When network hiccups cloud the sight,
An offline SVG holds the light,
Icons gleam — the new tab's dressed.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: improved favicon fallback handling and offline icon support, accurately reflecting the core purpose of the PR.
Description check ✅ Passed The description comprehensively covers all template sections including clear purpose, visual evidence, linked issue (#81), and completed checklist items verifying testing and guidelines compliance.
Linked Issues check ✅ Passed The PR directly addresses issue #81 by replacing Google's unreliable favicon endpoint with unavatar.io service, implementing fallback logic for generic globe icons, and ensuring reliable custom favicon display.
Out of Scope Changes check ✅ Passed All changes in CHANGELOG.md and scripts/shortcuts.js are directly scoped to issue #81 requirements: favicon resolution improvements and offline icon display logic without unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a3ee0a and 3d87fba.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • scripts/shortcuts.js (1 hunks)
🔇 Additional comments (1)
scripts/shortcuts.js (1)

258-266: Verify CSP permissions for inline onerror handler before deployment

The unavatar-based favicon URL plus onerror swap to ./svgs/offline.svg is solid for fallback logic and avoids infinite loops via this.onerror = null.

However, MV3 extension manifests typically restrict inline event handlers (onerror="...") via Content Security Policy. If this project enforces strict CSP, the fallback will silently fail and users will still see a broken icon. Confirm that your manifest.json explicitly allows unsafe-inline in the script or default directive, or refactor getLogoHtml to attach the error listener programmatically instead.

@Rudresh-11 Rudresh-11 changed the title Feat/improved favicon: Favicon Fallback Handling & Offline Icon Support feat: Favicon Fallback Handling & Offline Icon Support Dec 4, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d87fba and a4308e1.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)

@itz-rj-here itz-rj-here added enhancement New feature or request under-review Currently being reviewed. Please wait for feedback. labels Dec 9, 2025
@itz-rj-here itz-rj-here requested a review from prem-k-r December 9, 2025 05:45
@prem-k-r prem-k-r mentioned this pull request Jan 25, 2026
6 tasks
@prem-k-r prem-k-r added on-hold Blocked by another PR or pending feature. Will resume once dependency is resolved. and removed under-review Currently being reviewed. Please wait for feedback. labels Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request on-hold Blocked by another PR or pending feature. Will resume once dependency is resolved.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants