feature: allow embed <replay-web-page> to also support updating favicons from replay (#287)

It may be useful to be able to have <replay-web-page> embed also take
over the favicons for the page, propagating them from the replay (eg. if
in a single page app where replay takes up most of the view).

This PR adds a `updateFavicons` attribute, used as `<replay-web-page ...
updateFavicons>` to have icons propagated from the replay to the
top-level frame. (This may be especially useful with `deepLink` option,
which allows for linking directly to archived pages)

Details:
  - enabled via 'updateFavicons' attribute on <replay-web-page>
- pass icons via postMessage() update, adding type to embed message to
allow different types of message
  - currently supporting 'urlchange' and 'favicons' message types
- add shared updateFaviconLinks() in misc.ts, used by both embed and
main app

---------
Co-authored-by: emma <hi@emma.cafe>
This commit is contained in:
Ilya Kreymer
2024-03-07 21:28:50 -08:00
committed by GitHub
co-authored by emma
parent 5c7b914e69
commit 6051a2a414
5 changed files with 123 additions and 54 deletions
+7
View File
@@ -50,3 +50,10 @@ export type ItemType = {
totalSize?: unknown;
size?: number | string;
};
export type FavIconEventDetail = {
icons: {
rel: string;
href: string;
}[];
};