Open
Bug 737861
Opened 13 years ago
Updated 2 years ago
New Safari Migrator: Thumbnails for Top Sites
Categories
(Firefox :: Migration, defect)
Tracking
()
NEW
People
(Reporter: asaf, Unassigned)
References
Details
In the new Safari migrator Top Sites are imported without their thumbnails.
This should be easy to fix. Safari saves the thumbnails, as files, in
~/Library/Caches/com.apple.Safari/WebPage Previews (I've not looked for the path on Windows yet). For each top site, there are two thumbnails (png & jpg). The file names are the urls in a MD5-hash form.
Reporter | ||
Comment 1•13 years ago
|
||
Required MD5-hash-generation code (from test_authentication.js):
function bytesFromString(str) {
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
var data = converter.convertToByteArray(str);
return data;
}
function toHexString(charCode) {
return ("0" + charCode.toString(16)).slice( - 2);
}
function H(str) {
var data = bytesFromString(str);
var ch = Components.classes["@mozilla.org/security/hash;1"].createInstance(Components.interfaces.nsICryptoHash);
ch.init(Components.interfaces.nsICryptoHash.MD5);
ch.update(data, data.length);
var hash = ch.finish(false);
return [toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
}
Reporter | ||
Comment 2•13 years ago
|
||
Remaining issues:
1. Minor: Safari stores both png and jpeg variants of the thumbnail, which one should we use?
2. The thumbnails stored by safari are bigger, and have different proportions. Should they be rescaled (and cut) before storing them?
Another approach would be to retrieve thumbnails on our own.
Reporter | ||
Updated•13 years ago
|
Summary: New Safari Migrator: Import thumbnails for Top Sites → New Safari Migrator: Thumbnails for Top Sites
Reporter | ||
Comment 3•13 years ago
|
||
Correction: the thumbnails are not scaled at all, because they also have a use for the full-sized screenshot.
Comment 4•13 years ago
|
||
You could just import the PNG thumbnail and store it in the cache [PageThumbs.jsm / PageThumbsCache.getWriteEntry()]. I think it shouldn't look too bad in the newtab page and the thumbnails get updated anyway when visiting those pages.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•