Write the pending icons to the database before trying to read any requested icons to ensure that a requested icon has the correct data.
Created attachment 26204 [details] reverse order of reading, writing icons to database
Comment on attachment 26204 [details] reverse order of reading, writing icons to database Looks good. r=me
Although this is a good fix, it doesn't appear to resolve the workaround for Bug 21026 in the layout test for Bug 22795.
http://trac.webkit.org/changeset/39569