Expose base64-encoded favicons to the tabsrunner
ClosedPublic

Authored by fvogt on Jul 15 2017, 3:48 PM.

Details

Summary

The browser has them in the cache already, so we avoid loading it ourselves,
also we might not even have access to the icons from our context.
Some browsers (Opera does) set the favIconUrl of the tab to the base64 data
already, which is convenient. The base64 URL gets decoded in the krunner
plugin and if it fails or is not available, the browser icon is shown.
If the tab is audible or incognito, that icon is preferred.

Test Plan

Installed in Opera 40, Vivaldi 1.91 and Firefox 52, favicons appear in krunner.

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
fvogt created this revision.Jul 15 2017, 3:48 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 15 2017, 3:48 PM
fvogt added a comment.Jul 15 2017, 4:10 PM

It could also decode the base64 data in the plasma-browser-integration-host already and send it as bytearray, I'm not sure what's simpler/better/faster.

fvogt updated this revision to Diff 16759.Jul 15 2017, 9:45 PM

Also send a request for the favicon without timeout to fill the cache for next time.
Otherwise favicons from slow servers might never show up

broulik edited edge metadata.Jul 27 2017, 1:05 PM

Cool!

extension/extension.js
495

Braces even for single line statements:

if (...) {
    ...
}
505

Does this need a tabs.hasOwnProperty(...) check? (cf for in being horrible in JS)

tabsrunner/tabsrunner.cpp
188

const

191

+1 for usage of ref :)

224–228

Braces

fvogt updated this revision to Diff 17287.Jul 27 2017, 1:22 PM

braces + const

A hasOwnProperty check is not needed here, that's accounted for by the if (!favIconUrl) below

fvogt marked 4 inline comments as done.Jul 27 2017, 1:25 PM
broulik accepted this revision.Jul 27 2017, 1:35 PM
This revision is now accepted and ready to land.Jul 27 2017, 1:35 PM
This revision was automatically updated to reflect the committed changes.