mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1552815: Use setFaviconForPage() instead of replaceFaviconDataFromDataURL() r=sync-reviewers,mak
Depends on D192535 Differential Revision: https://phabricator.services.mozilla.com/D192536
This commit is contained in:
parent
448dd613e7
commit
22fab2b70a
@ -247,21 +247,10 @@ DistributionCustomizer.prototype = {
|
||||
|
||||
if (item.icon && item.iconData) {
|
||||
try {
|
||||
let faviconURI = Services.io.newURI(item.icon);
|
||||
lazy.PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
faviconURI,
|
||||
item.iconData,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
|
||||
lazy.PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
lazy.PlacesUtils.favicons.setFaviconForPage(
|
||||
Services.io.newURI(item.link),
|
||||
faviconURI,
|
||||
false,
|
||||
lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
Services.io.newURI(item.icon),
|
||||
Services.io.newURI(item.iconData)
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
@ -204,44 +204,30 @@ async function insertBookmark(bookmark) {
|
||||
}
|
||||
|
||||
function setFaviconForBookmark(bookmark) {
|
||||
let faviconURI;
|
||||
let nullPrincipal = Services.scriptSecurityManager.createNullPrincipal({});
|
||||
|
||||
switch (bookmark.Favicon.protocol) {
|
||||
case "data:":
|
||||
// data urls must first call replaceFaviconDataFromDataURL, using a
|
||||
// fake URL. Later, it's needed to call setAndFetchFaviconForPage
|
||||
// with the same URL.
|
||||
faviconURI = Services.io.newURI("fake-favicon-uri:" + bookmark.URL.href);
|
||||
|
||||
lazy.PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
faviconURI,
|
||||
bookmark.Favicon.href,
|
||||
0 /* max expiration length */,
|
||||
nullPrincipal
|
||||
);
|
||||
break;
|
||||
|
||||
case "http:":
|
||||
case "https:":
|
||||
faviconURI = Services.io.newURI(bookmark.Favicon.href);
|
||||
break;
|
||||
|
||||
default:
|
||||
lazy.log.error(
|
||||
`Bad URL given for favicon on bookmark "${bookmark.Title}"`
|
||||
case "data:": {
|
||||
lazy.PlacesUtils.favicons.setFaviconForPage(
|
||||
bookmark.URL.URI,
|
||||
Services.io.newURI("fake-favicon-uri:" + bookmark.URL.href),
|
||||
bookmark.Favicon.URI
|
||||
);
|
||||
return;
|
||||
}
|
||||
case "http:":
|
||||
case "https:": {
|
||||
lazy.PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
bookmark.URL.URI,
|
||||
bookmark.Favicon.URI,
|
||||
false /* forceReload */,
|
||||
lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
null,
|
||||
Services.scriptSecurityManager.createNullPrincipal({})
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
lazy.PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
Services.io.newURI(bookmark.URL.href),
|
||||
faviconURI,
|
||||
false /* forceReload */,
|
||||
lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
null,
|
||||
nullPrincipal
|
||||
);
|
||||
lazy.log.error(`Bad URL given for favicon on bookmark "${bookmark.Title}"`);
|
||||
}
|
||||
|
||||
// Cache of folder names to guids to be used by the getParentGuid
|
||||
|
@ -199,21 +199,24 @@ let InternalFaviconLoader = {
|
||||
win.addEventListener("unload", unloadHandler, true);
|
||||
}
|
||||
|
||||
let callback = this._makeCompletionCallback(win, innerWindowID);
|
||||
if (iconURI?.schemeIs("data")) {
|
||||
lazy.PlacesUtils.favicons.setFaviconForPage(
|
||||
pageURI,
|
||||
uri,
|
||||
iconURI,
|
||||
lazy.PlacesUtils.toPRTime(expiration),
|
||||
() => {
|
||||
callback.onComplete(uri);
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// First we do the actual setAndFetch call:
|
||||
let loadType = lazy.PrivateBrowsingUtils.isWindowPrivate(win)
|
||||
? lazy.PlacesUtils.favicons.FAVICON_LOAD_PRIVATE
|
||||
: lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE;
|
||||
let callback = this._makeCompletionCallback(win, innerWindowID);
|
||||
|
||||
if (iconURI && iconURI.schemeIs("data")) {
|
||||
expiration = lazy.PlacesUtils.toPRTime(expiration);
|
||||
lazy.PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
uri,
|
||||
iconURI.spec,
|
||||
expiration,
|
||||
principal
|
||||
);
|
||||
}
|
||||
|
||||
let request = lazy.PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI,
|
||||
|
@ -764,26 +764,7 @@ add_task(async function test_onFaviconChanged() {
|
||||
let iconURL =
|
||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAA" +
|
||||
"AAAA6fptVAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==";
|
||||
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
iconURI,
|
||||
iconURL,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
|
||||
await new Promise(resolve => {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI,
|
||||
iconURI,
|
||||
true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
() => {
|
||||
resolve();
|
||||
},
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
});
|
||||
await PlacesTestUtils.setFaviconForPage(pageURI, iconURI, iconURL);
|
||||
await verifyTrackedItems([]);
|
||||
Assert.equal(tracker.score, 0);
|
||||
} finally {
|
||||
|
@ -1082,21 +1082,11 @@ BookmarkExporter.prototype = {
|
||||
function insertFaviconForNode(node) {
|
||||
if (node.icon) {
|
||||
try {
|
||||
// Create a fake faviconURI to use (FIXME: bug 523932)
|
||||
let faviconURI = Services.io.newURI("fake-favicon-uri:" + node.url);
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
faviconURI,
|
||||
node.icon,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
PlacesUtils.favicons.setFaviconForPage(
|
||||
Services.io.newURI(node.url),
|
||||
faviconURI,
|
||||
false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
// Create a fake favicon URI to use (FIXME: bug 523932)
|
||||
Services.io.newURI("fake-favicon-uri:" + node.url),
|
||||
Services.io.newURI(node.icon)
|
||||
);
|
||||
} catch (ex) {
|
||||
console.error("Failed to import favicon data:", ex);
|
||||
|
@ -503,21 +503,11 @@ function translateTreeTypes(node) {
|
||||
function insertFaviconForNode(node) {
|
||||
if (node.icon) {
|
||||
try {
|
||||
// Create a fake faviconURI to use (FIXME: bug 523932)
|
||||
let faviconURI = Services.io.newURI("fake-favicon-uri:" + node.url);
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
faviconURI,
|
||||
node.icon,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
PlacesUtils.favicons.setFaviconForPage(
|
||||
Services.io.newURI(node.url),
|
||||
faviconURI,
|
||||
false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
// Create a fake faviconURI to use (FIXME: bug 523932)
|
||||
Services.io.newURI("fake-favicon-uri:" + node.url),
|
||||
Services.io.newURI(node.icon)
|
||||
);
|
||||
} catch (ex) {
|
||||
console.error("Failed to import favicon data:", ex);
|
||||
|
@ -156,6 +156,43 @@ export var PlacesTestUtils = Object.freeze({
|
||||
await Promise.all(faviconPromises);
|
||||
},
|
||||
|
||||
/*
|
||||
* Helper function to call PlacesUtils.favicons.setFaviconForPage() and waits
|
||||
* finishing setting. This function throws an error if the status of
|
||||
* PlacesUtils.favicons.setFaviconForPage() is not success.
|
||||
*
|
||||
* @param {string or nsIURI} pageURI
|
||||
* @param {string or nsIURI} faviconURI
|
||||
* @param {string or nsIURI} faviconDataURL
|
||||
* @param {Number} [optional] expiration
|
||||
* @return {Promise} waits for finishing setting
|
||||
*/
|
||||
setFaviconForPage(pageURI, faviconURI, faviconDataURL, expiration = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
lazy.PlacesUtils.favicons.setFaviconForPage(
|
||||
pageURI instanceof Ci.nsIURI ? pageURI : Services.io.newURI(pageURI),
|
||||
faviconURI instanceof Ci.nsIURI
|
||||
? faviconURI
|
||||
: Services.io.newURI(faviconURI),
|
||||
faviconDataURL instanceof Ci.nsIURI
|
||||
? faviconDataURL
|
||||
: Services.io.newURI(faviconDataURL),
|
||||
expiration,
|
||||
status => {
|
||||
if (Components.isSuccessCode(status)) {
|
||||
resolve(status);
|
||||
} else {
|
||||
reject(
|
||||
new Error(
|
||||
`Failed to process setFaviconForPage(): status code = ${status}`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears any favicons stored in the database.
|
||||
*/
|
||||
|
@ -104,19 +104,12 @@ function test()
|
||||
// icon with a page explicitly in order for it to be visible through
|
||||
// the protocol.
|
||||
info("Replace favicon data");
|
||||
var systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
||||
.createInstance(Ci.nsIPrincipal);
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
Services.io.newURI(tests[1].url),
|
||||
tests[1].expectedIcon,
|
||||
(Date.now() + 86400) * 1000,
|
||||
systemPrincipal);
|
||||
info("Set favicon data");
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
PlacesUtils.favicons.setFaviconForPage(
|
||||
Services.io.newURI("https://example.com/favicon_annotations"),
|
||||
Services.io.newURI(tests[1].url),
|
||||
true, PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, null,
|
||||
systemPrincipal);
|
||||
Services.io.newURI(tests[1].expectedIcon),
|
||||
(Date.now() + 86400) * 1000,
|
||||
);
|
||||
|
||||
// And start our test process.
|
||||
loadNextTest();
|
||||
|
@ -356,13 +356,7 @@ add_task(async function test_expire_icons() {
|
||||
}
|
||||
|
||||
if (entry.icon) {
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
Services.io.newURI(entry.icon),
|
||||
dataUrl,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
await PlacesTestUtils.addFavicons(new Map([[entry.page, entry.icon]]));
|
||||
await PlacesTestUtils.setFaviconForPage(entry.page, entry.icon, dataUrl);
|
||||
Assert.equal(
|
||||
await getFaviconUrlForPage(entry.page),
|
||||
entry.icon,
|
||||
@ -380,13 +374,7 @@ add_task(async function test_expire_icons() {
|
||||
}
|
||||
|
||||
if (entry.root) {
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
Services.io.newURI(entry.root),
|
||||
dataUrl,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
await PlacesTestUtils.addFavicons(new Map([[entry.page, entry.root]]));
|
||||
await PlacesTestUtils.setFaviconForPage(entry.page, entry.root, dataUrl);
|
||||
}
|
||||
|
||||
if (entry.iconExpired) {
|
||||
|
@ -68,14 +68,12 @@ add_task(async function () {
|
||||
info("Test that the content type of a favicon we add is correct.");
|
||||
let testURI = uri("http://mozilla.org/");
|
||||
// Add the data before opening
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
testIconURI,
|
||||
testFaviconData,
|
||||
0,
|
||||
systemPrincipal
|
||||
);
|
||||
await PlacesTestUtils.addVisits(testURI);
|
||||
await setFaviconForPage(testURI, testIconURI);
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
testURI,
|
||||
testIconURI,
|
||||
testFaviconData
|
||||
);
|
||||
// Open the channel
|
||||
let channel = NetUtil.newChannel({
|
||||
uri: PlacesUtils.favicons.getFaviconLinkForIcon(testIconURI).spec,
|
||||
@ -120,14 +118,12 @@ add_task(async function test_userpass() {
|
||||
CACHED_ICON_NORMAL,
|
||||
CACHED_ICON_USERPASS,
|
||||
]) {
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
iconURI,
|
||||
testFaviconData,
|
||||
0,
|
||||
systemPrincipal
|
||||
);
|
||||
await PlacesTestUtils.addVisits(pageURI);
|
||||
await setFaviconForPage(pageURI, iconURI);
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
pageURI,
|
||||
iconURI,
|
||||
testFaviconData
|
||||
);
|
||||
|
||||
// Open the channel
|
||||
let channel = NetUtil.newChannel({
|
||||
|
@ -88,13 +88,7 @@ add_task(async function test_expire_root() {
|
||||
|
||||
// Insert an expired icon.
|
||||
let iconURI = NetUtil.newURI(pageURI.spec + "favicon-normal16.png");
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
iconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
);
|
||||
await setFaviconForPage(pageURI, iconURI);
|
||||
await PlacesTestUtils.setFaviconForPage(pageURI, iconURI, SMALLPNG_DATA_URI);
|
||||
Assert.equal(
|
||||
await countEntries("moz_icons_to_pages"),
|
||||
1,
|
||||
@ -105,13 +99,11 @@ add_task(async function test_expire_root() {
|
||||
|
||||
// Now insert a new root icon.
|
||||
let rootIconURI = NetUtil.newURI(pageURI.spec + "favicon.ico");
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
pageURI,
|
||||
rootIconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
SMALLPNG_DATA_URI
|
||||
);
|
||||
await setFaviconForPage(pageURI, rootIconURI);
|
||||
|
||||
// Only the root icon should have survived.
|
||||
Assert.equal(
|
||||
|
@ -76,25 +76,12 @@ var gFavicon;
|
||||
|
||||
add_task(async function setup() {
|
||||
await PlacesTestUtils.addVisits(TEST_URI);
|
||||
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
TEST_URI,
|
||||
ICON_URI,
|
||||
ICON_DATAURL,
|
||||
(Date.now() + 8640000) * 1000,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
(Date.now() + 8640000) * 1000
|
||||
);
|
||||
|
||||
await new Promise(resolve => {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
TEST_URI,
|
||||
ICON_URI,
|
||||
false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
resolve,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
});
|
||||
|
||||
gDefaultFavicon = await fetchIconForSpec(
|
||||
PlacesUtils.favicons.defaultFavicon.spec
|
||||
);
|
||||
@ -133,13 +120,11 @@ add_task(async function subpage_url_fallback() {
|
||||
|
||||
add_task(async function svg_icon() {
|
||||
let faviconURI = NetUtil.newURI("http://places.test/favicon.svg");
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
TEST_URI,
|
||||
faviconURI,
|
||||
SMALLSVG_DATA_URI.spec,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
SMALLSVG_DATA_URI
|
||||
);
|
||||
await setFaviconForPage(TEST_URI, faviconURI);
|
||||
let svgIcon = await fetchIconForSpec(SMALLSVG_DATA_URI.spec);
|
||||
info(svgIcon.contentType);
|
||||
let pageIcon = await fetchIconForSpec("page-icon:" + TEST_URI.spec);
|
||||
@ -270,23 +255,8 @@ add_task(async function test_with_user_pass() {
|
||||
|
||||
for (const { pageURI, iconURI } of testData) {
|
||||
for (const loadingIconURISpec of [PAGE_ICON_NORMAL, PAGE_ICON_USERPASS]) {
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
iconURI,
|
||||
ICON_DATAURL,
|
||||
0,
|
||||
systemPrincipal
|
||||
);
|
||||
await PlacesTestUtils.addVisits(pageURI);
|
||||
await new Promise(resolve => {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI,
|
||||
iconURI,
|
||||
false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
resolve,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
});
|
||||
await PlacesTestUtils.setFaviconForPage(pageURI, iconURI, ICON_DATAURL);
|
||||
|
||||
let { data, contentType } = await fetchIconForSpec(loadingIconURISpec);
|
||||
Assert.equal(contentType, gFavicon.contentType);
|
||||
|
@ -9,13 +9,11 @@ add_task(async function () {
|
||||
let pageURI = NetUtil.newURI("http://www.places.test/page/");
|
||||
await PlacesTestUtils.addVisits(pageURI);
|
||||
let faviconURI = NetUtil.newURI("http://www.places.test/favicon.ico");
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
pageURI,
|
||||
faviconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
SMALLPNG_DATA_URI
|
||||
);
|
||||
await setFaviconForPage(pageURI, faviconURI);
|
||||
|
||||
// Sanity checks.
|
||||
Assert.equal(await getFaviconUrlForPage(pageURI), faviconURI.spec);
|
||||
@ -70,22 +68,18 @@ add_task(async function test_removePagesByTimeframe() {
|
||||
|
||||
// Add a normal icon to the most recent page.
|
||||
let faviconURI = NetUtil.newURI(`${BASE_URL}/page/favicon.ico`);
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
pageURI,
|
||||
faviconURI,
|
||||
SMALLSVG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
SMALLSVG_DATA_URI
|
||||
);
|
||||
await setFaviconForPage(pageURI, faviconURI);
|
||||
// Add a root icon to the most recent page.
|
||||
let rootIconURI = NetUtil.newURI(`${BASE_URL}/favicon.ico`);
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
pageURI,
|
||||
rootIconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
SMALLPNG_DATA_URI
|
||||
);
|
||||
await setFaviconForPage(pageURI, rootIconURI);
|
||||
|
||||
// Sanity checks.
|
||||
Assert.equal(
|
||||
@ -141,13 +135,11 @@ add_task(async function test_different_host() {
|
||||
let pageURI = NetUtil.newURI("http://places.test/page/");
|
||||
await PlacesTestUtils.addVisits(pageURI);
|
||||
let faviconURI = NetUtil.newURI("http://mozilla.test/favicon.ico");
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
await PlacesTestUtils.setFaviconForPage(
|
||||
pageURI,
|
||||
faviconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
SMALLPNG_DATA_URI
|
||||
);
|
||||
await setFaviconForPage(pageURI, faviconURI);
|
||||
|
||||
Assert.equal(
|
||||
await getFaviconUrlForPage(pageURI),
|
||||
@ -207,13 +199,7 @@ add_task(async function test_root_on_different_host() {
|
||||
// Root favicon for TEST_URL1.
|
||||
const ICON_URL = "http://places1.test/favicon.ico";
|
||||
let iconURI = NetUtil.newURI(ICON_URL);
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
iconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
);
|
||||
await setFaviconForPage(pageURI1, iconURI);
|
||||
await PlacesTestUtils.setFaviconForPage(pageURI1, iconURI, SMALLPNG_DATA_URI);
|
||||
Assert.equal(await getRootValue(ICON_URL), 1, "Check root == 1");
|
||||
Assert.equal(
|
||||
await getFaviconUrlForPage(pageURI1, 16),
|
||||
@ -222,13 +208,7 @@ add_task(async function test_root_on_different_host() {
|
||||
);
|
||||
|
||||
// Same favicon for TEST_URL2.
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
iconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
systemPrincipal
|
||||
);
|
||||
await setFaviconForPage(pageURI2, iconURI);
|
||||
await PlacesTestUtils.setFaviconForPage(pageURI2, iconURI, SMALLPNG_DATA_URI);
|
||||
Assert.equal(await getRootValue(ICON_URL), 1, "Check root == 1");
|
||||
Assert.equal(
|
||||
await getFaviconUrlForPage(pageURI2, 16),
|
||||
|
@ -292,20 +292,7 @@ add_task(async function test_orphans() {
|
||||
);
|
||||
// Also create a root icon.
|
||||
let faviconURI = Services.io.newURI(uri.spec + "favicon.ico");
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||
faviconURI,
|
||||
SMALLPNG_DATA_URI.spec,
|
||||
0,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
uri,
|
||||
faviconURI,
|
||||
true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal()
|
||||
);
|
||||
await PlacesTestUtils.setFaviconForPage(uri, faviconURI, SMALLPNG_DATA_URI);
|
||||
|
||||
await PlacesUtils.history.update({
|
||||
url: uri,
|
||||
|
Loading…
Reference in New Issue
Block a user