Bug 977177 - Update favicons API consumers. r=adw

Updates consumers to the new behavior.
Some consumers are changed to use  the "page-icon:" protocol, since it's not
trivial to join the icons table and get a single result out of it. In most cases
the join would return multiple results since a page can have multiple icon payloads.
These consumers for now will return the biggest payload, bug 1347532 will fix
some of them to properly pass a #size=NN fragment.
Note that, even before, these were just "moz-anno:favicon:" uris, and the
payload had to be fetched from the database.
Some other consumers for now just fallback to the largest payload, by passing 0
to GetFaviconURLForPage.

The favicon optimization still happens on the main-thread, bug 1346139 will
handle that problem.

Most of the changes involve handling the modified IconData objects, that now
retain an array of payloads, rather than just one. But note that .ico files are
not yet split into single frames, due to imagelib missing APIs that will be handled
in bug 1337402.
The other changes involve fixing queries to properly join with the new tables.

Finally, note that thanks to the FOREIGN KEYS support, removing from moz_icons or
moz_pages_w_icons will also remove relations from moz_icons_to_pages.

The system only supports square icons, so icons are resized based on their larger side.

This doesn't include new tests, those will be in a following changeset.

MozReview-Commit-ID: JUkpquhpS8y
This commit is contained in:
Marco Bonardo
2016-09-28 16:14:30 +02:00
parent fbfba8faf2
commit c536e58644
50 changed files with 919 additions and 869 deletions

View File

@@ -9603,7 +9603,7 @@ public:
NS_IMETHOD
OnComplete(nsIURI* aFaviconURI, uint32_t aDataLen,
const uint8_t* aData, const nsACString& aMimeType) override
const uint8_t* aData, const nsACString& aMimeType, uint16_t aWidth) override
{
// Continue only if there is an associated favicon.
if (!aFaviconURI) {
@@ -9662,7 +9662,7 @@ nsDocShell::CopyFavicon(nsIURI* aOldURI,
new nsCopyFaviconCallback(favSvc, aNewURI,
aLoadingPrincipal,
aInPrivateBrowsing);
favSvc->GetFaviconURLForPage(aOldURI, callback);
favSvc->GetFaviconURLForPage(aOldURI, callback, 0);
}
#endif
}