From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- .../helpers/BookmarksPolicies.sys.mjs | 48 ++++++++-------------- 1 file changed, 17 insertions(+), 31 deletions(-) (limited to 'browser/components/enterprisepolicies/helpers') diff --git a/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs b/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs index 5fc70c31cf..2e52a248c8 100644 --- a/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs +++ b/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs @@ -204,44 +204,30 @@ async function insertBookmark(bookmark) { } function setFaviconForBookmark(bookmark) { - let faviconURI; - let nullPrincipal = Services.scriptSecurityManager.createNullPrincipal({}); - switch (bookmark.Favicon.protocol) { - case "data:": - // data urls must first call replaceFaviconDataFromDataURL, using a - // fake URL. Later, it's needed to call setAndFetchFaviconForPage - // with the same URL. - faviconURI = Services.io.newURI("fake-favicon-uri:" + bookmark.URL.href); - - lazy.PlacesUtils.favicons.replaceFaviconDataFromDataURL( - faviconURI, - bookmark.Favicon.href, - 0 /* max expiration length */, - nullPrincipal + case "data:": { + lazy.PlacesUtils.favicons.setFaviconForPage( + bookmark.URL.URI, + Services.io.newURI("fake-favicon-uri:" + bookmark.URL.href), + bookmark.Favicon.URI ); - break; - + return; + } case "http:": - case "https:": - faviconURI = Services.io.newURI(bookmark.Favicon.href); - break; - - default: - lazy.log.error( - `Bad URL given for favicon on bookmark "${bookmark.Title}"` + case "https:": { + lazy.PlacesUtils.favicons.setAndFetchFaviconForPage( + bookmark.URL.URI, + bookmark.Favicon.URI, + false /* forceReload */, + lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, + null, + Services.scriptSecurityManager.createNullPrincipal({}) ); return; + } } - lazy.PlacesUtils.favicons.setAndFetchFaviconForPage( - Services.io.newURI(bookmark.URL.href), - faviconURI, - false /* forceReload */, - lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, - null, - nullPrincipal - ); + lazy.log.error(`Bad URL given for favicon on bookmark "${bookmark.Title}"`); } // Cache of folder names to guids to be used by the getParentGuid -- cgit v1.2.3