Skip to content

Fix favicon PR #1118: guarded computed + browser.ts constants#1554

Open
indigokarasu wants to merge 1 commit into
Authenticator-Extension:devfrom
indigokarasu:fix/favicon-pr1118
Open

Fix favicon PR #1118: guarded computed + browser.ts constants#1554
indigokarasu wants to merge 1 commit into
Authenticator-Extension:devfrom
indigokarasu:fix/favicon-pr1118

Conversation

@indigokarasu

Copy link
Copy Markdown

This is a corrected version of the favicon feature from #1118 (based on the favicon branch). It addresses the open review feedback and keeps the maintainer's stated constraints intact.

What was broken

EntryComponent.vueshouldShowFavicon
The original expression was:

!isFirefox && !isSafari && mapState("menu", ["showFavicon"]).showFavicon

Because of && short-circuit evaluation, the boolean guard was discarded and the value resolved to the raw mapState getter function (always truthy). The Firefox/Safari guard was effectively lost and the property was not a proper reactive computed. Replaced with a real computed that returns !isFirefox && !isSafari && this.$store.state.menu.showFavicon, using the constants already exported from browser.ts.

PreferencesPage.vue — favicon toggle
The toggle used a raw navigator.userAgent.indexOf("Firefox") check stored as isNotFirefox in data(), which shadowed/collided with the existing isSupported computed. Switched the toggle to the browser.ts-based isSupported (Firefox and Safari) and removed the conflicting data field.

Maintainer constraints preserved

  • favicon and chrome://favicon/ remain in optional_permissions (requested only when the user enables the setting), not mandatory permissions.
  • Favicons are fetched lazily per entry at render time (chrome://favicon/<TLD>); nothing is bundled in the package or pre-downloaded for sites the user does not have.
  • medal.svg is a UI placeholder glyph shown when no ::domain is set, not a pre-installed site favicon.

Reviewer suggestions already applied in the branch (label "Show Website Icon", MV3 TODO comment) are kept as-is.

Fixes the code-review items from #1118.

…lict)

The original favicon PR (Authenticator-Extension#1118) targeted an MV2 base and had been open ~2
years; dev is now MV3 and the branch no longer merges. This re-implements
the feature against current dev conventions and fixes the original bugs:

- Built for MV3: uses the favicon permission + the chrome.runtime.getURL
  ('/_favicon/') endpoint instead of the dead MV2 chrome://favicon/ URL.
  Only the 'favicon' optional permission is requested (on toggle); the
  invalid MV2 'chrome://favicon/' host permission and CSP scheme are dropped.
  The extension's own _favicon resource is already covered by img-src 'self',
  so no CSP relaxation is needed.
- EntryComponent.shouldShowFavicon is a proper reactive computed returning
  !isFirefox && !isSafari && menu.showFavicon (uses browser.ts constants),
  fixing the original && short-circuit bug that discarded the guard.
- Wires showFavicon into the new UserSettings model (interface, BooleanOption,
  isBooleanOption) and the menu store, so the setting persists and syncs.
- Favicons are fetched lazily per entry at render time; nothing bundled or
  pre-downloaded. medal.svg is a UI placeholder glyph, not a site favicon.

Maintainer constraints honored: no mandatory permissions added, no pre-installed
or pre-downloaded favicons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant