mirror of https://github.com/zulip/zulip.git
favicon: Catch exceptions in update_favicon.
We’re getting unexplained exceptions from URL.createObjectURL in Firefox 88 (#18374); contain them to this function. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
66a232e303
commit
879ca4543b
|
@ -2,6 +2,8 @@ import $ from "jquery";
|
||||||
|
|
||||||
import render_favicon_svg from "../templates/favicon.svg.hbs";
|
import render_favicon_svg from "../templates/favicon.svg.hbs";
|
||||||
|
|
||||||
|
import * as blueslip from "./blueslip";
|
||||||
|
|
||||||
import favicon_font_url from "!url-loader!font-subset-loader2?glyphs=0123456789KMGT∞!source-sans/TTF/SourceSans3-Bold.ttf";
|
import favicon_font_url from "!url-loader!font-subset-loader2?glyphs=0123456789KMGT∞!source-sans/TTF/SourceSans3-Bold.ttf";
|
||||||
|
|
||||||
let favicon_state;
|
let favicon_state;
|
||||||
|
@ -11,6 +13,7 @@ function set_favicon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function update_favicon(new_message_count, pm_count) {
|
export function update_favicon(new_message_count, pm_count) {
|
||||||
|
try {
|
||||||
if (favicon_state !== undefined) {
|
if (favicon_state !== undefined) {
|
||||||
favicon_state.image.removeEventListener("load", set_favicon);
|
favicon_state.image.removeEventListener("load", set_favicon);
|
||||||
|
|
||||||
|
@ -54,4 +57,7 @@ export function update_favicon(new_message_count, pm_count) {
|
||||||
// render the webfont (https://crbug.com/1140920).
|
// render the webfont (https://crbug.com/1140920).
|
||||||
favicon_state.image.src = favicon_state.url;
|
favicon_state.image.src = favicon_state.url;
|
||||||
favicon_state.image.addEventListener("load", set_favicon);
|
favicon_state.image.addEventListener("load", set_favicon);
|
||||||
|
} catch (error) {
|
||||||
|
blueslip.error("Failed to update favicon", undefined, error.stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue