mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 741059 - Part 4: Update the callers to mozIAsyncFavicon::SetAndFetchFaviconForPage; r=jdm,bz,mak
This commit is contained in:
parent
46a21430de
commit
43f06e8050
@ -685,7 +685,10 @@
|
||||
if (!(aURI instanceof Ci.nsIURI))
|
||||
aURI = makeURI(aURI);
|
||||
this.mFaviconService.setAndFetchFaviconForPage(browser.currentURI,
|
||||
aURI, false);
|
||||
aURI, false,
|
||||
gPrivateBrowsingUI.privateWindow ?
|
||||
this.mFaviconService.FAVICON_LOAD_PRIVATE :
|
||||
this.mFaviconService.FAVICON_LOAD_NON_PRIVATE);
|
||||
}
|
||||
|
||||
if ((browser.mIconURL || "") != aTab.getAttribute("image")) {
|
||||
|
@ -1328,7 +1328,14 @@ FeedWriter.prototype = {
|
||||
}
|
||||
var faviconURI = makeURI(readerURI.prePath + "/favicon.ico");
|
||||
var self = this;
|
||||
var usePrivateBrowsing = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.QueryInterface(Ci.nsILoadContext)
|
||||
.usePrivateBrowsing;
|
||||
this._faviconService.setAndFetchFaviconForPage(readerURI, faviconURI, false,
|
||||
usePrivateBrowsing ? this._faviconService.FAVICON_LOAD_PRIVATE
|
||||
: this._faviconService.FAVICON_LOAD_NON_PRIVATE,
|
||||
function (aURI, aDataLen, aData, aMimeType) {
|
||||
if (aDataLen > 0) {
|
||||
var dataURL = "data:" + aMimeType + ";base64," +
|
||||
|
@ -8152,8 +8152,9 @@ class nsCopyFaviconCallback MOZ_FINAL : public nsIFaviconDataCallback
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsCopyFaviconCallback(nsIURI *aNewURI)
|
||||
nsCopyFaviconCallback(nsIURI *aNewURI, bool aInPrivateBrowsing)
|
||||
: mNewURI(aNewURI)
|
||||
, mInPrivateBrowsing(aInPrivateBrowsing)
|
||||
{
|
||||
}
|
||||
|
||||
@ -8173,23 +8174,28 @@ public:
|
||||
NS_ENSURE_STATE(favSvc);
|
||||
|
||||
return favSvc->SetAndFetchFaviconForPage(mNewURI, aFaviconURI,
|
||||
false, nullptr);
|
||||
false,
|
||||
mInPrivateBrowsing ?
|
||||
nsIFaviconService::FAVICON_LOAD_PRIVATE :
|
||||
nsIFaviconService::FAVICON_LOAD_NON_PRIVATE,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIURI> mNewURI;
|
||||
bool mInPrivateBrowsing;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsCopyFaviconCallback, nsIFaviconDataCallback)
|
||||
|
||||
// Tell the favicon service that aNewURI has the same favicon as aOldURI.
|
||||
void CopyFavicon(nsIURI *aOldURI, nsIURI *aNewURI)
|
||||
void CopyFavicon(nsIURI *aOldURI, nsIURI *aNewURI, bool inPrivateBrowsing)
|
||||
{
|
||||
nsCOMPtr<mozIAsyncFavicons> favSvc =
|
||||
do_GetService("@mozilla.org/browser/favicon-service;1");
|
||||
if (favSvc) {
|
||||
nsCOMPtr<nsIFaviconDataCallback> callback =
|
||||
new nsCopyFaviconCallback(aNewURI);
|
||||
new nsCopyFaviconCallback(aNewURI, inPrivateBrowsing);
|
||||
favSvc->GetFaviconURLForPage(aOldURI, callback);
|
||||
}
|
||||
}
|
||||
@ -8856,7 +8862,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
|
||||
// Inform the favicon service that the favicon for oldURI also
|
||||
// applies to aURI.
|
||||
CopyFavicon(oldURI, aURI);
|
||||
CopyFavicon(oldURI, aURI, mInPrivateBrowsing);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -10195,7 +10201,7 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
|
||||
|
||||
// Inform the favicon service that our old favicon applies to this new
|
||||
// URI.
|
||||
CopyFavicon(oldURI, newURI);
|
||||
CopyFavicon(oldURI, newURI, mInPrivateBrowsing);
|
||||
}
|
||||
else {
|
||||
FireDummyOnLocationChange();
|
||||
|
@ -642,7 +642,8 @@ BookmarkImporter.prototype = {
|
||||
if (aIconURI) {
|
||||
if (aIconURI.scheme == "chrome") {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(aPageURI, aIconURI,
|
||||
false);
|
||||
false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -672,7 +673,8 @@ BookmarkImporter.prototype = {
|
||||
// case neither the favicon URI nor the favicon data will be saved. If the
|
||||
// bookmark is visited again later, the URI and data will be fetched.
|
||||
PlacesUtils.favicons.replaceFaviconDataFromDataURL(faviconURI, aData);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(aPageURI, faviconURI, false);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(aPageURI, faviconURI, false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1411,7 +1411,8 @@ var PlacesUtils = {
|
||||
// Create a fake faviconURI to use (FIXME: bug 523932)
|
||||
let faviconURI = this._uri("fake-favicon-uri:" + aData.uri);
|
||||
this.favicons.replaceFaviconDataFromDataURL(faviconURI, aData.icon, 0);
|
||||
this.favicons.setAndFetchFaviconForPage(this._uri(aData.uri), faviconURI, false);
|
||||
this.favicons.setAndFetchFaviconForPage(this._uri(aData.uri), faviconURI, false,
|
||||
this.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Failed to import favicon data:" + ex);
|
||||
}
|
||||
@ -1420,7 +1421,8 @@ var PlacesUtils = {
|
||||
try {
|
||||
this.favicons.setAndFetchFaviconForPage(this._uri(aData.uri),
|
||||
this._uri(aData.iconUri),
|
||||
false);
|
||||
false,
|
||||
this.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError("Failed to import favicon URI:" + ex);
|
||||
}
|
||||
|
@ -75,7 +75,8 @@ let gTests = [
|
||||
{
|
||||
observer.reset();
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(NetUtil.newURI("http://book.ma.rk/"),
|
||||
SMALLPNG_DATA_URI, true);
|
||||
SMALLPNG_DATA_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
},
|
||||
function remove_page_test()
|
||||
{
|
||||
|
@ -138,7 +138,8 @@ function test()
|
||||
// the protocol.
|
||||
fs.replaceFaviconDataFromDataURL(uri(testURIs[1]), expectedURIs[1],
|
||||
(Date.now() + 60 * 60 * 24 * 1000) * 1000);
|
||||
fs.setAndFetchFaviconForPage(pageURI, uri(testURIs[1]), true);
|
||||
fs.setAndFetchFaviconForPage(pageURI, uri(testURIs[1]), true,
|
||||
fs.FAVICON_LOAD_NON_PRIVATE);
|
||||
|
||||
// And start our test process.
|
||||
loadNextTest();
|
||||
|
@ -34,7 +34,8 @@ add_test(function test_expireAllFavicons() {
|
||||
// Add a visited page.
|
||||
addVisits({ uri: TEST_PAGE_URI, transition: TRANSITION_TYPED }, function () {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(TEST_PAGE_URI,
|
||||
SMALLPNG_DATA_URI, true);
|
||||
SMALLPNG_DATA_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
|
||||
// Add a page with a bookmark.
|
||||
PlacesUtils.bookmarks.insertBookmark(
|
||||
@ -42,9 +43,11 @@ add_test(function test_expireAllFavicons() {
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"Test bookmark");
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
BOOKMARKED_PAGE_URI, SMALLPNG_DATA_URI, true, function () {
|
||||
// Start expiration only after data has been saved in the database.
|
||||
PlacesUtils.favicons.expireAllFavicons();
|
||||
});
|
||||
BOOKMARKED_PAGE_URI, SMALLPNG_DATA_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function () {
|
||||
// Start expiration only after data has been saved in the database.
|
||||
PlacesUtils.favicons.expireAllFavicons();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -269,6 +269,7 @@ add_test(function test_insert_asynchronous_mints_guid() {
|
||||
do_log_info("Asynchronously setting page favicon.");
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI, iconURI, false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function AMG_faviconDataCallback(uri, len, data, mimeType) {
|
||||
do_check_true(iconURI.equals(uri));
|
||||
|
||||
@ -291,6 +292,7 @@ add_test(function test_insert_asynchronous_update_preserves_guid() {
|
||||
do_log_info("Asynchronously re-setting page favicon.");
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI, iconURI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function UPG_faviconDataCallback(uri, len, data, mimeType) {
|
||||
do_check_true(iconURI.equals(uri));
|
||||
|
||||
|
@ -41,6 +41,7 @@ function checkFaviconDataConversion(aFileName, aFileMimeType, aFileLength,
|
||||
PlacesUtils.favicons.replaceFaviconData(faviconURI, fileData, fileData.length,
|
||||
aFileMimeType);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, faviconURI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function CFDC_verify(aURI, aDataLen, aData, aMimeType) {
|
||||
if (!aExpectConversion) {
|
||||
do_check_true(compareArrays(aData, fileData));
|
||||
|
@ -28,7 +28,9 @@ add_test(function test_normal()
|
||||
|
||||
addVisits(pageURI, function () {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI, FAVICON_URI, true, function () {
|
||||
pageURI, FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function () {
|
||||
PlacesUtils.favicons.getFaviconDataForPage(pageURI,
|
||||
function (aURI, aDataLen, aData, aMimeType) {
|
||||
do_check_true(aURI.equals(FAVICON_URI));
|
||||
|
@ -19,7 +19,9 @@ add_test(function test_normal()
|
||||
|
||||
addVisits(pageURI, function () {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI, SMALLPNG_DATA_URI, true, function () {
|
||||
pageURI, SMALLPNG_DATA_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function () {
|
||||
PlacesUtils.favicons.getFaviconURLForPage(pageURI,
|
||||
function (aURI, aDataLen, aData, aMimeType) {
|
||||
do_check_true(aURI.equals(SMALLPNG_DATA_URI));
|
||||
|
@ -52,7 +52,8 @@ add_test(function test_query_result_favicon_changed_on_child()
|
||||
// data URI.
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(PAGE_URI,
|
||||
SMALLPNG_DATA_URI,
|
||||
false);
|
||||
false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
}
|
||||
},
|
||||
nodeIconChanged: function QRFCOC_nodeIconChanged(aNode) {
|
||||
|
@ -80,6 +80,7 @@ add_test(function test_replaceFaviconData_validHistoryURI() {
|
||||
iconsvc.replaceFaviconData(favicon.uri, favicon.data, favicon.data.length,
|
||||
favicon.mimetype);
|
||||
iconsvc.setAndFetchFaviconForPage(pageURI, favicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconData_validHistoryURI_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, favicon.mimetype, favicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -105,6 +106,7 @@ add_test(function test_replaceFaviconData_overrideDefaultFavicon() {
|
||||
secondFavicon.mimetype);
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconData_overrideDefaultFavicon_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, secondFavicon.mimetype, secondFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -128,6 +130,7 @@ add_test(function test_replaceFaviconData_replaceExisting() {
|
||||
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconData_replaceExisting_firstSet_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, firstFavicon.mimetype, firstFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -163,6 +166,7 @@ add_test(function test_replaceFaviconData_unrelatedReplace() {
|
||||
unrelatedFavicon.mimetype);
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, favicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconData_unrelatedReplace_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, favicon.mimetype, favicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -232,6 +236,7 @@ add_test(function test_replaceFaviconData_twiceReplace() {
|
||||
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconData_twiceReplace_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, secondFavicon.mimetype, secondFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
|
@ -82,6 +82,7 @@ add_test(function test_replaceFaviconDataFromDataURL_validHistoryURI() {
|
||||
let favicon = createFavicon("favicon1.png");
|
||||
iconsvc.replaceFaviconDataFromDataURL(favicon.uri, createDataURLForFavicon(favicon));
|
||||
iconsvc.setAndFetchFaviconForPage(pageURI, favicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconDataFromDataURL_validHistoryURI_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, favicon.mimetype, favicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -105,6 +106,7 @@ add_test(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
|
||||
iconsvc.replaceFaviconDataFromDataURL(firstFavicon.uri, createDataURLForFavicon(secondFavicon));
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, secondFavicon.mimetype, secondFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -128,6 +130,7 @@ add_test(function test_replaceFaviconDataFromDataURL_replaceExisting() {
|
||||
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconDataFromDataURL_replaceExisting_firstSet_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, firstFavicon.mimetype, firstFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -157,6 +160,7 @@ add_test(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
|
||||
iconsvc.replaceFaviconDataFromDataURL(unrelatedFavicon.uri, createDataURLForFavicon(unrelatedFavicon));
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, favicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconDataFromDataURL_unrelatedReplace_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, favicon.mimetype, favicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -210,6 +214,7 @@ add_test(function test_replaceFaviconDataFromDataURL_twiceReplace() {
|
||||
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconDataFromDataURL_twiceReplace_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, secondFavicon.mimetype, secondFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -238,6 +243,7 @@ add_test(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
|
||||
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconDataFromDataURL_afterRegularAssign_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, secondFavicon.mimetype, secondFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
@ -266,6 +272,7 @@ add_test(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
|
||||
|
||||
iconsvc.setAndFetchFaviconForPage(
|
||||
pageURI, firstFavicon.uri, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function test_replaceFaviconDataFromDataURL_beforeRegularAssign_check(aURI, aDataLen, aData, aMimeType) {
|
||||
checkCallbackSucceeded(aMimeType, aData, secondFavicon.mimetype, secondFavicon.data);
|
||||
checkFaviconDataForPage(
|
||||
|
@ -32,7 +32,8 @@ add_test(function test_normal()
|
||||
});
|
||||
|
||||
addVisits({ uri: pageURI, transition: TRANSITION_TYPED}, function () {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
});
|
||||
});
|
||||
|
||||
@ -48,7 +49,8 @@ add_test(function test_aboutURI_bookmarked()
|
||||
PlacesUtils.bookmarks.insertBookmark(
|
||||
PlacesUtils.unfiledBookmarksFolderId, pageURI,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX, pageURI.spec);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
});
|
||||
|
||||
add_test(function test_privateBrowsing_bookmarked()
|
||||
@ -76,7 +78,8 @@ add_test(function test_privateBrowsing_bookmarked()
|
||||
PlacesUtils.bookmarks.insertBookmark(
|
||||
PlacesUtils.unfiledBookmarksFolderId, pageURI,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX, pageURI.spec);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_PRIVATE);
|
||||
|
||||
// The setAndFetchFaviconForPage function calls CanAddURI synchronously,
|
||||
// thus we can exit Private Browsing Mode immediately.
|
||||
@ -99,7 +102,8 @@ add_test(function test_disabledHistory_bookmarked()
|
||||
PlacesUtils.bookmarks.insertBookmark(
|
||||
PlacesUtils.unfiledBookmarksFolderId, pageURI,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX, pageURI.spec);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true);
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
|
||||
// The setAndFetchFaviconForPage function calls CanAddURI synchronously, thus
|
||||
// we can set the preference back to true immediately. We don't clear the
|
||||
|
@ -52,7 +52,8 @@ add_test(function test_null_pageURI()
|
||||
try {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
null,
|
||||
FAVICON_URI, true);
|
||||
FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
do_throw("Exception expected because aPageURI is null.");
|
||||
} catch (ex) {
|
||||
// We expected an exception.
|
||||
@ -66,7 +67,8 @@ add_test(function test_null_faviconURI()
|
||||
try {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
NetUtil.newURI("http://example.com/null_faviconURI"),
|
||||
null, true);
|
||||
null, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
do_throw("Exception expected because aFaviconURI is null.");
|
||||
} catch (ex) {
|
||||
// We expected an exception.
|
||||
@ -79,7 +81,8 @@ add_test(function test_aboutURI()
|
||||
{
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
NetUtil.newURI("about:testAboutURI"),
|
||||
FAVICON_URI, true);
|
||||
FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -102,7 +105,8 @@ add_test(function test_privateBrowsing_nonBookmarkedURI()
|
||||
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI,
|
||||
FAVICON_URI, true);
|
||||
FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_PRIVATE);
|
||||
|
||||
// The setAndFetchFaviconForPage function calls CanAddURI synchronously,
|
||||
// thus we can exit Private Browsing Mode immediately.
|
||||
@ -120,7 +124,8 @@ add_test(function test_disabledHistory()
|
||||
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI,
|
||||
FAVICON_URI, true);
|
||||
FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
|
||||
// The setAndFetchFaviconForPage function calls CanAddURI synchronously, thus
|
||||
// we can set the preference back to true immediately . We don't clear the
|
||||
@ -137,7 +142,8 @@ add_test(function test_errorIcon()
|
||||
addVisits({ uri: pageURI, transition: TRANSITION_TYPED }, function () {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI,
|
||||
FAVICON_ERRORPAGE_URI, true);
|
||||
FAVICON_ERRORPAGE_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -147,7 +153,8 @@ add_test(function test_nonexistingPage()
|
||||
{
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
NetUtil.newURI("http://example.com/nonexistingPage"),
|
||||
FAVICON_URI, true);
|
||||
FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -160,6 +167,7 @@ add_test(function test_finalVerification()
|
||||
addVisits({ uri: LAST_PAGE_URI, transition: TRANSITION_TYPED }, function () {
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
LAST_PAGE_URI,
|
||||
LAST_FAVICON_URI, true);
|
||||
LAST_FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
});
|
||||
});
|
||||
|
@ -240,7 +240,9 @@ add_test(function test_import_chromefavicon()
|
||||
"Test");
|
||||
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
PAGE_URI, CHROME_FAVICON_URI, true, function () {
|
||||
PAGE_URI, CHROME_FAVICON_URI, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function () {
|
||||
PlacesUtils.favicons.getFaviconDataForPage(
|
||||
PAGE_URI, function (aURI, aDataLen, aData, aMimeType) {
|
||||
let base64Icon = "data:image/png;base64," +
|
||||
@ -255,7 +257,9 @@ add_test(function test_import_chromefavicon()
|
||||
|
||||
// Change the favicon to check it's really imported again later.
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
PAGE_URI, CHROME_FAVICON_URI_2, true, function () {
|
||||
PAGE_URI, CHROME_FAVICON_URI_2, true,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
function () {
|
||||
|
||||
remove_all_bookmarks();
|
||||
|
||||
|
@ -143,5 +143,7 @@ add_test(function test_onPageChanged() {
|
||||
// receive the onPageChanged notification. To keep this test self-contained,
|
||||
// we use an URI representing the smallest possible PNG file.
|
||||
PlacesUtils.favicons.setAndFetchFaviconForPage(testuri, SMALLPNG_DATA_URI,
|
||||
false, null);
|
||||
false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||
null);
|
||||
});
|
||||
|
@ -1281,7 +1281,8 @@ tests.push({
|
||||
bs.DEFAULT_INDEX);
|
||||
do_check_true(this._separatorId > 0);
|
||||
ts.tagURI(this._uri1, ["testtag"]);
|
||||
fs.setAndFetchFaviconForPage(this._uri2, SMALLPNG_DATA_URI, false);
|
||||
fs.setAndFetchFaviconForPage(this._uri2, SMALLPNG_DATA_URI, false,
|
||||
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE);
|
||||
bs.setKeywordForBookmark(this._bookmarkId, "testkeyword");
|
||||
as.setPageAnnotation(this._uri2, "anno", "anno", 0, as.EXPIRE_NEVER);
|
||||
as.setItemAnnotation(this._bookmarkId, "anno", "anno", 0, as.EXPIRE_NEVER);
|
||||
|
Loading…
Reference in New Issue
Block a user