Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: toolkit/components/places/tests/favicons/xpcshell.toml
/* Any copyright is dedicated to the Public Domain.
/**
* This file tests that favicons migrated from a previous profile, having a 0
* expiration, will be properly expired when fetching new ones.
*/
add_setup(() => {
registerCleanupFunction(async () => {
PlacesUtils.favicons.expireAllFavicons();
await PlacesUtils.history.clear();
});
});
add_task(async function test_storing_a_normal_16x16_icon() {
await PlacesTestUtils.addVisits(PAGE_URL);
await PlacesUtils.favicons.setFaviconForPage(
PAGE_URL,
SMALLPNG_DATA_URI,
SMALLPNG_DATA_URI
);
// Now set expiration to 0 and change the payload.
info("Set expiration to 0 and replace favicon data");
await PlacesUtils.withConnectionWrapper("Change favicons payload", db => {
return db.execute(`UPDATE moz_icons SET expire_ms = 0, data = "test"`);
});
let { data, mimeType } = await getFaviconDataForPage(PAGE_URL);
Assert.equal(mimeType, "image/png");
Assert.deepEqual(
data,
"test".split("").map(c => c.charCodeAt(0))
);
info("Refresh favicon");
await PlacesUtils.favicons.setFaviconForPage(
PAGE_URL,
SMALLPNG_DATA_URI,
SMALLPNG_DATA_URI
);
await compareFavicons("page-icon:" + PAGE_URL.spec, SMALLPNG_DATA_URI);
});