forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageSelectorIcon.tsx
More file actions
31 lines (27 loc) · 1.04 KB
/
Copy pathPageSelectorIcon.tsx
File metadata and controls
31 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { Icon } from './Icon';
import ExtensionFavicon from '../../../res/img/svg/extension-outline.svg';
import DefaultLinkFavicon from '../../../res/img/svg/globe.svg';
type Props = {
readonly favicon: string | null;
readonly origin: string;
};
/**
* PageSelectorIcon wraps the Icon component and provides fallback icons
* for pages that don't have a favicon in the profile data.
*
* Fallback logic:
* - If favicon exists (Firefox 134+ provides base64 data URI), use it
* - If origin is moz-extension://, fallback to extension-outline.svg
* - Otherwise (regular pages, about: pages), fallback to globe.svg
*/
export function PageSelectorIcon({ favicon, origin }: Props) {
const iconUrl =
favicon ??
(origin.startsWith('moz-extension://')
? ExtensionFavicon
: DefaultLinkFavicon);
return <Icon iconUrl={iconUrl} />;
}