summaryrefslogtreecommitdiffstats
path: root/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs')
-rw-r--r--browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs48
1 files changed, 17 insertions, 31 deletions
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