--- a/toolkit/components/places/BookmarkHTMLUtils.jsm
+++ b/toolkit/components/places/BookmarkHTMLUtils.jsm
@@ -515,18 +515,16 @@ BookmarkImporter.prototype = {
let href = this._safeTrim(aElt.getAttribute("href"));
let feedUrl = this._safeTrim(aElt.getAttribute("feedurl"));
let icon = this._safeTrim(aElt.getAttribute("icon"));
let iconUri = this._safeTrim(aElt.getAttribute("icon_uri"));
let lastCharset = this._safeTrim(aElt.getAttribute("last_charset"));
let keyword = this._safeTrim(aElt.getAttribute("shortcuturl"));
let postData = this._safeTrim(aElt.getAttribute("post_data"));
let webPanel = this._safeTrim(aElt.getAttribute("web_panel"));
- let micsumGenURI = this._safeTrim(aElt.getAttribute("micsum_gen_uri"));
- let generatedTitle = this._safeTrim(aElt.getAttribute("generated_title"));
let dateAdded = this._safeTrim(aElt.getAttribute("add_date"));
let lastModified = this._safeTrim(aElt.getAttribute("last_modified"));
let tags = this._safeTrim(aElt.getAttribute("tags"));
// For feeds, get the feed URL. If it is invalid, mPreviousFeed will be
// NULL and we'll create it as a normal bookmark.
if (feedUrl) {
frame.previousFeed = NetUtil.newURI(feedUrl);
@@ -1119,19 +1117,18 @@ BookmarkExporter.prototype = {
let siteSpecAnno = aItem.annos.find(anno => anno.name == PlacesUtils.LMANNO_SITEURI);
if (siteSpecAnno)
this._writeAttribute("HREF", escapeUrl(siteSpecAnno.value));
this._writeLine(">" + escapeHtmlEntities(aItem.title) + "</A>");
this._writeDescription(aItem, aIndent);
},
*_writeItem(aItem, aIndent) {
- let uri = null;
try {
- uri = NetUtil.newURI(aItem.uri);
+ NetUtil.newURI(aItem.uri);
} catch (ex) {
// If the item URI is invalid, skip the item instead of failing later.
return;
}
this._write(aIndent + "<DT><A");
this._writeAttribute("HREF", escapeUrl(aItem.uri));
this._writeDateAttributes(aItem);
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -264,17 +264,16 @@ var Bookmarks = Object.freeze({
// Remove any property that will stay the same.
removeSameValueProperties(updateInfo, item);
// Check if anything should still be updated.
if (Object.keys(updateInfo).length < 3) {
// Remove non-enumerable properties.
return Object.assign({}, item);
}
- let time = (updateInfo && updateInfo.dateAdded) || new Date();
updateInfo = validateBookmarkObject(updateInfo,
{ url: { validIf: () => item.type == this.TYPE_BOOKMARK }
, title: { validIf: () => [ this.TYPE_BOOKMARK
, this.TYPE_FOLDER ].includes(item.type) }
, lastModified: { defaultValue: new Date()
, validIf: b => b.lastModified >= item.dateAdded }
});
--- a/toolkit/components/places/History.jsm
+++ b/toolkit/components/places/History.jsm
@@ -870,23 +870,20 @@ var remove = Task.async(function*(db, {g
FROM moz_places
WHERE guid IN (${ sqlList(guids) })
OR (url_hash IN (${ urls.map(u => "hash(" + JSON.stringify(u) + ")").join(",") })
AND url IN (${ sqlList(urls) }))
`;
let onResultData = onResult ? [] : null;
let pages = [];
- let hasPagesToKeep = false;
let hasPagesToRemove = false;
yield db.execute(query, null, Task.async(function*(row) {
let hasForeign = row.getResultByName("foreign_count") != 0;
- if (hasForeign) {
- hasPagesToKeep = true;
- } else {
+ if (!hasForeign) {
hasPagesToRemove = true;
}
let id = row.getResultByName("id");
let guid = row.getResultByName("guid");
let url = row.getResultByName("url");
let page = {
id,
guid,
--- a/toolkit/components/places/PlacesTransactions.jsm
+++ b/toolkit/components/places/PlacesTransactions.jsm
@@ -308,17 +308,16 @@ TransactionsHistory.__proto__ = {
};
var PlacesTransactions = {
/**
* @see Batches in the module documentation.
*/
batch(aToBatch) {
- let batchFunc;
if (Array.isArray(aToBatch)) {
if (aToBatch.length == 0)
throw new Error("aToBatch must not be an empty array");
if (aToBatch.some(
o => !TransactionsHistory.isProxifiedTransactionObject(o))) {
throw new Error("aToBatch contains non-transaction element");
}
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1173,17 +1173,17 @@ this.PlacesUtils = {
// Update the cache.
return Task.spawn(function* () {
let guid = yield PlacesUtils.promiseItemGuid(aBookmarkId);
let bm = yield PlacesUtils.bookmarks.fetch(guid);
// Fetch keywords for this href.
let cache = yield gKeywordsCachePromise;
- for (let [ keyword, entry ] of cache) {
+ for (let [ , entry ] of cache) {
// Set the POST data on keywords not having it.
if (entry.url.href == bm.url.href && !entry.postData) {
entry.postData = aPostData;
}
}
}).catch(Cu.reportError);
},
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -1256,17 +1256,17 @@ Search.prototype = {
style: "action searchengine",
frecency: FRECENCY_DEFAULT,
remote: !!suggestion
});
},
*_matchRemoteTabs() {
let matches = yield PlacesRemoteTabsAutocompleteProvider.getMatches(this._originalSearchString);
- for (let {url, title, icon, deviceClass, deviceName} of matches) {
+ for (let {url, title, icon, deviceName} of matches) {
// It's rare that Sync supplies the icon for the page (but if it does, it
// is a string URL)
if (!icon) {
try {
let favicon = yield PlacesUtils.promiseFaviconLinkUrl(url);
if (favicon) {
icon = favicon.spec;
}
@@ -1549,17 +1549,16 @@ Search.prototype = {
match.frecency = frecency;
match.style = "autofill";
return match;
},
_processRow: function (row) {
let match = {};
match.placeId = row.getResultByIndex(QUERYINDEX_PLACEID);
- let queryType = row.getResultByIndex(QUERYINDEX_QUERYTYPE);
let escapedURL = row.getResultByIndex(QUERYINDEX_URL);
let openPageCount = row.getResultByIndex(QUERYINDEX_SWITCHTAB) || 0;
let historyTitle = row.getResultByIndex(QUERYINDEX_TITLE) || "";
let iconurl = row.getResultByIndex(QUERYINDEX_ICONURL) || "";
let bookmarked = row.getResultByIndex(QUERYINDEX_BOOKMARKED);
let bookmarkTitle = bookmarked ?
row.getResultByIndex(QUERYINDEX_BOOKMARKTITLE) : null;
let tags = row.getResultByIndex(QUERYINDEX_TAGS) || "";
--- a/toolkit/components/places/tests/bookmarks/test_1016953-renaming-uncompressed.js
+++ b/toolkit/components/places/tests/bookmarks/test_1016953-renaming-uncompressed.js
@@ -46,17 +46,17 @@ add_task(function* test_same_date_same_h
});
add_task(function* test_same_date_diff_hash() {
// If the old file has been created on the same date, but has a different hash
// the existing file should be overwritten with the newer compressed version
let backupFolder = yield PlacesBackups.getBackupFolder();
let tempPath = OS.Path.join(OS.Constants.Path.profileDir,
"bug10169583_bookmarks.json");
- let {count, hash} = yield BookmarkJSONUtils.exportToFile(tempPath);
+ let {count} = yield BookmarkJSONUtils.exportToFile(tempPath);
let dateObj = new Date();
let filename = "bookmarks-" + PlacesBackups.toISODateString(dateObj) + "_" +
count + "_" + "differentHash==" + ".json";
let backupFile = OS.Path.join(backupFolder, filename);
yield OS.File.move(tempPath, backupFile);
yield PlacesBackups.create(); // Force compressed backup
mostRecentBackupFile = yield PlacesBackups.getMostRecentBackup();
--- a/toolkit/components/places/tests/bookmarks/test_1129529.js
+++ b/toolkit/components/places/tests/bookmarks/test_1129529.js
@@ -56,17 +56,17 @@ add_task(function* () {
]
}]
};
let contentType = "application/json";
let uri = "data:" + contentType + "," + JSON.stringify(aData);
yield BookmarkJSONUtils.importFromURL(uri, false);
- let [bookmarks, count] = yield PlacesBackups.getBookmarksTree();
+ let [bookmarks] = yield PlacesBackups.getBookmarksTree();
let unsortedBookmarks = bookmarks.children[2].children;
Assert.equal(unsortedBookmarks.length, 3);
for (let i = 0; i < unsortedBookmarks.length; ++i) {
let bookmark = unsortedBookmarks[i];
Assert.equal(bookmark.charset, "UTF-8");
Assert.equal(bookmark.dateAdded, now);
Assert.equal(bookmark.lastModified, now);
--- a/toolkit/components/places/tests/bookmarks/test_417228-other-roots.js
+++ b/toolkit/components/places/tests/bookmarks/test_417228-other-roots.js
@@ -124,19 +124,16 @@ tests.push({
function run_test() {
run_next_test();
}
add_task(function* () {
// make json file
let jsonFile = OS.Path.join(OS.Constants.Path.profileDir, "bookmarks.json");
- // array of ids not to delete when restoring
- var excludedItemsFromRestore = [];
-
// populate db
tests.forEach(function(aTest) {
aTest.populate();
// sanity
aTest.validate();
if (aTest.excludedItemsFromRestore)
excludedItemsFromRestore = excludedItems.concat(aTest.excludedItemsFromRestore);
--- a/toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js
+++ b/toolkit/components/places/tests/bookmarks/test_466303-json-remove-backups.js
@@ -20,17 +20,16 @@ add_task(function* check_max_backups_is_
let jsonPath = OS.Path.join(backupFolder, "bookmarks-2008-01-31.json");
let jsonFile = yield OS.File.open(jsonPath, { truncate: true });
jsonFile.close();
do_check_true(yield OS.File.exists(jsonPath));
// Export bookmarks to JSON.
// Allow 2 backups, the older one should be removed.
yield PlacesBackups.create(2);
- let backupFilename = PlacesBackups.getFilenameForDate();
let count = 0;
let lastBackupPath = null;
let iterator = new OS.File.DirectoryIterator(backupFolder);
try {
yield iterator.forEach(aEntry => {
count++;
if (PlacesBackups.filenamesRegex.test(aEntry.name))
@@ -48,17 +47,16 @@ add_task(function* check_max_backups_is_
add_task(function* check_max_backups_greater_than_backups() {
// Get bookmarkBackups directory
let backupFolder = yield PlacesBackups.getBackupFolder();
// Export bookmarks to JSON.
// Allow 3 backups, none should be removed.
yield PlacesBackups.create(3);
- let backupFilename = PlacesBackups.getFilenameForDate();
let count = 0;
let lastBackupPath = null;
let iterator = new OS.File.DirectoryIterator(backupFolder);
try {
yield iterator.forEach(aEntry => {
count++;
if (PlacesBackups.filenamesRegex.test(aEntry.name))
@@ -74,17 +72,16 @@ add_task(function* check_max_backups_gre
add_task(function* check_max_backups_null() {
// Get bookmarkBackups directory
let backupFolder = yield PlacesBackups.getBackupFolder();
// Export bookmarks to JSON.
// Allow infinite backups, none should be removed, a new one is not created
// since one for today already exists.
yield PlacesBackups.create(null);
- let backupFilename = PlacesBackups.getFilenameForDate();
let count = 0;
let lastBackupPath = null;
let iterator = new OS.File.DirectoryIterator(backupFolder);
try {
yield iterator.forEach(aEntry => {
count++;
if (PlacesBackups.filenamesRegex.test(aEntry.name))
@@ -100,17 +97,16 @@ add_task(function* check_max_backups_nul
add_task(function* check_max_backups_undefined() {
// Get bookmarkBackups directory
let backupFolder = yield PlacesBackups.getBackupFolder();
// Export bookmarks to JSON.
// Allow infinite backups, none should be removed, a new one is not created
// since one for today already exists.
yield PlacesBackups.create();
- let backupFilename = PlacesBackups.getFilenameForDate();
let count = 0;
let lastBackupPath = null;
let iterator = new OS.File.DirectoryIterator(backupFolder);
try {
yield iterator.forEach(aEntry => {
count++;
if (PlacesBackups.filenamesRegex.test(aEntry.name))
--- a/toolkit/components/places/tests/bookmarks/test_477583_json-backup-in-future.js
+++ b/toolkit/components/places/tests/bookmarks/test_477583_json-backup-in-future.js
@@ -36,17 +36,16 @@ function run_test() {
do_check_eq((yield PlacesBackups.getBackupFiles()).length, 0);
yield PlacesBackups.create();
// Check that a backup for today has been created.
do_check_eq((yield PlacesBackups.getBackupFiles()).length, 1);
let mostRecentBackupFile = yield PlacesBackups.getMostRecentBackup();
do_check_neq(mostRecentBackupFile, null);
- let todayFilename = PlacesBackups.getFilenameForDate();
do_check_true(PlacesBackups.filenamesRegex.test(OS.Path.basename(mostRecentBackupFile)));
// Check that future backup has been removed.
do_check_false(futureBackupFile.exists());
// Cleanup.
mostRecentBackupFile = new FileUtils.File(mostRecentBackupFile);
mostRecentBackupFile.remove(false);
--- a/toolkit/components/places/tests/bookmarks/test_711914.js
+++ b/toolkit/components/places/tests/bookmarks/test_711914.js
@@ -33,21 +33,20 @@ function run_test() {
let folder1 = PlacesUtils.bookmarks
.createFolder(PlacesUtils.bookmarksMenuFolderId,
"Folder1",
PlacesUtils.bookmarks.DEFAULT_INDEX);
let folder2 = PlacesUtils.bookmarks
.createFolder(folder1,
"Folder2",
PlacesUtils.bookmarks.DEFAULT_INDEX);
- let itemId = PlacesUtils.bookmarks
- .insertBookmark(folder2,
- NetUtil.newURI("http://mozilla.org/"),
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- "Mozilla");
+ PlacesUtils.bookmarks.insertBookmark(folder2,
+ NetUtil.newURI("http://mozilla.org/"),
+ PlacesUtils.bookmarks.DEFAULT_INDEX,
+ "Mozilla");
PlacesUtils.bookmarks.removeFolderChildren(folder1);
// Check title is correctly reported.
do_check_eq(PlacesUtils.bookmarks.getItemTitle(folder1), "Folder1");
try {
PlacesUtils.bookmarks.getItemTitle(folder2);
do_throw("trying to fetch a removed bookmark should throw");
--- a/toolkit/components/places/tests/bookmarks/test_818587_compress-bookmarks-backups.js
+++ b/toolkit/components/places/tests/bookmarks/test_818587_compress-bookmarks-backups.js
@@ -4,18 +4,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
run_next_test();
}
add_task(function* compress_bookmark_backups_test() {
- let backupFolder = yield PlacesBackups.getBackupFolder();
-
// Check for jsonlz4 extension
let todayFilename = PlacesBackups.getFilenameForDate(new Date(2014, 4, 15), true);
do_check_eq(todayFilename, "bookmarks-2014-05-15.jsonlz4");
yield PlacesBackups.create();
// Check that a backup for today has been created and the regex works fine for lz4.
do_check_eq((yield PlacesBackups.getBackupFiles()).length, 1);
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js
@@ -87,23 +87,23 @@ add_task(function* test_bookmarks() {
do_check_true(bs.placesRoot > 0);
do_check_true(bs.bookmarksMenuFolder > 0);
do_check_true(bs.tagsFolder > 0);
do_check_true(bs.toolbarFolder > 0);
do_check_true(bs.unfiledBookmarksFolder > 0);
// test getFolderIdForItem() with bogus item id will throw
try {
- let id = bs.getFolderIdForItem(0);
+ bs.getFolderIdForItem(0);
do_throw("getFolderIdForItem accepted bad input");
} catch (ex) {}
// test getFolderIdForItem() with bogus item id will throw
try {
- let id = bs.getFolderIdForItem(-1);
+ bs.getFolderIdForItem(-1);
do_throw("getFolderIdForItem accepted bad input");
} catch (ex) {}
// test root parentage
do_check_eq(bs.getFolderIdForItem(bs.bookmarksMenuFolder), bs.placesRoot);
do_check_eq(bs.getFolderIdForItem(bs.tagsFolder), bs.placesRoot);
do_check_eq(bs.getFolderIdForItem(bs.toolbarFolder), bs.placesRoot);
do_check_eq(bs.getFolderIdForItem(bs.unfiledBookmarksFolder), bs.placesRoot);
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
@@ -24,17 +24,17 @@ add_task(function* test_eraseEverything(
"testanno1", "testvalue1", 0, 0);
let menuFolder = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.menuGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER });
checkBookmarkObject(menuFolder);
let menuBookmark = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.menuGuid,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: "http://example.com/" });
- checkBookmarkObject(unfiledBookmark);
+ checkBookmarkObject(menuBookmark);
let menuBookmarkInFolder =
yield PlacesUtils.bookmarks.insert({ parentGuid: menuFolder.guid,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: "http://mozilla.org/" });
checkBookmarkObject(menuBookmarkInFolder);
PlacesUtils.annotations.setItemAnnotation((yield PlacesUtils.promiseItemId(menuBookmarkInFolder.guid)),
"testanno1", "testvalue1", 0, 0);
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_notifications.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_notifications.js
@@ -156,18 +156,18 @@ add_task(function* update_bookmark_uri()
bm.parentGuid, "http://url.example.com/",
Ci.nsINavBookmarksService.SOURCE_DEFAULT ] }
]);
});
add_task(function* update_move_same_folder() {
// Ensure there are at least two items in place (others test do so for us,
// but we don't have to depend on that).
- let sep = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
- parentGuid: PlacesUtils.bookmarks.unfiledGuid });
+ yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid });
let bm = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: new URL("http://move.example.com/") });
let bmItemId = yield PlacesUtils.promiseItemId(bm.guid);
let bmParentId = yield PlacesUtils.promiseItemId(bm.parentGuid);
let bmOldIndex = bm.index;
let observer = expectNotifications();
@@ -265,17 +265,17 @@ add_task(function* remove_bookmark_tag_n
title: "tag" });
let tag = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
parentGuid: tagFolder.guid,
url: new URL("http://untag.example.com/") });
let tagId = yield PlacesUtils.promiseItemId(tag.guid);
let tagParentId = yield PlacesUtils.promiseItemId(tag.parentGuid);
let observer = expectNotifications();
- let removed = yield PlacesUtils.bookmarks.remove(tag.guid);
+ yield PlacesUtils.bookmarks.remove(tag.guid);
observer.check([ { name: "onItemRemoved",
arguments: [ tagId, tagParentId, tag.index, tag.type,
tag.url, tag.guid, tag.parentGuid,
Ci.nsINavBookmarksService.SOURCE_DEFAULT ] },
{ name: "onItemChanged",
arguments: [ itemId, "tags", false, "",
bm.lastModified, bm.type, parentId,
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
@@ -187,18 +187,18 @@ add_task(function* remove_separator() {
Assert.ok(!("url" in bm2));
Assert.ok(!("title" in bm2));
});
add_task(function* test_nested_content_fails_when_not_allowed() {
let folder1 = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: "a folder" });
- let folder2 = yield PlacesUtils.bookmarks.insert({ parentGuid: folder1.guid,
- type: PlacesUtils.bookmarks.TYPE_FOLDER,
- title: "a folder" });
+ yield PlacesUtils.bookmarks.insert({ parentGuid: folder1.guid,
+ type: PlacesUtils.bookmarks.TYPE_FOLDER,
+ title: "a folder" });
yield Assert.rejects(PlacesUtils.bookmarks.remove(folder1, {preventRemovalOfNonEmptyFolders: true}),
/Cannot remove a non-empty folder./);
});
function run_test() {
run_next_test();
}
--- a/toolkit/components/places/tests/bookmarks/test_keywords.js
+++ b/toolkit/components/places/tests/bookmarks/test_keywords.js
@@ -270,17 +270,16 @@ add_task(function* test_unsetKeyword() {
check_keyword(URI2, null);
Assert.equal((yield foreign_count(URI2)), fc - 1); // + 1 bookmark - 2 keyword
yield PlacesTestUtils.promiseAsyncUpdates();
check_orphans();
});
add_task(function* test_addRemoveBookmark() {
- let fc = yield foreign_count(URI3);
let observer = expectNotifications();
let itemId =
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
URI3,
PlacesUtils.bookmarks.DEFAULT_INDEX,
"test3");
--- a/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js
+++ b/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js
@@ -2,17 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file tests the normal operation of setAndFetchFaviconForPage.
function test() {
// Initialization
waitForExplicitFinish();
let windowsToClose = [];
- let testURI = "https://www.mozilla.org/en-US/";
let favIconLocation =
"http://example.org/tests/toolkit/components/places/tests/browser/favicon-normal32.png";
let favIconURI = NetUtil.newURI(favIconLocation);
let favIconMimeType= "image/png";
let pageURI;
let favIconData;
function testOnWindow(aOptions, aCallback) {
--- a/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage_failures.js
+++ b/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage_failures.js
@@ -36,17 +36,17 @@ function test() {
aWin.close();
});
});
function checkFavIconsDBCount(aCallback) {
let stmt = DBConn().createAsyncStatement("SELECT url FROM moz_favicons");
stmt.executeAsync({
handleResult: function final_handleResult(aResultSet) {
- for (let row; (row = aResultSet.getNextRow()); ) {
+ while (aResultSet.getNextRow()) {
favIconsResultCount++;
}
},
handleError: function final_handleError(aError) {
throw ("Unexpected error (" + aError.result + "): " + aError.message);
},
handleCompletion: function final_handleCompletion(aReason) {
// begin testing
@@ -137,17 +137,16 @@ function test() {
if (aCallback) {
aCallback();
}
});
}
function testErrorIcon(aWindow, aCallback) {
let pageURI = NetUtil.newURI("http://example.com/errorIcon");
- let places = [{ uri: pageURI, transition: TRANSITION_TYPED }];
addVisits({ uri: pageURI, transition: TRANSITION_TYPED }, aWindow,
function () {
aWindow.PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI,
favIconErrorPageURI, true,
aWindow.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, null,
Services.scriptSecurityManager.getSystemPrincipal());
if (aCallback) {
--- a/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
+++ b/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
@@ -1,17 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
// initialization
waitForExplicitFinish();
let windowsToClose = [];
- let testURI = "https://www.mozilla.org/en-US/";
let initialURL =
"http://example.com/tests/toolkit/components/places/tests/browser/begin.html";
let finalURL =
"http://example.com/tests/toolkit/components/places/tests/browser/final.html";
let observer = null;
let enumerator = null;
let currentObserver = null;
let uri = null;
--- a/toolkit/components/places/tests/browser/head.js
+++ b/toolkit/components/places/tests/browser/head.js
@@ -120,17 +120,16 @@ function waitForFaviconChanged(aExpected
* [optional] referrer: nsIURI of the referrer for this visit
* }
* @param [optional] aCallback
* Function to be invoked on completion.
* @param [optional] aStack
* The stack frame used to report errors.
*/
function addVisits(aPlaceInfo, aWindow, aCallback, aStack) {
- let stack = aStack || Components.stack.caller;
let places = [];
if (aPlaceInfo instanceof Ci.nsIURI) {
places.push({ uri: aPlaceInfo });
}
else if (Array.isArray(aPlaceInfo)) {
places = places.concat(aPlaceInfo);
} else {
places.push(aPlaceInfo)
--- a/toolkit/components/places/tests/favicons/test_expireAllFavicons.js
+++ b/toolkit/components/places/tests/favicons/test_expireAllFavicons.js
@@ -3,18 +3,16 @@
*/
"use strict";
const TEST_PAGE_URI = NetUtil.newURI("http://example.com/");
const BOOKMARKED_PAGE_URI = NetUtil.newURI("http://example.com/bookmarked");
add_task(function* test_expireAllFavicons() {
- const {FAVICON_LOAD_NON_PRIVATE} = PlacesUtils.favicons;
-
// Add a visited page.
yield PlacesTestUtils.addVisits({ uri: TEST_PAGE_URI, transition: TRANSITION_TYPED });
// Set a favicon for our test page.
yield promiseSetIconForPage(TEST_PAGE_URI, SMALLPNG_DATA_URI);
// Add a page with a bookmark.
yield PlacesUtils.bookmarks.insert({
--- a/toolkit/components/places/tests/favicons/test_moz-anno_favicon_mime_type.js
+++ b/toolkit/components/places/tests/favicons/test_moz-anno_favicon_mime_type.js
@@ -47,18 +47,16 @@ streamListener.prototype =
};
// Test Runner
function run_test()
{
let fs = Cc["@mozilla.org/browser/favicon-service;1"].
getService(Ci.nsIFaviconService);
- let ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
// Test that the default icon has the content type of image/png.
let channel = NetUtil.newChannel({
uri: fs.defaultFavicon,
loadUsingSystemPrincipal: true,
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON
});
channel.asyncOpen2(new streamListener("image/png"));
--- a/toolkit/components/places/tests/favicons/test_query_result_favicon_changed_on_child.js
+++ b/toolkit/components/places/tests/favicons/test_query_result_favicon_changed_on_child.js
@@ -4,17 +4,17 @@
*/
"use strict";
const PAGE_URI = NetUtil.newURI("http://example.com/test_query_result");
add_task(function* test_query_result_favicon_changed_on_child() {
// Bookmark our test page, so it will appear in the query resultset.
- let testBookmark = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
title: "test_bookmark",
url: PAGE_URI
});
// Get the last 10 bookmarks added to the menu or the toolbar.
let query = PlacesUtils.history.getNewQuery();
query.setFolders([PlacesUtils.bookmarksMenuFolderId,
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -504,17 +504,16 @@ function remove_all_JSON_backups() {
* @return nsIFile object for the file.
*/
function check_JSON_backup(aIsAutomaticBackup) {
let profileBookmarksJSONFile;
if (aIsAutomaticBackup) {
let bookmarksBackupDir = gProfD.clone();
bookmarksBackupDir.append("bookmarkbackups");
let files = bookmarksBackupDir.directoryEntries;
- let backup_date = PlacesBackups.toISODateString(new Date());
while (files.hasMoreElements()) {
let entry = files.getNext().QueryInterface(Ci.nsIFile);
if (PlacesBackups.filenamesRegex.test(entry.leafName)) {
profileBookmarksJSONFile = entry;
break;
}
}
} else {
--- a/toolkit/components/places/tests/history/test_insert.js
+++ b/toolkit/components/places/tests/history/test_insert.js
@@ -3,23 +3,16 @@
// Tests for `History.insert` and `History.insertMany`, as implemented in History.jsm
"use strict";
add_task(function* test_insert_error_cases() {
const TEST_URL = "http://mozilla.com";
- let validPageInfo = {
- url: TEST_URL,
- visits: [
- {transition: TRANSITION_LINK}
- ]
- };
-
Assert.throws(
() => PlacesUtils.history.insert(),
/TypeError: pageInfo must be an object/,
"passing a null into History.insert should throw a TypeError"
);
Assert.throws(
() => PlacesUtils.history.insert(1),
/TypeError: pageInfo must be an object/,
--- a/toolkit/components/places/tests/history/test_remove.js
+++ b/toolkit/components/places/tests/history/test_remove.js
@@ -149,17 +149,16 @@ add_task(function* test_remove_many() {
Assert.ok(page_in_database(WITNESS_URI), "Witness page added");
do_print("Generating samples");
let pages = [];
for (let i = 0; i < SIZE; ++i) {
let uri = NetUtil.newURI("http://mozilla.com/test_browserhistory/test_remove?sample=" + i + "&salt=" + Math.random());
let title = "Visit " + i + ", " + Math.random();
let hasBookmark = i % 3 == 0;
- let resolve;
let page = {
uri: uri,
title: title,
hasBookmark: hasBookmark,
// `true` once `onResult` has been called for this page
onResultCalled: false,
// `true` once `onDeleteVisits` has been called for this page
onDeleteVisitsCalled: false,
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -159,17 +159,17 @@ function* task_populateDB(aArray)
if (qdata.dateAdded) {
data.dateAdded = new Date(qdata.dateAdded / 1000);
}
if (qdata.lastModified) {
data.lastModified = new Date(qdata.lastModified / 1000);
}
- let item = yield PlacesUtils.bookmarks.insert(data);
+ yield PlacesUtils.bookmarks.insert(data);
if (qdata.keyword) {
yield PlacesUtils.keywords.insert({ url: qdata.uri,
keyword: qdata.keyword });
}
}
if (qdata.isTag) {
--- a/toolkit/components/places/tests/queries/test_tags.js
+++ b/toolkit/components/places/tests/queries/test_tags.js
@@ -8,31 +8,31 @@
* Tests bookmark and history queries with tags. See bug 399799.
*/
"use strict";
add_task(function* tags_getter_setter() {
do_print("Tags getter/setter should work correctly");
do_print("Without setting tags, tags getter should return empty array");
- var [query, dummy] = makeQuery();
+ var [query] = makeQuery();
do_check_eq(query.tags.length, 0);
do_print("Setting tags to an empty array, tags getter should return "+
"empty array");
- [query, dummy] = makeQuery([]);
+ [query] = makeQuery([]);
do_check_eq(query.tags.length, 0);
do_print("Setting a few tags, tags getter should return correct array");
var tags = ["bar", "baz", "foo"];
- [query, dummy] = makeQuery(tags);
+ [query] = makeQuery(tags);
setsAreEqual(query.tags, tags, true);
do_print("Setting some dupe tags, tags getter return unique tags");
- [query, dummy] = makeQuery(["foo", "foo", "bar", "foo", "baz", "bar"]);
+ [query] = makeQuery(["foo", "foo", "bar", "foo", "baz", "bar"]);
setsAreEqual(query.tags, ["bar", "baz", "foo"], true);
});
add_task(function* invalid_setter_calls() {
do_print("Invalid calls to tags setter should fail");
try {
var query = PlacesUtils.history.getNewQuery();
query.tags = null;
@@ -412,17 +412,17 @@ add_task(function* duplicate_tags() {
do_print("Manually create tag folder with same name as tag and insert " +
"bookmark");
let dupTag = yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.tagsGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: tagName
});
- let bm = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: dupTag.guid,
title: "title",
url: TEST_URI
});
do_print("Querying for tag should match URI");
var [query, opts] = makeQuery([tagName]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
@@ -437,17 +437,17 @@ add_task(function* folder_named_as_tag()
"off query results");
var tagName = "foo";
do_print("Add bookmark and tag it");
yield addBookmark(TEST_URI);
PlacesUtils.tagging.tagURI(TEST_URI, [tagName]);
do_print("Create folder with same name as tag");
- let folder = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: tagName
});
do_print("Querying for tag should match URI");
var [query, opts] = makeQuery([tagName]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
@@ -476,50 +476,50 @@ add_task(function* ORed_queries() {
let nsiuri = uri(pURI);
yield PlacesTestUtils.addVisits(nsiuri);
if (tags)
PlacesUtils.tagging.tagURI(nsiuri, tags);
}
do_print("Query for /1 OR query for /2 should match both /1 and /2");
var [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
- var [query2, dummy] = makeQuery(urisAndTags["http://example.com/2"]);
+ var [query2] = makeQuery(urisAndTags["http://example.com/2"]);
var root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]);
do_print("Query for /1 OR query on bogus tag should match only /1");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
- [query2, dummy] = makeQuery(["bogus"]);
+ [query2] = makeQuery(["bogus"]);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1"]);
do_print("Query for /1 OR query for /1 should match only /1");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
- [query2, dummy] = makeQuery(urisAndTags["http://example.com/1"]);
+ [query2] = makeQuery(urisAndTags["http://example.com/1"]);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1"]);
do_print("Query for /1 with tagsAreNot OR query for /2 with tagsAreNot " +
"should match both /1 and /2");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"], true);
- [query2, dummy] = makeQuery(urisAndTags["http://example.com/2"], true);
+ [query2] = makeQuery(urisAndTags["http://example.com/2"], true);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]);
do_print("Query for /1 OR query for /2 with tagsAreNot should match " +
"only /1");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
- [query2, dummy] = makeQuery(urisAndTags["http://example.com/2"], true);
+ [query2] = makeQuery(urisAndTags["http://example.com/2"], true);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1"]);
do_print("Query for /1 OR query for /1 with tagsAreNot should match " +
"both URIs");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
- [query2, dummy] = makeQuery(urisAndTags["http://example.com/1"], true);
+ [query2] = makeQuery(urisAndTags["http://example.com/1"], true);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]);
// Clean up.
for (let [pURI, tags] of Object.entries(urisAndTags)) {
let nsiuri = uri(pURI);
if (tags)
PlacesUtils.tagging.untagURI(nsiuri, tags);
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -106,17 +106,17 @@ AutoCompleteInput.prototype = {
onTextReverted: () => false,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput])
}
// A helper for check_autocomplete to check a specific match against data from
// the controller.
function _check_autocomplete_matches(match, result) {
- let { uri, title, tags, searchEngine, style } = match;
+ let { uri, title, tags, style } = match;
if (tags)
title += " \u2013 " + tags.sort().join(", ");
if (style)
style = style.sort();
else
style = ["favicon"];
do_print(`Checking against expected "${uri.spec}", "${title}"`);
@@ -266,17 +266,17 @@ var addBookmark = Task.async(function* (
let parentId = aBookmarkObj.parentId ? aBookmarkObj.parentId
: PlacesUtils.unfiledBookmarksFolderId;
let bm = yield PlacesUtils.bookmarks.insert({
parentGuid: (yield PlacesUtils.promiseItemGuid(parentId)),
title: aBookmarkObj.title || "A bookmark",
url: aBookmarkObj.uri
});
- let itemId = yield PlacesUtils.promiseItemId(bm.guid);
+ yield PlacesUtils.promiseItemId(bm.guid);
if (aBookmarkObj.keyword) {
yield PlacesUtils.keywords.insert({ keyword: aBookmarkObj.keyword,
url: aBookmarkObj.uri.spec,
postData: aBookmarkObj.postData
});
}
--- a/toolkit/components/places/tests/unit/test_000_frecency.js
+++ b/toolkit/components/places/tests/unit/test_000_frecency.js
@@ -51,17 +51,17 @@ var searchTerm = "frecency";
var results = [];
var matchCount = 0;
var now = Date.now();
var prefPrefix = "places.frecency.";
function* task_initializeBucket(bucket) {
let [cutoffName, weightName] = bucket;
// get pref values
- var weight = 0, cutoff = 0, bonus = 0;
+ var weight = 0, cutoff = 0;
try {
weight = prefs.getIntPref(prefPrefix + weightName);
} catch (ex) {}
try {
cutoff = prefs.getIntPref(prefPrefix + cutoffName);
} catch (ex) {}
if (cutoff < 1)
--- a/toolkit/components/places/tests/unit/test_317472.js
+++ b/toolkit/components/places/tests/unit/test_317472.js
@@ -17,21 +17,21 @@ function run_test()
add_task(function* test_execute()
{
// add pages to history
yield PlacesTestUtils.addVisits(TEST_URI);
yield PlacesTestUtils.addVisits(TEST_BOOKMARKED_URI);
// create bookmarks on TEST_BOOKMARKED_URI
- var bm1 = PlacesUtils.bookmarks.insertBookmark(
+ PlacesUtils.bookmarks.insertBookmark(
PlacesUtils.unfiledBookmarksFolderId,
TEST_BOOKMARKED_URI, PlacesUtils.bookmarks.DEFAULT_INDEX,
TEST_BOOKMARKED_URI.spec);
- var bm2 = PlacesUtils.bookmarks.insertBookmark(
+ PlacesUtils.bookmarks.insertBookmark(
PlacesUtils.toolbarFolderId,
TEST_BOOKMARKED_URI, PlacesUtils.bookmarks.DEFAULT_INDEX,
TEST_BOOKMARKED_URI.spec);
// set charset on not-bookmarked page
yield PlacesUtils.setCharsetForURI(TEST_URI, charset);
// set charset on bookmarked page
yield PlacesUtils.setCharsetForURI(TEST_BOOKMARKED_URI, charset);
--- a/toolkit/components/places/tests/unit/test_399264_query_to_string.js
+++ b/toolkit/components/places/tests/unit/test_399264_query_to_string.js
@@ -19,18 +19,16 @@ function query_string(aFolderID)
var query = hs.getNewQuery();
query.setFolders([aFolderID], 1);
var options = hs.getNewQueryOptions();
return hs.queriesToQueryString([query], 1, options);
}
function run_test()
{
- var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
const QUERIES = [
"folder=PLACES_ROOT"
, "folder=BOOKMARKS_MENU"
, "folder=TAGS"
, "folder=UNFILED_BOOKMARKS"
--- a/toolkit/components/places/tests/unit/test_399264_string_to_query.js
+++ b/toolkit/components/places/tests/unit/test_399264_string_to_query.js
@@ -27,18 +27,16 @@ function folder_id(aQuery)
do_check_true(root.hasChildren);
var folderID = root.getChild(0).parent.itemId;
root.containerOpen = false;
return folderID;
}
function run_test()
{
- var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
const QUERIES = [
"place:folder=PLACES_ROOT"
, "place:folder=BOOKMARKS_MENU"
, "place:folder=TAGS"
, "place:folder=UNFILED_BOOKMARKS"
--- a/toolkit/components/places/tests/unit/test_402799.js
+++ b/toolkit/components/places/tests/unit/test_402799.js
@@ -31,20 +31,20 @@ try {
}
// main
function run_test() {
var uri1 = uri("http://foo.bar/");
// create 2 bookmarks on the same uri
- var bookmark1id = bmsvc.insertBookmark(bmsvc.bookmarksMenuFolder, uri1,
- bmsvc.DEFAULT_INDEX, "title 1");
- var bookmark2id = bmsvc.insertBookmark(bmsvc.toolbarFolder, uri1,
- bmsvc.DEFAULT_INDEX, "title 2");
+ bmsvc.insertBookmark(bmsvc.bookmarksMenuFolder, uri1,
+ bmsvc.DEFAULT_INDEX, "title 1");
+ bmsvc.insertBookmark(bmsvc.toolbarFolder, uri1,
+ bmsvc.DEFAULT_INDEX, "title 2");
// add some tags
tagssvc.tagURI(uri1, ["foo", "bar", "foobar", "foo bar"]);
// check that a generic bookmark query returns only real bookmarks
var options = histsvc.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
var query = histsvc.getNewQuery();
--- a/toolkit/components/places/tests/unit/test_412132.js
+++ b/toolkit/components/places/tests/unit/test_412132.js
@@ -72,20 +72,20 @@ add_task(function* changeuri_bookmark_st
do_print("After changing URI of bookmark, frecency of bookmark's " +
"original URI should not be zero if original URI is still " +
"bookmarked.");
const TEST_URI = NetUtil.newURI("http://example.com/1");
let id1 = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
TEST_URI,
PlacesUtils.bookmarks.DEFAULT_INDEX,
"bookmark 1 title");
- let id2 = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- TEST_URI,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- "bookmark 2 title");
+ PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
+ TEST_URI,
+ PlacesUtils.bookmarks.DEFAULT_INDEX,
+ "bookmark 2 title");
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Bookmarked => frecency of URI should be != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0);
PlacesUtils.bookmarks.changeBookmarkURI(id1, uri("http://example.com/2"));
--- a/toolkit/components/places/tests/unit/test_PlacesSearchAutocompleteProvider.js
+++ b/toolkit/components/places/tests/unit/test_PlacesSearchAutocompleteProvider.js
@@ -36,17 +36,17 @@ add_task(function* hide_search_engine_no
do_check_eq(null, yield PlacesSearchAutocompleteProvider.findMatchByToken(token.substr(0, 1)));
});
add_task(function* add_search_engine_match() {
let promiseTopic = promiseSearchTopic("engine-added");
do_check_eq(null, yield PlacesSearchAutocompleteProvider.findMatchByToken("bacon"));
Services.search.addEngineWithDetails("bacon", "", "pork", "Search Bacon",
"GET", "http://www.bacon.moz/?search={searchTerms}");
- yield promiseSearchTopic;
+ yield promiseTopic;
let match = yield PlacesSearchAutocompleteProvider.findMatchByToken("bacon");
do_check_eq(match.url, "http://www.bacon.moz");
do_check_eq(match.engineName, "bacon");
do_check_eq(match.iconUrl, null);
});
add_task(function* test_aliased_search_engine_match() {
do_check_eq(null, yield PlacesSearchAutocompleteProvider.findMatchByAlias("sober"));
@@ -67,17 +67,17 @@ add_task(function* test_aliased_search_e
do_check_eq(match2.iconUrl, null);
});
add_task(function* test_aliased_search_engine_match_upper_case_alias() {
let promiseTopic = promiseSearchTopic("engine-added");
do_check_eq(null, yield PlacesSearchAutocompleteProvider.findMatchByToken("patch"));
Services.search.addEngineWithDetails("patch", "", "PR", "Search Patch",
"GET", "http://www.patch.moz/?search={searchTerms}");
- yield promiseSearchTopic;
+ yield promiseTopic;
// lower case
let match = yield PlacesSearchAutocompleteProvider.findMatchByAlias("pr");
do_check_eq(match.engineName, "patch");
do_check_eq(match.alias, "PR");
do_check_eq(match.iconUrl, null);
// Upper case
let match1 = yield PlacesSearchAutocompleteProvider.findMatchByAlias("PR");
do_check_eq(match1.engineName, "patch");
--- a/toolkit/components/places/tests/unit/test_async_history_api.js
+++ b/toolkit/components/places/tests/unit/test_async_history_api.js
@@ -234,17 +234,16 @@ add_task(function* test_invalid_guid_thr
do_check_eq(e.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(function* test_no_visits_throws() {
const TEST_URI =
NetUtil.newURI(TEST_DOMAIN + "test_no_id_or_guid_no_visits_throws");
const TEST_GUID = "_RANDOMGUID_";
- const TEST_PLACEID = 2;
let log_test_conditions = function(aPlace) {
let str = "Testing place with " +
(aPlace.uri ? "uri" : "no uri") + ", " +
(aPlace.guid ? "guid" : "no guid") + ", " +
(aPlace.visits ? "visits array" : "no visits array");
do_print(str);
};
@@ -612,31 +611,22 @@ add_task(function* test_handleCompletion
],
},
];
do_check_false(yield promiseIsURIVisited(places[0].uri));
do_check_false(yield promiseIsURIVisited(places[1].uri));
const EXPECTED_COUNT_SUCCESS = 2;
const EXPECTED_COUNT_FAILURE = 1;
- let callbackCountSuccess = 0;
- let callbackCountFailure = 0;
+
+ let {results, errors} = yield promiseUpdatePlaces(places);
- let placesResult = yield promiseUpdatePlaces(places);
- for (let place of placesResult.results) {
- let checker = PlacesUtils.history.canAddURI(place.uri) ?
- do_check_true : do_check_false;
- callbackCountSuccess++;
- }
- for (let error of placesResult.errors) {
- callbackCountFailure++;
- }
+ do_check_eq(results.length, EXPECTED_COUNT_SUCCESS);
+ do_check_eq(errors.length, EXPECTED_COUNT_FAILURE);
- do_check_eq(callbackCountSuccess, EXPECTED_COUNT_SUCCESS);
- do_check_eq(callbackCountFailure, EXPECTED_COUNT_FAILURE);
yield PlacesTestUtils.promiseAsyncUpdates();
});
add_task(function* test_add_visit() {
const VISIT_TIME = Date.now() * 1000;
let place = {
uri: NetUtil.newURI(TEST_DOMAIN + "test_add_visit"),
title: "test_add_visit title",
@@ -661,17 +651,16 @@ add_task(function* test_add_visit() {
do_check_eq(placeInfo.frecency, -1); // We don't pass frecency here!
do_check_eq(placeInfo.title, place.title);
// Check mozIVisitInfo properties.
let visits = placeInfo.visits;
do_check_eq(visits.length, 1);
let visit = visits[0];
do_check_eq(visit.visitDate, VISIT_TIME);
- let transitions =
do_check_true(Object.values(PlacesUtils.history.TRANSITIONS).includes(visit.transitionType));
do_check_true(visit.referrerURI === null);
// For TRANSITION_EMBED visits, many properties will always be zero or
// undefined.
if (visit.transitionType == TRANSITION_EMBED) {
// Check mozIPlaceInfo properties.
do_check_eq(placeInfo.placeId, 0, '//');
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -1209,17 +1209,17 @@ add_task(function* test_untag_uri() {
yield PT.batch(function* () {
bm_info_a.guid = yield PT.NewBookmark(bm_info_a).transact();
ensureTagsForURI(bm_info_a.url, bm_info_a.tags);
bm_info_b.guid = yield PT.NewBookmark(bm_info_b).transact();
ensureTagsForURI(bm_info_b.url, [bm_info_b.tag]);
});
function* doTest(aInfo) {
- let urls, tagsToRemove;
+ let urls, tagsRemoved;
if (aInfo instanceof Ci.nsIURI) {
urls = [aInfo];
tagsRemoved = [];
}
else if (Array.isArray(aInfo)) {
urls = aInfo;
tagsRemoved = [];
}
@@ -1496,19 +1496,19 @@ add_task(function* test_copy() {
// Cleanup. This also remove the original item.
yield PT.undo();
observer.reset();
yield PT.clearTransactionsHistory();
}
// Test duplicating leafs (bookmark, separator, empty folder)
- let bmTxn = PT.NewBookmark({ url: new URL("http://test.item.duplicate")
- , parentGuid: rootGuid
- , annos: [{ name: "Anno", value: "AnnoValue"}] });
+ PT.NewBookmark({ url: new URL("http://test.item.duplicate")
+ , parentGuid: rootGuid
+ , annos: [{ name: "Anno", value: "AnnoValue"}] });
let sepTxn = PT.NewSeparator({ parentGuid: rootGuid, index: 1 });
let livemarkTxn = PT.NewLivemark(
{ feedUrl: new URL("http://test.feed.uri")
, parentGuid: rootGuid
, title: "Test Livemark", index: 1 });
let emptyFolderTxn = PT.NewFolder(createTestFolderInfo());
for (let txn of [livemarkTxn, sepTxn, emptyFolderTxn]) {
let guid = yield txn.transact();
@@ -1659,17 +1659,17 @@ add_task(function* test_annotate_multipl
add_task(function* test_remove_multiple() {
let guids = [];
yield PT.batch(function* () {
let folderGuid = yield PT.NewFolder({ title: "Test Folder"
, parentGuid: rootGuid }).transact();
let nestedFolderGuid =
yield PT.NewFolder({ title: "Nested Test Folder"
, parentGuid: folderGuid }).transact();
- let nestedSepGuid = yield PT.NewSeparator(nestedFolderGuid).transact();
+ yield PT.NewSeparator(nestedFolderGuid).transact();
guids.push(folderGuid);
let bmGuid =
yield PT.NewBookmark({ url: new URL("http://test.bookmark.removed")
, parentGuid: rootGuid }).transact();
guids.push(bmGuid);
});
--- a/toolkit/components/places/tests/unit/test_bookmarks_html.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html.js
@@ -183,17 +183,17 @@ add_task(function* test_import_chromefav
const CHROME_FAVICON_URI = NetUtil.newURI("chrome://global/skin/icons/information-16.png");
const CHROME_FAVICON_URI_2 = NetUtil.newURI("chrome://global/skin/icons/error-16.png");
do_print("Importing from html");
yield BookmarkHTMLUtils.importFromFile(gBookmarksFileNew, true);
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Insert bookmark");
- let bookmark = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: PAGE_URI,
title: "Test"
});
do_print("Set favicon");
yield new Promise(resolve => {
PlacesUtils.favicons.setAndFetchFaviconForPage(
--- a/toolkit/components/places/tests/unit/test_crash_476292.js
+++ b/toolkit/components/places/tests/unit/test_crash_476292.js
@@ -18,11 +18,11 @@ function run_test()
// causes us to get the bookmarks service in the first place).
let dbFile = do_get_file("bug476292.sqlite");
let profD = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).
get(NS_APP_USER_PROFILE_50_DIR, Ci.nsIFile);
dbFile.copyTo(profD, "places.sqlite");
// Now get the bookmarks service. This will crash when the bug exists.
- let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
- getService(Ci.nsINavBookmarksService);
+ Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
+ getService(Ci.nsINavBookmarksService);
}
--- a/toolkit/components/places/tests/unit/test_getPlacesInfo.js
+++ b/toolkit/components/places/tests/unit/test_getPlacesInfo.js
@@ -76,17 +76,17 @@ function* test_infoByGUID() {
let placeInfoByURI = yield PlacesUtils.promisePlaceInfo(testURI);
let placeInfoByGUID = yield PlacesUtils.promisePlaceInfo(placeInfoByURI.guid);
ensurePlacesInfoObjectsAreEqual(placeInfoByURI, placeInfoByGUID);
}
add_task(test_infoByGUID);
function* test_invalid_guid() {
try {
- let placeInfoByGUID = yield PlacesUtils.promisePlaceInfo("###");
+ yield PlacesUtils.promisePlaceInfo("###");
do_throw("getPlacesInfo should fail for invalid guids")
}
catch (ex) { }
}
add_task(test_invalid_guid);
function* test_mixed_selection() {
let placeInfo1, placeInfo2;
--- a/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
+++ b/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
@@ -8,24 +8,24 @@ const bmsvc = PlacesUtils.bookmarks;
const histsvc = PlacesUtils.history;
function run_test() {
run_next_test();
}
add_task(function* test_addBookmarksAndCheckGuids() {
let folder = bmsvc.createFolder(bmsvc.placesRoot, "test folder", bmsvc.DEFAULT_INDEX);
- let b1 = bmsvc.insertBookmark(folder, uri("http://test1.com/"),
- bmsvc.DEFAULT_INDEX, "1 title");
- let b2 = bmsvc.insertBookmark(folder, uri("http://test2.com/"),
- bmsvc.DEFAULT_INDEX, "2 title");
- let b3 = bmsvc.insertBookmark(folder, uri("http://test3.com/"),
- bmsvc.DEFAULT_INDEX, "3 title");
- let s1 = bmsvc.insertSeparator(folder, bmsvc.DEFAULT_INDEX);
- let f1 = bmsvc.createFolder(folder, "test folder 2", bmsvc.DEFAULT_INDEX);
+ bmsvc.insertBookmark(folder, uri("http://test1.com/"),
+ bmsvc.DEFAULT_INDEX, "1 title");
+ bmsvc.insertBookmark(folder, uri("http://test2.com/"),
+ bmsvc.DEFAULT_INDEX, "2 title");
+ bmsvc.insertBookmark(folder, uri("http://test3.com/"),
+ bmsvc.DEFAULT_INDEX, "3 title");
+ bmsvc.insertSeparator(folder, bmsvc.DEFAULT_INDEX);
+ bmsvc.createFolder(folder, "test folder 2", bmsvc.DEFAULT_INDEX);
let root = PlacesUtils.getFolderContents(folder).root;
do_check_eq(root.childCount, 5);
// check bookmark guids
let bookmarkGuidZero = root.getChild(0).bookmarkGuid;
do_check_eq(bookmarkGuidZero.length, 12);
// bookmarks have bookmark guids
@@ -85,17 +85,16 @@ add_task(function* test_updateBookmarksA
root.containerOpen = false;
yield PlacesUtils.bookmarks.eraseEverything();
});
add_task(function* test_addVisitAndCheckGuid() {
// add a visit and test page guid and non-existing bookmark guids.
- let now = Date.now() * 1000;
let sourceURI = uri("http://test4.com/");
yield PlacesTestUtils.addVisits({ uri: sourceURI });
do_check_eq(bmsvc.getBookmarkedURIFor(sourceURI), null);
let options = histsvc.getNewQueryOptions();
let query = histsvc.getNewQuery();
query.uri = sourceURI;
let root = histsvc.executeQuery(query, options).root;
--- a/toolkit/components/places/tests/unit/test_placesTxn.js
+++ b/toolkit/components/places/tests/unit/test_placesTxn.js
@@ -316,17 +316,16 @@ add_task(function* test_remove_folder()
do_check_eq(observer._itemAddedIndex, 0);
});
add_task(function* test_remove_item_with_tag() {
// Notice in this case the tag persists since other bookmarks have same uri.
let testFolder = bmsvc.createFolder(root, "Test removing an item with a tag",
bmsvc.DEFAULT_INDEX);
- const KEYWORD = "test: test removing an item with a tag";
const TAG_NAME = "tag-test_remove_item_with_tag";
let testURI = NetUtil.newURI("http://test_remove_item_with_tag.com");
let testBkmId = bmsvc.insertBookmark(testFolder, testURI, bmsvc.DEFAULT_INDEX, "test-item1");
// create bookmark for not removing tag.
bmsvc.insertBookmark(testFolder, testURI, bmsvc.DEFAULT_INDEX, "test-item2");
// set tag
@@ -359,17 +358,16 @@ add_task(function* test_remove_item_with
});
add_task(function* test_remove_item_with_keyword() {
// Notice in this case the tag persists since other bookmarks have same uri.
let testFolder = bmsvc.createFolder(root, "Test removing an item with a keyword",
bmsvc.DEFAULT_INDEX);
const KEYWORD = "test: test removing an item with a keyword";
- const TAG_NAME = "tag-test_remove_item_with_keyword";
let testURI = NetUtil.newURI("http://test_remove_item_with_keyword.com");
let testBkmId = bmsvc.insertBookmark(testFolder, testURI, bmsvc.DEFAULT_INDEX, "test-item1");
// set keyword
yield PlacesUtils.keywords.insert({ url: testURI.spec, keyword: KEYWORD});
let txn = new PlacesRemoveItemTransaction(testBkmId);
--- a/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
+++ b/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
@@ -163,17 +163,17 @@ function* compareToNode(aItem, aNode, aI
if (aIsRootItem)
do_check_eq(aItem.itemsCount, nodesCount);
return nodesCount;
}
var itemsCount = 0;
function* new_bookmark(aInfo) {
- let currentItem = ++itemsCount;
+ ++itemsCount;
if (!("url" in aInfo))
aInfo.url = uri("http://test.item." + itemsCount);
if (!("title" in aInfo))
aInfo.title = "Test Item (bookmark) " + itemsCount;
yield PlacesTransactions.NewBookmark(aInfo).transact();
}
--- a/toolkit/components/places/tests/unit/test_resultsAsVisit_details.js
+++ b/toolkit/components/places/tests/unit/test_resultsAsVisit_details.js
@@ -59,18 +59,18 @@ add_task(function* test_addVisitCheckFie
root.containerOpen = false;
yield PlacesTestUtils.clearHistory();
});
add_task(function* test_bookmarkFields() {
let folder = bookmarks.createFolder(bookmarks.placesRoot, "test folder", bookmarks.DEFAULT_INDEX);
- let bm = bookmarks.insertBookmark(folder, uri("http://test4.com/"),
- bookmarks.DEFAULT_INDEX, "test4 title");
+ bookmarks.insertBookmark(folder, uri("http://test4.com/"),
+ bookmarks.DEFAULT_INDEX, "test4 title");
let root = PlacesUtils.getFolderContents(folder).root;
equal(root.childCount, 1);
equal(root.visitType, 0, "Visit type should be 0");
equal(root.visitId, -1, "Visit ID should be -1");
equal(root.fromVisitId, -1, "Referrer visit id should be -1");
--- a/toolkit/components/places/tests/unit/test_sync_utils.js
+++ b/toolkit/components/places/tests/unit/test_sync_utils.js
@@ -476,17 +476,17 @@ add_task(function* test_insert() {
equal(type, PlacesUtils.bookmarks.TYPE_SEPARATOR,
"Separator should have correct type");
}
yield PlacesUtils.bookmarks.eraseEverything();
});
add_task(function* test_insert_livemark() {
- let { server, site, stopServer } = makeLivemarkServer();
+ let { site, stopServer } = makeLivemarkServer();
try {
do_print("Insert livemark with feed URL");
{
let livemark = yield PlacesSyncUtils.bookmarks.insert({
kind: "livemark",
syncId: makeGuid(),
feed: site + "/feed/1",
@@ -526,17 +526,17 @@ add_task(function* test_insert_livemark(
} finally {
yield stopServer();
}
yield PlacesUtils.bookmarks.eraseEverything();
});
add_task(function* test_update_livemark() {
- let { server, site, stopServer } = makeLivemarkServer();
+ let { site, stopServer } = makeLivemarkServer();
let feedURI = uri(site + "/feed/1");
try {
// We shouldn't reinsert the livemark if the URLs are the same.
do_print("Update livemark with same URLs");
{
let livemark = yield PlacesUtils.livemarks.addLivemark({
parentGuid: PlacesUtils.bookmarks.menuGuid,
@@ -710,17 +710,17 @@ add_task(function* test_update_livemark(
} finally {
yield stopServer();
}
yield PlacesUtils.bookmarks.eraseEverything();
});
add_task(function* test_insert_tags() {
- let newItems = yield Promise.all([{
+ yield Promise.all([{
kind: "bookmark",
url: "https://example.com",
syncId: makeGuid(),
parentSyncId: "menu",
tags: ["foo", "bar"],
}, {
kind: "bookmark",
url: "https://example.org",
@@ -780,31 +780,31 @@ add_task(function* test_insert_tags_whit
"Should exclude falsy tags");
yield PlacesUtils.bookmarks.eraseEverything();
});
add_task(function* test_insert_keyword() {
do_print("Insert item with new keyword");
{
- let bookmark = yield PlacesSyncUtils.bookmarks.insert({
+ yield PlacesSyncUtils.bookmarks.insert({
kind: "bookmark",
parentSyncId: "menu",
url: "https://example.com",
keyword: "moz",
syncId: makeGuid(),
});
let entry = yield PlacesUtils.keywords.fetch("moz");
equal(entry.url.href, "https://example.com/",
"Should add keyword for item");
}
do_print("Insert item with existing keyword");
{
- let bookmark = yield PlacesSyncUtils.bookmarks.insert({
+ yield PlacesSyncUtils.bookmarks.insert({
kind: "bookmark",
parentSyncId: "menu",
url: "https://mozilla.org",
keyword: "moz",
syncId: makeGuid(),
});
let entry = yield PlacesUtils.keywords.fetch("moz");
equal(entry.url.href, "https://mozilla.org/",
@@ -918,17 +918,17 @@ add_task(function* test_insert_tag_query
equal(params.get("type"), "7", "Should preserve query type");
equal(params.get("maxResults"), "15", "Should preserve additional params");
equal(params.get("folder"), tagFolder, "Should update tag folder");
deepEqual(PlacesUtils.tagging.allTags, ["taggy"], "Should not duplicate existing tags");
}
do_print("Use the public tagging API to ensure we added the tag correctly");
{
- let bookmark = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: "https://mozilla.org",
title: "Mozilla",
});
PlacesUtils.tagging.tagURI(uri("https://mozilla.org"), ["taggy"]);
assertURLHasTags("https://mozilla.org/", ["taggy"],
"Should set tags using the tagging API");
@@ -965,17 +965,17 @@ add_task(function* test_insert_orphans()
childId = yield PlacesUtils.promiseItemId(childGuid);
equal(PlacesUtils.annotations.getItemAnnotation(childId, SYNC_PARENT_ANNO),
parentGuid, "Should set anno to missing parent GUID");
}
do_print("Insert the grandparent");
{
- let grandParent = yield PlacesSyncUtils.bookmarks.insert({
+ yield PlacesSyncUtils.bookmarks.insert({
kind: "folder",
parentSyncId: "menu",
syncId: grandParentGuid,
});
equal(PlacesUtils.annotations.getItemAnnotation(childId, SYNC_PARENT_ANNO),
parentGuid, "Child should still have orphan anno");
}
@@ -1111,17 +1111,17 @@ add_task(function* test_fetch() {
"Should include smart bookmark-specific properties");
equal(item.query, "BookmarksToolbar", "Should return query name for smart bookmarks");
}
yield PlacesUtils.bookmarks.eraseEverything();
});
add_task(function* test_fetch_livemark() {
- let { server, site, stopServer } = makeLivemarkServer();
+ let { site, stopServer } = makeLivemarkServer();
try {
do_print("Create livemark");
let livemark = yield PlacesUtils.livemarks.addLivemark({
parentGuid: PlacesUtils.bookmarks.menuGuid,
feedURI: uri(site + "/feed/1"),
siteURI: uri(site),
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
--- a/toolkit/components/places/tests/unit/test_tagging.js
+++ b/toolkit/components/places/tests/unit/test_tagging.js
@@ -78,17 +78,16 @@ function run_test() {
tagssvc.untagURI(uri2, ["tag 1"]);
do_check_eq(tagRoot.childCount, 1);
// cleanup
tag1node.containerOpen = false;
// get array of tag folder ids => title
// for testing tagging with mixed folder ids and tags
- var tagFolders = [];
var child = tagRoot.getChild(0);
var tagId = child.itemId;
var tagTitle = child.title;
// test mixed id/name tagging
// as well as non-id numeric tags
var uri3 = uri("http://testuri/3");
tagssvc.tagURI(uri3, [tagId, "tag 3", "456"]);
--- a/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js
+++ b/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js
@@ -65,17 +65,17 @@ add_task(function* remove_bookmark_still
do_print("After removing bookmark, frecency of bookmark's URI should " +
"not be zero if URI is still bookmarked.");
const TEST_URI = NetUtil.newURI("http://example.com/1");
let bm1 = yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "bookmark 1 title",
url: TEST_URI
});
- let bm2 = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "bookmark 2 title",
url: TEST_URI
});
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Bookmarked => frecency of URI should be != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0);
@@ -89,17 +89,17 @@ add_task(function* remove_bookmark_still
yield PlacesUtils.bookmarks.eraseEverything();
yield PlacesTestUtils.clearHistory();
});
add_task(function* cleared_parent_of_visited_bookmark() {
do_print("After removing all children from bookmark's parent, frecency " +
"of bookmark's URI should not be zero if URI is visited.");
const TEST_URI = NetUtil.newURI("http://example.com/1");
- let bm = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "bookmark title",
url: TEST_URI
});
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Bookmarked => frecency of URI should be != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0);
@@ -115,28 +115,28 @@ add_task(function* cleared_parent_of_vis
yield PlacesTestUtils.clearHistory();
});
add_task(function* cleared_parent_of_bookmark_still_bookmarked() {
do_print("After removing all children from bookmark's parent, frecency " +
"of bookmark's URI should not be zero if URI is still " +
"bookmarked.");
const TEST_URI = NetUtil.newURI("http://example.com/1");
- let bm1 = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "bookmark 1 title",
url: TEST_URI
});
let folder = yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: "bookmark 2 folder"
});
- let bm2 = yield PlacesUtils.bookmarks.insert({
+ yield PlacesUtils.bookmarks.insert({
title: "bookmark 2 title",
parentGuid: folder.guid,
url: TEST_URI
});
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Bookmarked => frecency of URI should be != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0);