Revert "Revert "Implement Favicon API""

This reverts commit 13decac4b94c5cdce245310545b35810a568765a.
Fix NPE while encoding when favicon was missing