Closed Bug 1894633 Opened 9 months ago Closed 4 months ago

Stop fetching icons from the network in Places

Categories

(Toolkit :: Places, task, P3)

task
Points:
8

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: mak, Assigned: daisuke)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [sng][favicons-2024])

Attachments

(3 files, 2 obsolete files)

Places should only be a store of icons, but never fetch them from the network.
There's privacy and security implications in doing that, we prefer to delegate the burden to some dedicated module.
This is already the case for icons stored from the browser tabs, though many components still rely on Places to do the fetching.
Any use of SetAndFetchFaviconForPage should be converted.
PlacesUIUtils.loadFavicon should be removed, or moved, or changed to only accept data uris (then maybe it won't be particularly useful to keep it).

We have browser/modules/FaviconLoader.sys.mjs, we could probably move more stuff into it and make it our centralized favicon load module.

This may need a breakdown, as we should likely start converting consumers one by one, and there is module refactoring to make.
The final scope is to remove SetAndFetchFaviconForPage.

Whiteboard: [sng]
Assignee: nobody → daisuke
Status: NEW → ASSIGNED

Daisuke, this will likely need a breakdown, per comment 1. Probably multiple dependent bugs.

Hi Marco, thanks!

Here is the approach I'm thinking of so far.
The nsIFaviconService.setAndFetchFaviconForPage() is doing three major things like below.

  1. If there is favicon data for the page in database, get the data. (If aForceReload is false)
  2. If no favicon data from above, get the data from network.
  3. Save/notify the data.

So, I think we need the following 2 functions to correspond to the above.

  1. getFaviconFromDB() in PlacesUtils.sys.mjs.
  2. getFaviconAsDataURL() in FaviconLoader.sys.mjs.

Then, change the codes where use nsIFaviconService.setAndFetchFaviconForPage() to like below.

  1. Get favicon data from PlacesUtils.getFaviconFromDB() (if not forced to reload).
  2. If no favicon data of the above, get it from FaviconLoader.getFaviconAsDataURL().
  3. Call nsIFaviconService.setFaviconForPage().

Next, regarding to PlacesUIUtils.loadFavicon(), it seems that this function is called from only one place. So, I think we can move the function to the place that calls it.

So, I think, as it seems that it will not be so huge, the following patches in this bug might be enough, not breaking down.

  1. Replace nsIFaviconService.setAndFetchFaviconForPage() with new.
  2. Move PlacesUIUtils.loadFavicon() to LinkHandlerParent.sys.mjs (and optimize)
  3. Remove nsIFaviconService.setAndFetchFaviconForPage().

I will do the above first, then, if it looks better to fix each in another bug, I will file them.

Depends on D211693

See Also: → 1899218
Whiteboard: [sng] → [sng][favicons-2024]
Points: --- → 8
Blocks: 1910324
Blocks: 1910338
Attachment #9404052 - Attachment is obsolete: true
No longer blocks: 1910338
Depends on: 1910338
No longer blocks: 1910324
Depends on: 1910324
Depends on: 1913282
Depends on: 1913287
Attachment #9404051 - Attachment description: Bug 1894633: Use nsIFaviconService::setFaviconForPage() instead of setAndFetchFaviconForPage() for testing → Bug 1894633: Use nsIFaviconService::setFaviconForPage() for tests
Attachment #9404050 - Attachment is obsolete: true
Blocks: 1915762
Blocks: 1915774
Pushed by dakatsuka.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d4cca836dfbd Use nsIFaviconService::setFaviconForPage() for tests r=places-reviewers,home-newtab-reviewers,thecount,mak https://hg.mozilla.org/integration/autoland/rev/a0717adf4b6a Remove nsIFaviconService::setAndFetchFaviconForPage() api r=mak https://hg.mozilla.org/integration/autoland/rev/b3bf3c4a2462 Remove unused telemetry about favicon size r=mak

Backed out 3 changesets (Bug 1894633) as requested by daisuke CLOSED TREE
Backout link: https://hg.mozilla.org/integration/autoland/rev/8b55eb3aa72957c8bfc7526937329818c1ac426a

Flags: needinfo?(daisuke)
Backout by sstanca@mozilla.com: https://hg.mozilla.org/mozilla-central/rev/628af64728a1 Backed out 3 changesets as requested by daisuke CLOSED TREE
Flags: needinfo?(daisuke)
Pushed by dakatsuka.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/83b1731abb9d Use nsIFaviconService::setFaviconForPage() for tests r=places-reviewers,home-newtab-reviewers,thecount,mak https://hg.mozilla.org/integration/autoland/rev/8b824e3cd55d Remove nsIFaviconService::setAndFetchFaviconForPage() api r=mak https://hg.mozilla.org/integration/autoland/rev/33cddf1e5c70 Remove unused telemetry about favicon size r=mak
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
See Also: → 1922849
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: