--- a/.eslintignore
+++ b/.eslintignore
@@ -68,17 +68,16 @@ browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.js
browser/base/content/test/**
browser/base/content/newtab/**
browser/components/customizableui/**
browser/components/downloads/**
browser/components/feeds/**
browser/components/migration/**
browser/components/*.js
-browser/components/places/**
browser/components/pocket/**
browser/components/preferences/**
browser/components/privatebrowsing/**
browser/components/sessionstore/**
browser/components/shell/**
browser/components/tabview/**
browser/components/translation/**
browser/components/uitour/**
@@ -157,17 +156,16 @@ toolkit/components/help/**
toolkit/components/workerloader/tests/moduleF-syntax-error.js
# Tests old non-star function generators
toolkit/modules/tests/xpcshell/test_task.js
# Not yet updated
toolkit/components/osfile/**
toolkit/components/passwordmgr/**
-toolkit/components/places/**
# Uses preprocessing
toolkit/content/contentAreaUtils.js
toolkit/content/widgets/videocontrols.xml
toolkit/components/jsdownloads/src/DownloadIntegration.jsm
toolkit/components/search/nsSearchService.js
toolkit/components/url-classifier/**
toolkit/components/urlformatter/nsURLFormatter.js
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -183,30 +183,33 @@ PlacesController.prototype = {
return this._canInsert();
case "placesCmd_new:bookmark":
return this._canInsert();
case "placesCmd_new:separator":
return this._canInsert() &&
!PlacesUtils.asQuery(this._view.result.root).queryOptions.excludeItems &&
this._view.result.sortingMode ==
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
- case "placesCmd_show:info":
- var selectedNode = this._view.selectedNode;
+ case "placesCmd_show:info": {
+ let selectedNode = this._view.selectedNode;
return selectedNode && PlacesUtils.getConcreteItemId(selectedNode) != -1
- case "placesCmd_reload":
+ }
+ case "placesCmd_reload": {
// Livemark containers
- var selectedNode = this._view.selectedNode;
+ let selectedNode = this._view.selectedNode;
return selectedNode && this.hasCachedLivemarkInfo(selectedNode);
- case "placesCmd_sortBy:name":
- var selectedNode = this._view.selectedNode;
+ }
+ case "placesCmd_sortBy:name": {
+ let selectedNode = this._view.selectedNode;
return selectedNode &&
PlacesUtils.nodeIsFolder(selectedNode) &&
!PlacesUIUtils.isContentsReadOnly(selectedNode) &&
this._view.result.sortingMode ==
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
+ }
case "placesCmd_createBookmark":
var node = this._view.selectedNode;
return node && PlacesUtils.nodeIsURI(node) && node.itemId == -1;
default:
return false;
}
},
@@ -958,26 +961,23 @@ PlacesController.prototype = {
else if (PlacesUtils.nodeIsQuery(node) &&
PlacesUtils.asQuery(node).queryOptions.queryType ==
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
this._removeHistoryContainer(node);
}
}
// Do removal in chunks to give some breath to main-thread.
- function pagesChunkGenerator(aURIs) {
+ function* pagesChunkGenerator(aURIs) {
while (aURIs.length) {
let URIslice = aURIs.splice(0, REMOVE_PAGES_CHUNKLEN);
PlacesUtils.bhistory.removePages(URIslice, URIslice.length);
- Services.tm.mainThread.dispatch(function() {
- try {
- gen.next();
- } catch (ex if ex instanceof StopIteration) {}
- }, Ci.nsIThread.DISPATCH_NORMAL);
- yield undefined;
+ Services.tm.mainThread.dispatch(() => gen.next(),
+ Ci.nsIThread.DISPATCH_NORMAL);
+ yield unefined;
}
}
let gen = pagesChunkGenerator(URIs);
gen.next();
},
/**
* Removes history visits for an history container node.
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -361,31 +361,31 @@ var gEditItemOverlay = {
* The value of the LAST_USED_ANNO annotation is the time (in the form of
* Date.getTime) at which the folder has been last used.
*
* First we build the annotated folders array, each item has both the
* folder identifier and the time at which it was last-used by this dialog
* set. Then we sort it descendingly based on the time field.
*/
this._recentFolders = [];
- for (var i = 0; i < folderIds.length; i++) {
+ for (let i = 0; i < folderIds.length; i++) {
var lastUsed = annos.getItemAnnotation(folderIds[i], LAST_USED_ANNO);
this._recentFolders.push({ folderId: folderIds[i], lastUsed: lastUsed });
}
this._recentFolders.sort(function(a, b) {
if (b.lastUsed < a.lastUsed)
return -1;
if (b.lastUsed > a.lastUsed)
return 1;
return 0;
});
var numberOfItems = Math.min(MAX_FOLDER_ITEM_IN_MENU_LIST,
this._recentFolders.length);
- for (var i = 0; i < numberOfItems; i++) {
+ for (let i = 0; i < numberOfItems; i++) {
this._appendFolderItemToMenupopup(menupopup,
this._recentFolders[i].folderId);
}
var defaultItem = this._getFolderMenuItem(aSelectedFolder);
this._folderMenuList.selectedItem = defaultItem;
// Set a selectedIndex attribute to show special icons
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -413,17 +413,17 @@ var PlacesOrganizer = {
let dateSvc = Cc["@mozilla.org/intl/scriptabledateformat;1"].
getService(Ci.nsIScriptableDateFormat);
// Remove existing menu items. Last item is the restoreFromFile item.
while (restorePopup.childNodes.length > 1)
restorePopup.removeChild(restorePopup.firstChild);
- Task.spawn(function() {
+ Task.spawn(function* () {
let backupFiles = yield PlacesBackups.getBackupFiles();
if (backupFiles.length == 0)
return;
// Populate menu with backups.
for (let i = 0; i < backupFiles.length; i++) {
let fileSize = (yield OS.File.stat(backupFiles[i])).size;
let [size, unit] = DownloadUtils.convertByteUnits(fileSize);
@@ -460,28 +460,26 @@ var PlacesOrganizer = {
restorePopup.insertBefore(document.createElement("menuseparator"),
document.getElementById("restoreFromFile"));
});
},
/**
* Called when a menuitem is selected from the restore menu.
*/
- onRestoreMenuItemClick: function PO_onRestoreMenuItemClick(aMenuItem) {
- Task.spawn(function() {
- let backupName = aMenuItem.getAttribute("value");
- let backupFilePaths = yield PlacesBackups.getBackupFiles();
- for (let backupFilePath of backupFilePaths) {
- if (OS.Path.basename(backupFilePath) == backupName) {
- PlacesOrganizer.restoreBookmarksFromFile(backupFilePath);
- break;
- }
+ onRestoreMenuItemClick: Task.async(function* (aMenuItem) {
+ let backupName = aMenuItem.getAttribute("value");
+ let backupFilePaths = yield PlacesBackups.getBackupFiles();
+ for (let backupFilePath of backupFilePaths) {
+ if (OS.Path.basename(backupFilePath) == backupName) {
+ PlacesOrganizer.restoreBookmarksFromFile(backupFilePath);
+ break;
}
- });
- },
+ }
+ }),
/**
* Called when 'Choose File...' is selected from the restore menu.
* Prompts for a file and restores bookmarks to those in the file.
*/
onRestoreBookmarksFromFile: function PO_onRestoreBookmarksFromFile() {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
@@ -516,17 +514,17 @@ var PlacesOrganizer = {
// confirm ok to delete existing bookmarks
var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService);
if (!prompts.confirm(null,
PlacesUIUtils.getString("bookmarksRestoreAlertTitle"),
PlacesUIUtils.getString("bookmarksRestoreAlert")))
return;
- Task.spawn(function() {
+ Task.spawn(function* () {
try {
yield BookmarkJSONUtils.importFromFile(aFilePath, true);
} catch(ex) {
PlacesOrganizer._showErrorAlert(PlacesUIUtils.getString("bookmarksRestoreParseError"));
}
});
},
@@ -628,17 +626,17 @@ var PlacesOrganizer = {
if ((focusedElement instanceof HTMLInputElement ||
focusedElement instanceof HTMLTextAreaElement) &&
/^editBMPanel.*/.test(focusedElement.parentNode.parentNode.id))
focusedElement.blur();
// don't update the panel if we are already editing this node unless we're
// in multi-edit mode
if (selectedNode) {
- var concreteId = PlacesUtils.getConcreteItemId(selectedNode);
+ let concreteId = PlacesUtils.getConcreteItemId(selectedNode);
var nodeIsSame = gEditItemOverlay.itemId == selectedNode.itemId ||
gEditItemOverlay.itemId == concreteId ||
(selectedNode.itemId == -1 && gEditItemOverlay.uri &&
gEditItemOverlay.uri == selectedNode.uri);
if (nodeIsSame && detailsDeck.selectedIndex == 1 &&
!gEditItemOverlay.multiEdit)
return;
}
@@ -648,17 +646,17 @@ var PlacesOrganizer = {
gEditItemOverlay.uninitPanel(false);
if (selectedNode && !PlacesUtils.nodeIsSeparator(selectedNode)) {
detailsDeck.selectedIndex = 1;
// Using the concrete itemId is arguably wrong. The bookmarks API
// does allow setting properties for folder shortcuts as well, but since
// the UI does not distinct between the couple, we better just show
// the concrete item properties for shortcuts to root nodes.
- var concreteId = PlacesUtils.getConcreteItemId(selectedNode);
+ let concreteId = PlacesUtils.getConcreteItemId(selectedNode);
var isRootItem = concreteId != -1 && PlacesUtils.isRootItem(concreteId);
var readOnly = isRootItem ||
selectedNode.parent.itemId == PlacesUIUtils.leftPaneFolderId;
var useConcreteId = isRootItem ||
PlacesUtils.nodeIsTagQuery(selectedNode);
var itemId = -1;
if (concreteId != -1 && useConcreteId)
itemId = concreteId;
@@ -1201,23 +1199,23 @@ var ViewMenu = {
result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
return;
}
var columnId;
if (aColumn) {
columnId = aColumn.getAttribute("anonid");
if (!aDirection) {
- var sortColumn = this._getSortColumn();
+ let sortColumn = this._getSortColumn();
if (sortColumn)
aDirection = sortColumn.getAttribute("sortDirection");
}
}
else {
- var sortColumn = this._getSortColumn();
+ let sortColumn = this._getSortColumn();
columnId = sortColumn ? sortColumn.getAttribute("anonid") : "title";
}
// This maps the possible values of columnId (i.e., anonid's of treecols in
// placeContent) to the default sortingMode and sortingAnnotation values for
// each column.
// key: Sort key in the name of one of the
// nsINavHistoryQueryOptions.SORT_BY_* constants
--- a/browser/components/places/content/tree.xml
+++ b/browser/components/places/content/tree.xml
@@ -234,25 +234,25 @@
while (parent && parent != root) {
parents.push(parent);
parent = parent.parent;
}
// Walk the list backwards (opening from the root of the hierarchy)
// opening each folder as we go.
for (var i = parents.length - 1; i >= 0; --i) {
- var index = view.treeIndexForNode(parents[i]);
+ let index = view.treeIndexForNode(parents[i]);
if (index != Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE &&
view.isContainer(index) && !view.isContainerOpen(index))
view.toggleOpenState(index);
}
// Select the specified node...
}
- var index = view.treeIndexForNode(node);
+ let index = view.treeIndexForNode(node);
if (index == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
return;
view.selection.select(index);
// ... and ensure it's visible, not scrolled off somewhere.
this.treeBoxObject.ensureRowIsVisible(index);
]]></body>
</method>
@@ -654,20 +654,20 @@
// For all the nodes we've found, highlight the corresponding
// index in the tree.
var resultview = this.view;
var selection = this.view.selection;
selection.selectEventsSuppressed = true;
selection.clearSelection();
// Open nodes containing found items
- for (var i = 0; i < nodesToOpen.length; i++) {
+ for (let i = 0; i < nodesToOpen.length; i++) {
nodesToOpen[i].containerOpen = true;
}
- for (var i = 0; i < nodes.length; i++) {
+ for (let i = 0; i < nodes.length; i++) {
var index = resultview.treeIndexForNode(nodes[i]);
if (index == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
continue;
selection.rangedSelect(index, index, true);
}
selection.selectEventsSuppressed = false;
]]></body>
</method>
--- a/browser/components/places/tests/browser/browser_435851_copy_query.js
+++ b/browser/components/places/tests/browser/browser_435851_copy_query.js
@@ -2,17 +2,17 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* test that copying a non movable query or folder shortcut makes a new query with the same url, not a deep copy */
const SHORTCUT_URL = "place:folder=2";
const QUERY_URL = "place:sort=8&maxResults=10";
-add_task(function copy_toolbar_shortcut() {
+add_task(function* copy_toolbar_shortcut() {
let library = yield promiseLibrary();
registerCleanupFunction(function () {
library.close();
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
});
library.PlacesOrganizer.selectLeftPaneQuery("BookmarksToolbar");
@@ -30,17 +30,17 @@ add_task(function copy_toolbar_shortcut(
PlacesUtils.bookmarks.removeItem(toolbarCopyNode.itemId);
library.PlacesOrganizer.selectLeftPaneQuery("BookmarksToolbar");
is(library.PlacesOrganizer._places.selectedNode.type,
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT,
"original is still a folder shortcut");
});
-add_task(function copy_history_query() {
+add_task(function* copy_history_query() {
let library = yield promiseLibrary();
library.PlacesOrganizer.selectLeftPaneQuery("History");
yield promiseClipboard(function () { library.PlacesOrganizer._places.controller.copy(); },
PlacesUtils.TYPE_X_MOZ_PLACE);
library.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
--- a/browser/components/places/tests/browser/browser_bookmarklet_windowOpen.js
+++ b/browser/components/places/tests/browser/browser_bookmarklet_windowOpen.js
@@ -8,17 +8,17 @@ function makeBookmarkFor(url, keyword) {
title: "bookmarklet",
url: url }),
PlacesUtils.keywords.insert({url: url,
keyword: keyword})
]);
}
-add_task(function openKeywordBookmarkWithWindowOpen() {
+add_task(function* openKeywordBookmarkWithWindowOpen() {
// This is the current default, but let's not assume that...
yield new Promise((resolve, reject) => {
SpecialPowers.pushPrefEnv({ 'set': [[ 'browser.link.open_newwindow', 3 ],
[ 'dom.disable_open_during_load', true ]] },
resolve);
});
let moztab;
--- a/browser/components/places/tests/browser/browser_library_infoBox.js
+++ b/browser/components/places/tests/browser/browser_library_infoBox.js
@@ -92,17 +92,17 @@ gTests.push({
"Correctly selected recently bookmarked node.");
PO._places.selectNode(childNode);
checkInfoBoxSelected(PO);
ok(!infoBoxExpanderWrapper.hidden,
"Expander button is not hidden for recently bookmarked node.");
checkAddInfoFieldsNotCollapsed(PO);
// open first bookmark
- var view = ContentTree.view.view;
+ view = ContentTree.view.view;
ok(view.rowCount > 0, "Bookmark item exists.");
view.selection.select(0);
checkInfoBoxSelected(PO);
ok(!infoBoxExpanderWrapper.hidden,
"Expander button is not hidden for bookmark item.");
checkAddInfoFieldsNotCollapsed(PO);
checkAddInfoFields(PO, "bookmark item");
--- a/browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
+++ b/browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
@@ -1,16 +1,16 @@
var bookmarksMenuButton = document.getElementById("bookmarks-menu-button");
var BMB_menuPopup = document.getElementById("BMB_bookmarksPopup");
var BMB_showAllBookmarks = document.getElementById("BMB_bookmarksShowAll");
var contextMenu = document.getElementById("placesContext");
var newBookmarkItem = document.getElementById("placesContext_new:bookmark");
waitForExplicitFinish();
-add_task(function testPopup() {
+add_task(function* testPopup() {
info("Checking popup context menu before moving the bookmarks button");
yield checkPopupContextMenu();
let pos = CustomizableUI.getPlacementOfWidget("bookmarks-menu-button").position;
CustomizableUI.addWidgetToArea("bookmarks-menu-button", CustomizableUI.AREA_PANEL);
CustomizableUI.addWidgetToArea("bookmarks-menu-button", CustomizableUI.AREA_NAVBAR, pos);
info("Checking popup context menu after moving the bookmarks button");
yield checkPopupContextMenu();
});
--- a/toolkit/components/places/BookmarkHTMLUtils.jsm
+++ b/toolkit/components/places/BookmarkHTMLUtils.jsm
@@ -1040,17 +1040,17 @@ BookmarkExporter.prototype = {
this._writeLine("<!-- This is an automatically generated file.");
this._writeLine(" It will be read and overwritten.");
this._writeLine(" DO NOT EDIT! -->");
this._writeLine('<META HTTP-EQUIV="Content-Type" CONTENT="text/html; ' +
'charset=UTF-8">');
this._writeLine("<TITLE>Bookmarks</TITLE>");
},
- _writeContainer: function (aItem, aIndent = "") {
+ *_writeContainer(aItem, aIndent = "") {
if (aItem == this._root) {
this._writeLine("<H1>" + escapeHtmlEntities(this._root.title) + "</H1>");
this._writeLine("");
}
else {
this._write(aIndent + "<DT><H3");
this._writeDateAttributes(aItem);
@@ -1067,28 +1067,29 @@ BookmarkExporter.prototype = {
if (aItem.children)
yield this._writeContainerContents(aItem, aIndent);
if (aItem == this._root)
this._writeLine(aIndent + "</DL>");
else
this._writeLine(aIndent + "</DL><p>");
},
- _writeContainerContents: function (aItem, aIndent) {
+ *_writeContainerContents(aItem, aIndent) {
let localIndent = aIndent + EXPORT_INDENT;
for (let child of aItem.children) {
- if (child.annos && child.annos.some(anno => anno.name == PlacesUtils.LMANNO_FEEDURI))
- this._writeLivemark(child, localIndent);
- else if (child.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER)
- yield this._writeContainer(child, localIndent);
- else if (child.type == PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR)
+ if (child.annos && child.annos.some(anno => anno.name == PlacesUtils.LMANNO_FEEDURI)) {
+ this._writeLivemark(child, localIndent);
+ } else if (child.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER) {
+ yield this._writeContainer(child, localIndent);
+ } else if (child.type == PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR) {
this._writeSeparator(child, localIndent);
- else
+ } else {
yield this._writeItem(child, localIndent);
+ }
}
},
_writeSeparator: function (aItem, aIndent) {
this._write(aIndent + "<HR");
// We keep exporting separator titles, but don't support them anymore.
if (aItem.title)
this._writeAttribute("NAME", escapeHtmlEntities(aItem.title));
@@ -1101,17 +1102,17 @@ BookmarkExporter.prototype = {
this._writeAttribute("FEEDURL", escapeUrl(feedSpec));
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: function (aItem, aIndent) {
+ *_writeItem(aItem, aIndent) {
let uri = null;
try {
uri = NetUtil.newURI(aItem.uri);
} catch (ex) {
// If the item URI is invalid, skip the item instead of failing later.
return;
}
@@ -1140,17 +1141,17 @@ BookmarkExporter.prototype = {
if (aItem.dateAdded)
this._writeAttribute("ADD_DATE",
Math.floor(aItem.dateAdded / MICROSEC_PER_SEC));
if (aItem.lastModified)
this._writeAttribute("LAST_MODIFIED",
Math.floor(aItem.lastModified / MICROSEC_PER_SEC));
},
- _writeFaviconAttribute: function (aItem) {
+ *_writeFaviconAttribute(aItem) {
if (!aItem.iconuri)
return;
let favicon;
try {
favicon = yield PlacesUtils.promiseFaviconData(aItem.uri);
} catch (ex) {
Components.utils.reportError("Unexpected Error trying to fetch icon data");
return;
--- a/toolkit/components/places/PlacesBackups.jsm
+++ b/toolkit/components/places/PlacesBackups.jsm
@@ -448,17 +448,20 @@ this.PlacesBackups = {
try {
let { count: nodeCount, hash: hash } =
yield BookmarkJSONUtils.exportToFile(newBackupFile,
{ compress: true,
failIfHashIs: mostRecentHash });
newFilenameWithMetaData = appendMetaDataToFilename(newBackupFilename,
{ count: nodeCount,
hash: hash });
- } catch (ex if ex.becauseSameHash) {
+ } catch (ex) {
+ if (!ex.becauseSameHash) {
+ throw ex;
+ }
// The last backup already contained up-to-date information, just
// rename it as if it was today's backup.
this._backupFiles.shift();
this._entries.shift();
newBackupFile = mostRecentBackupFile;
// Ensure we retain the proper extension when renaming
// the most recent backup file.
if (/\.json$/.test(OS.Path.basename(mostRecentBackupFile)))
--- a/toolkit/components/places/nsTaggingService.js
+++ b/toolkit/components/places/nsTaggingService.js
@@ -631,17 +631,17 @@ TagAutoCompleteSearch.prototype = {
var newResult = new TagAutoCompleteResult(searchString,
Ci.nsIAutoCompleteResult.RESULT_NOMATCH, 0, "", results, comments);
listener.onSearchResult(self, newResult);
return;
}
var self = this;
// generator: if yields true, not done
- function doSearch() {
+ function* doSearch() {
var i = 0;
while (i < searchResults.length) {
if (self._stopped)
yield false;
// for each match, prepend what the user has typed so far
if (searchResults[i].toLowerCase()
.indexOf(searchString.toLowerCase()) == 0 &&
!comments.includes(searchResults[i])) {
@@ -677,18 +677,17 @@ TagAutoCompleteSearch.prototype = {
var newResult = new TagAutoCompleteResult(searchString, searchResult, 0,
"", results, comments);
listener.onSearchResult(self, newResult);
yield false;
}
// chunk the search results via the generator
var gen = doSearch();
- while (gen.next());
- gen.close();
+ while (gen.next().value);
},
/**
* Stop an asynchronous search that is in progress
*/
stopSearch: function PTACS_stopSearch() {
this._stopped = true;
},
--- a/toolkit/components/places/tests/autocomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/autocomplete/head_autocomplete.js
@@ -261,17 +261,17 @@ function run_test() {
// By default assume we want to match tags
appendTags = true;
// Do an extra function if necessary
if (func)
func();
- Task.spawn(function () {
+ Task.spawn(function* () {
// Iterate over all tasks and execute them
for (let [, [fn, args]] in Iterator(gNextTestSetupTasks)) {
yield fn.apply(this, args);
};
// Clean up to allow tests to register more functions.
gNextTestSetupTasks = [];
@@ -297,17 +297,17 @@ function do_removePages(aURIs)
}
// Utility function to mark pages as typed
function markTyped(aURIs, aTitle)
{
gNextTestSetupTasks.push([task_markTyped, arguments]);
}
-function task_markTyped(aURIs, aTitle)
+function* task_markTyped(aURIs, aTitle)
{
for (let uri of aURIs) {
yield PlacesTestUtils.addVisits({
uri: toURI(kURIs[uri]),
transition: TRANSITION_TYPED,
title: kTitles[aTitle]
});
}
--- a/toolkit/components/places/tests/browser/browser_bug248970.js
+++ b/toolkit/components/places/tests/browser/browser_bug248970.js
@@ -12,17 +12,17 @@ var visitedURIs = [
"http://www.test-bookmark.com/",
"http://www.test-redirect-permanent.com/",
"http://www.test-redirect-temporary.com/",
"http://www.test-embed.com/",
"http://www.test-framed.com/",
"http://www.test-download.com/"
].map(NetUtil.newURI.bind(NetUtil));
-add_task(function () {
+add_task(function* () {
let windowsToClose = [];
let placeItemsCount = 0;
registerCleanupFunction(function() {
windowsToClose.forEach(function(win) {
win.close();
});
});
--- a/toolkit/components/places/tests/expiration/test_debug_expiration.js
+++ b/toolkit/components/places/tests/expiration/test_debug_expiration.js
@@ -67,17 +67,17 @@ add_task(function* test_expire_orphans_o
do_check_eq(visits_in_database("http://page1.mozilla.org/"), 1);
do_check_eq(visits_in_database("http://page2.mozilla.org/"), 1);
do_check_false(page_in_database("http://page3.mozilla.org/"));
// Clean up.
yield PlacesTestUtils.clearHistory();
});
-add_task(function test_expire_limited()
+add_task(function* test_expire_limited()
{
// Add visits to 2 pages and force a single expiration.
// Only 1 page should survive.
yield PlacesTestUtils.addVisits({
uri: uri("http://page1.mozilla.org/"),
visitDate: gNow++
});
yield PlacesTestUtils.addVisits({
@@ -91,17 +91,17 @@ add_task(function test_expire_limited()
// Check that visits to the more recent page survived.
do_check_false(page_in_database("http://page1.mozilla.org/"));
do_check_eq(visits_in_database("http://page2.mozilla.org/"), 1);
// Clean up.
yield PlacesTestUtils.clearHistory();
});
-add_task(function test_expire_unlimited()
+add_task(function* test_expire_unlimited()
{
// Add visits to 2 pages and force a single expiration.
// Only 1 page should survive.
yield PlacesTestUtils.addVisits({
uri: uri("http://page1.mozilla.org/"),
visitDate: gNow++
});
yield PlacesTestUtils.addVisits({
--- a/toolkit/components/places/tests/migration/test_current_from_v19.js
+++ b/toolkit/components/places/tests/migration/test_current_from_v19.js
@@ -29,14 +29,14 @@ add_task(function* initial_state() {
add_task(function* database_is_valid() {
Assert.equal(PlacesUtils.history.databaseStatus,
PlacesUtils.history.DATABASE_STATUS_UPGRADED);
let db = yield PlacesUtils.promiseDBConnection();
Assert.equal((yield db.getSchemaVersion()), CURRENT_SCHEMA_VERSION);
});
-add_task(function test_bookmark_guid_annotation_removed()
+add_task(function* test_bookmark_guid_annotation_removed()
{
let db = yield PlacesUtils.promiseDBConnection();
Assert.equal((yield getTotalGuidAnnotationsCount(db)), 0,
"There should be no more obsolete GUID annotations.");
});
--- a/toolkit/components/places/tests/migration/test_current_from_v24.js
+++ b/toolkit/components/places/tests/migration/test_current_from_v24.js
@@ -8,17 +8,17 @@ add_task(function* setup() {
add_task(function* database_is_valid() {
Assert.equal(PlacesUtils.history.databaseStatus,
PlacesUtils.history.DATABASE_STATUS_UPGRADED);
let db = yield PlacesUtils.promiseDBConnection();
Assert.equal((yield db.getSchemaVersion()), CURRENT_SCHEMA_VERSION);
});
-add_task(function test_bookmark_guid_annotation_removed()
+add_task(function* test_bookmark_guid_annotation_removed()
{
yield PlacesUtils.bookmarks.eraseEverything();
let db = yield PlacesUtils.promiseDBConnection();
let m = new Map([
[PlacesUtils.placesRootId, PlacesUtils.bookmarks.rootGuid],
[PlacesUtils.bookmarksMenuFolderId, PlacesUtils.bookmarks.menuGuid],
[PlacesUtils.toolbarFolderId, PlacesUtils.bookmarks.toolbarGuid],
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -37,17 +37,17 @@ const olderthansixmonths = today - (DAY_
* Generalized function to pull in an array of objects of data and push it into
* the database. It does NOT do any checking to see that the input is
* appropriate. This function is an asynchronous task, it can be called using
* "Task.spawn" or using the "yield" function inside another task.
*/
function* task_populateDB(aArray)
{
// Iterate over aArray and execute all instructions.
- for ([, data] in Iterator(aArray)) {
+ for (let data of aArray) {
try {
// make the data object into a query data object in order to create proper
// default values for anything left unspecified
var qdata = new queryData(data);
if (qdata.isVisit) {
// Then we should add a visit for this node
yield PlacesTestUtils.addVisits({
uri: uri(qdata.uri),
--- a/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
+++ b/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
@@ -153,47 +153,51 @@ add_task(function* pages_searchterm_is_t
{
yield task_populateDB(gTestData);
let [query, options] = newQueryWithOptions();
query.searchTerms = "match";
let root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
compareArrayToResult([], root);
- gTestData.forEach(function (data) {
+ for (let data of gTestData) {
let uri = NetUtil.newURI(data.uri);
let origTitle = data.title;
data.title = "match";
- yield PlacesTestUtils.addVisits({uri: uri, title: data.title});
+ yield PlacesTestUtils.addVisits({ uri: uri, title: data.title,
+ visitDate: data.lastVisit });
compareArrayToResult([data], root);
data.title = origTitle;
- yield PlacesTestUtils.addVisits({uri: uri, title: data.title});
+ yield PlacesTestUtils.addVisits({ uri: uri, title: data.title,
+ visitDate: data.lastVisit });
compareArrayToResult([], root);
- });
+ }
root.containerOpen = false;
yield PlacesTestUtils.clearHistory();
});
add_task(function* visits_searchterm_is_title_query()
{
yield task_populateDB(gTestData);
let [query, options] = newQueryWithOptions();
query.searchTerms = "match";
options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT;
let root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
compareArrayToResult([], root);
- gTestData.forEach(function (data) {
+ for (let data of gTestData) {
let uri = NetUtil.newURI(data.uri);
let origTitle = data.title;
data.title = "match";
- yield PlacesTestUtils.addVisits({uri: uri, title: data.title});
+ yield PlacesTestUtils.addVisits({ uri: uri, title: data.title,
+ visitDate: data.lastVisit });
compareArrayToResult([data], root);
data.title = origTitle;
- yield PlacesTestUtils.addVisits({uri: uri, title: data.title});
+ yield PlacesTestUtils.addVisits({ uri: uri, title: data.title,
+ visitDate: data.lastVisit });
compareArrayToResult([], root);
- });
+ }
root.containerOpen = false;
yield PlacesTestUtils.clearHistory();
});
--- a/toolkit/components/places/tests/queries/test_queryMultipleFolder.js
+++ b/toolkit/components/places/tests/queries/test_queryMultipleFolder.js
@@ -57,9 +57,9 @@ add_task(function* test_queryMultipleFol
rootNode.containerOpen = true;
resultLength = rootNode.childCount;
Assert.equal(resultLength, maxResults);
for (let i = 0; i < resultLength; ++i) {
let node = rootNode.getChild(i);
Assert.equal(bookmarkIds[i], node.itemId, node.uri);
}
rootNode.containerOpen = false;
-});
\ No newline at end of file
+});
--- a/toolkit/components/places/tests/queries/test_sort-date-site-grouping.js
+++ b/toolkit/components/places/tests/queries/test_sort-date-site-grouping.js
@@ -149,26 +149,26 @@ add_task(function* test_sort_date_site_g
// We pass off to |checkFirstLevel| to check the first level of results.
for (let index = 0; index < leveledTestData.length; index++) {
let node = root.getChild(index);
checkFirstLevel(index, node, roots);
}
// Test live updating.
- testDataAddedLater.forEach(function(visit) {
+ for (let visit of testDataAddedLater) {
yield task_populateDB([visit]);
let oldLength = testData.length;
let i = visit.levels[0];
let j = visit.levels[1];
testData.push(visit);
leveledTestData[i][j].push(oldLength);
compareArrayToResult(leveledTestData[i][j].
map(x => testData[x]), roots[i][j]);
- });
+ }
for (let i = 0; i < roots.length; i++) {
for (let j = 0; j < roots[i].length; j++)
roots[i][j].containerOpen = false;
}
root.containerOpen = false;
});
--- a/toolkit/components/places/tests/queries/test_sorting.js
+++ b/toolkit/components/places/tests/queries/test_sorting.js
@@ -6,17 +6,17 @@
var tests = [];
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_NONE,
- setup: function() {
+ *setup() {
do_print("Sorting test 1: SORT BY NONE");
this._unsortedData = [
{ isBookmark: true,
uri: "http://example.com/b",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
title: "y",
@@ -69,17 +69,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 2: SORT BY TITLE");
this._unsortedData = [
{ isBookmark: true,
uri: "http://example.com/b1",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
title: "y",
@@ -144,17 +144,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 3: SORT BY DATE");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isVisit: true,
isDetails: true,
isBookmark: true,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
@@ -244,17 +244,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_URI_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 4: SORT BY URI");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isBookmark: true,
isDetails: true,
lastVisit: timeInMicroseconds,
uri: "http://example.com/b",
@@ -350,17 +350,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 5: SORT BY VISITCOUNT");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isBookmark: true,
uri: "http://example.com/a",
lastVisit: timeInMicroseconds,
title: "z",
@@ -451,17 +451,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 6: SORT BY KEYWORD");
this._unsortedData = [
{ isBookmark: true,
uri: "http://example.com/a",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
title: "z",
@@ -550,17 +550,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 7: SORT BY DATEADDED");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isBookmark: true,
uri: "http://example.com/b1",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0,
@@ -640,17 +640,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 8: SORT BY LASTMODIFIED");
var timeInMicroseconds = Date.now() * 1000;
var timeAddedInMicroseconds = timeInMicroseconds - 10000;
this._unsortedData = [
{ isBookmark: true,
uri: "http://example.com/b1",
@@ -738,17 +738,17 @@ tests.push({
}
});
////////////////////////////////////////////////////////////////////////////////
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_TAGS_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 9: SORT BY TAGS");
this._unsortedData = [
{ isBookmark: true,
uri: "http://url2.com/",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
title: "title x",
@@ -839,17 +839,17 @@ tests.push({
});
////////////////////////////////////////////////////////////////////////////////
// SORT_BY_ANNOTATION_* (int32)
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 10: SORT BY ANNOTATION (int32)");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isVisit: true,
isDetails: true,
lastVisit: timeInMicroseconds,
uri: "http://example.com/b1",
@@ -935,17 +935,17 @@ tests.push({
});
////////////////////////////////////////////////////////////////////////////////
// SORT_BY_ANNOTATION_* (int64)
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 11: SORT BY ANNOTATION (int64)");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isVisit: true,
isDetails: true,
uri: "http://moz.com/",
lastVisit: timeInMicroseconds,
@@ -1017,17 +1017,17 @@ tests.push({
});
////////////////////////////////////////////////////////////////////////////////
// SORT_BY_ANNOTATION_* (string)
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 12: SORT BY ANNOTATION (string)");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isVisit: true,
isDetails: true,
uri: "http://moz.com/",
lastVisit: timeInMicroseconds,
@@ -1099,17 +1099,17 @@ tests.push({
});
////////////////////////////////////////////////////////////////////////////////
// SORT_BY_ANNOTATION_* (double)
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 13: SORT BY ANNOTATION (double)");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isVisit: true,
isDetails: true,
uri: "http://moz.com/",
lastVisit: timeInMicroseconds,
@@ -1181,17 +1181,17 @@ tests.push({
});
////////////////////////////////////////////////////////////////////////////////
// SORT_BY_FRECENCY_*
tests.push({
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_FRECENCY_ASCENDING,
- setup: function() {
+ *setup() {
do_print("Sorting test 13: SORT BY FRECENCY ");
var timeInMicroseconds = Date.now() * 1000;
this._unsortedData = [
{ isVisit: true,
isDetails: true,
uri: "http://moz.com/",
lastVisit: timeInMicroseconds++,
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -444,17 +444,17 @@ function* addTestEngine(basename, httpSe
do_print("Adding engine from URL: " + dataUrl + basename);
Services.search.addEngine(dataUrl + basename, null, null, false);
});
}
// Ensure we have a default search engine and the keyword.enabled preference
// set.
-add_task(function ensure_search_engine() {
+add_task(function* ensure_search_engine() {
// keyword.enabled is necessary for the tests to see keyword searches.
Services.prefs.setBoolPref("keyword.enabled", true);
// Initialize the search service, but first set this geo IP pref to a dummy
// string. When the search service is initialized, it contacts the URI named
// in this pref, which breaks the test since outside connections aren't
// allowed.
let geoPref = "browser.search.geoip.url";
--- a/toolkit/components/places/tests/unifiedcomplete/test_autoFill_default_behavior.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_autoFill_default_behavior.js
@@ -68,17 +68,17 @@ add_task(function* test_default_behavior
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
// We are not restricting on typed, so we autoFill the bookmark even if we
// are restricted to history. We accept that cause not doing that
// would be a perf hit and the privacy implications are very weak.
do_print("Restrict history, bookmark, autoFill.typed = false, should autoFill");
yield check_autocomplete({
search: "bo",
- matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ], style: [ "autofill", "heuristic" ],
+ matches: [ { uri: uri3, title: "bookmarked", style: [ "autofill", "heuristic" ],
icon: "chrome://global/skin/icons/error-16.png" } ],
autofilled: "bookmarked/",
completed: "bookmarked/"
});
do_print("Restrict history, common visit, autoFill.typed = false, should autoFill");
yield check_autocomplete({
search: "vi",
--- a/toolkit/components/places/tests/unit/test_420331_wyciwyg.js
+++ b/toolkit/components/places/tests/unit/test_420331_wyciwyg.js
@@ -12,12 +12,15 @@ function run_test()
add_task(function* test_execute()
{
var testURI = uri("wyciwyg://nodontjudgeabookbyitscover");
try
{
yield PlacesTestUtils.addVisits(testURI);
do_throw("Should have generated an exception.");
- } catch (ex if ex && ex.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
+ } catch (ex) {
+ if (ex.result != Cr.NS_ERROR_ILLEGAL_VALUE) {
+ throw ex;
+ }
// Adding wyciwyg URIs should raise NS_ERROR_ILLEGAL_VALUE.
}
});
--- a/toolkit/components/places/tests/unit/test_425563.js
+++ b/toolkit/components/places/tests/unit/test_425563.js
@@ -37,22 +37,22 @@ add_task(function* test_execute()
transition: TRANSITION_REDIRECT_PERMANENT },
{ uri: uri("http://www.test-redirect-temporary.com/"),
transition: TRANSITION_REDIRECT_TEMPORARY },
{ uri: uri("http://www.test-download.com/"),
transition: TRANSITION_DOWNLOAD },
]);
// check that all links are marked as visited
- count_visited_URIs.forEach(function (visited_uri) {
+ for (let visited_uri of count_visited_URIs) {
do_check_true(yield promiseIsURIVisited(uri(visited_uri)));
- });
- notcount_visited_URIs.forEach(function (visited_uri) {
+ }
+ for (let visited_uri of notcount_visited_URIs) {
do_check_true(yield promiseIsURIVisited(uri(visited_uri)));
- });
+ }
// check that visit_count does not take in count embed and downloads
// maxVisits query are directly binded to visit_count
let options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = options.SORT_BY_VISITCOUNT_DESCENDING;
options.resultType = options.RESULTS_AS_VISIT;
options.includeHidden = true;
let query = PlacesUtils.history.getNewQuery();
--- a/toolkit/components/places/tests/unit/test_486978_sort_by_date_queries.js
+++ b/toolkit/components/places/tests/unit/test_486978_sort_by_date_queries.js
@@ -32,17 +32,18 @@ function run_test()
}
add_task(function* test_initialize()
{
var noon = new Date();
noon.setHours(12);
// Add visits.
- for ([pageIndex, page] in Iterator(pages)) {
+ for (let pageIndex = 0; pageIndex < pages.length; ++pageIndex) {
+ let page = pages[pageIndex];
yield PlacesTestUtils.addVisits({
uri: uri(page),
visitDate: noon - (pages.length - pageIndex) * 1000
});
}
});
/**
--- a/toolkit/components/places/tests/unit/test_async_history_api.js
+++ b/toolkit/components/places/tests/unit/test_async_history_api.js
@@ -366,17 +366,20 @@ add_task(function* test_non_addable_uri_
uri: NetUtil.newURI(url),
title: "test for " + url,
visits: [
new VisitInfo(),
],
};
places.push(place);
}
- catch (e if e.result === Cr.NS_ERROR_FAILURE) {
+ catch (e) {
+ if (e.result != Cr.NS_ERROR_FAILURE) {
+ throw e;
+ }
// NetUtil.newURI() can throw if e.g. our app knows about imap://
// but the account is not set up and so the URL is invalid for us.
// Note this in the log but ignore as it's not the subject of this test.
do_print("Could not construct URI for '" + url + "'; ignoring");
}
});
let placesResult = yield promiseUpdatePlaces(places);
@@ -1075,17 +1078,20 @@ add_task(function* test_callbacks_not_su
uri: NetUtil.newURI(url),
title: "test for " + url,
visits: [
new VisitInfo(),
],
};
places.push(place);
}
- catch (e if e.result === Cr.NS_ERROR_FAILURE) {
+ catch (e) {
+ if (e.result != Cr.NS_ERROR_FAILURE) {
+ throw e;
+ }
// NetUtil.newURI() can throw if e.g. our app knows about imap://
// but the account is not set up and so the URL is invalid for us.
// Note this in the log but ignore as it's not the subject of this test.
do_print("Could not construct URI for '" + url + "'; ignoring");
}
});
PlacesUtils.asyncHistory.updatePlaces(places, {});
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -322,17 +322,17 @@ function* ensureBookmarksTreeRestoredCor
function* ensureNonExistent(...aGuids) {
for (let guid of aGuids) {
Assert.strictEqual((yield PlacesUtils.promiseBookmarksTree(guid)), null);
}
}
add_task(function* test_recycled_transactions() {
- function ensureTransactThrowsFor(aTransaction) {
+ function* ensureTransactThrowsFor(aTransaction) {
let [txns, undoPosition] = getTransactionsHistoryState();
try {
yield aTransaction.transact();
do_throw("Shouldn't be able to use the same transaction twice");
}
catch(ex) { }
ensureUndoState(txns, undoPosition);
}
--- a/toolkit/components/places/tests/unit/test_bookmarks_html.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html.js
@@ -298,17 +298,17 @@ function* testImportedBookmarks()
root.containerOpen = false;
}
}
function* checkItem(aExpected, aNode)
{
let id = aNode.itemId;
- return Task.spawn(function() {
+ return Task.spawn(function* () {
for (prop in aExpected) {
switch (prop) {
case "type":
do_check_eq(aNode.type, aExpected.type);
break;
case "title":
do_check_eq(aNode.title, aExpected.title);
break;
--- a/toolkit/components/places/tests/unit/test_bookmarks_json.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_json.js
@@ -140,17 +140,17 @@ function* testImportedBookmarks() {
root.containerOpen = false;
}
}
function* checkItem(aExpected, aNode) {
let id = aNode.itemId;
- return Task.spawn(function() {
+ return Task.spawn(function* () {
for (prop in aExpected) {
switch (prop) {
case "type":
do_check_eq(aNode.type, aExpected.type);
break;
case "title":
do_check_eq(aNode.title, aExpected.title);
break;
--- a/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js
@@ -42,190 +42,176 @@ var uris = [
// run: a method that actually runs the test
var tests = [
{
desc: "JSON restore: normal restore should succeed",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_SUCCESS,
data: NSIOBSERVER_DATA_JSON,
folderId: null,
- run: function () {
- Task.spawn(function () {
- this.file = yield promiseFile("bookmarks-test_restoreNotification.json");
- addBookmarks();
+ run: Task.async(function* () {
+ this.file = yield promiseFile("bookmarks-test_restoreNotification.json");
+ addBookmarks();
- yield BookmarkJSONUtils.exportToFile(this.file);
- yield PlacesUtils.bookmarks.eraseEverything();
- try {
- yield BookmarkJSONUtils.importFromFile(this.file, true);
- }
- catch (e) {
- do_throw(" Restore should not have failed");
- }
- }.bind(this));
- }
+ yield BookmarkJSONUtils.exportToFile(this.file);
+ yield PlacesUtils.bookmarks.eraseEverything();
+ try {
+ yield BookmarkJSONUtils.importFromFile(this.file, true);
+ }
+ catch (e) {
+ do_throw(" Restore should not have failed");
+ }
+ })
},
{
desc: "JSON restore: empty file should succeed",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_SUCCESS,
data: NSIOBSERVER_DATA_JSON,
folderId: null,
- run: function () {
- Task.spawn(function() {
- this.file = yield promiseFile("bookmarks-test_restoreNotification.json");
- try {
- yield BookmarkJSONUtils.importFromFile(this.file, true);
- }
- catch (e) {
- do_throw(" Restore should not have failed" + e);
- }
- }.bind(this));
- }
+ run: Task.async(function* () {
+ this.file = yield promiseFile("bookmarks-test_restoreNotification.json");
+ try {
+ yield BookmarkJSONUtils.importFromFile(this.file, true);
+ }
+ catch (e) {
+ do_throw(" Restore should not have failed" + e);
+ }
+ })
},
{
desc: "JSON restore: nonexistent file should fail",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_FAILED,
data: NSIOBSERVER_DATA_JSON,
folderId: null,
- run: function () {
+ run: Task.async(function* () {
this.file = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
this.file.append("this file doesn't exist because nobody created it 1");
- Task.spawn(function() {
- try {
- yield BookmarkJSONUtils.importFromFile(this.file, true);
- do_throw(" Restore should have failed");
- }
- catch (e) {
- }
- }.bind(this));
- }
+ try {
+ yield BookmarkJSONUtils.importFromFile(this.file, true);
+ do_throw(" Restore should have failed");
+ }
+ catch (e) {
+ }
+ })
},
{
desc: "HTML restore: normal restore should succeed",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_SUCCESS,
data: NSIOBSERVER_DATA_HTML,
folderId: null,
- run: function () {
- Task.spawn(function() {
- this.file = yield promiseFile("bookmarks-test_restoreNotification.html");
- addBookmarks();
- yield BookmarkHTMLUtils.exportToFile(this.file);
- yield PlacesUtils.bookmarks.eraseEverything();
- try {
- BookmarkHTMLUtils.importFromFile(this.file, false)
- .then(null, do_report_unexpected_exception);
- }
- catch (e) {
- do_throw(" Restore should not have failed");
- }
- }.bind(this));
- }
+ run: Task.async(function* () {
+ this.file = yield promiseFile("bookmarks-test_restoreNotification.html");
+ addBookmarks();
+ yield BookmarkHTMLUtils.exportToFile(this.file);
+ yield PlacesUtils.bookmarks.eraseEverything();
+ try {
+ BookmarkHTMLUtils.importFromFile(this.file, false)
+ .then(null, do_report_unexpected_exception);
+ }
+ catch (e) {
+ do_throw(" Restore should not have failed");
+ }
+ })
},
{
desc: "HTML restore: empty file should succeed",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_SUCCESS,
data: NSIOBSERVER_DATA_HTML,
folderId: null,
- run: function () {
- Task.spawn(function (){
- this.file = yield promiseFile("bookmarks-test_restoreNotification.init.html");
- try {
- BookmarkHTMLUtils.importFromFile(this.file, false)
- .then(null, do_report_unexpected_exception);
- }
- catch (e) {
- do_throw(" Restore should not have failed");
- }
- }.bind(this));
- }
+ run: Task.async(function* () {
+ this.file = yield promiseFile("bookmarks-test_restoreNotification.init.html");
+ try {
+ BookmarkHTMLUtils.importFromFile(this.file, false)
+ .then(null, do_report_unexpected_exception);
+ }
+ catch (e) {
+ do_throw(" Restore should not have failed");
+ }
+ })
},
{
desc: "HTML restore: nonexistent file should fail",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_FAILED,
data: NSIOBSERVER_DATA_HTML,
folderId: null,
- run: Task.async(function* () {
+ run: Task.async(function* () {
this.file = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
this.file.append("this file doesn't exist because nobody created it 2");
try {
yield BookmarkHTMLUtils.importFromFile(this.file, false);
do_throw("Should fail!");
}
catch (e) {}
- }.bind(this))
+ })
},
{
desc: "HTML initial restore: normal restore should succeed",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_SUCCESS,
data: NSIOBSERVER_DATA_HTML_INIT,
folderId: null,
- run: function () {
- Task.spawn(function () {
- this.file = yield promiseFile("bookmarks-test_restoreNotification.init.html");
- addBookmarks();
- yield BookmarkHTMLUtils.exportToFile(this.file);
- yield PlacesUtils.bookmarks.eraseEverything();
- try {
- BookmarkHTMLUtils.importFromFile(this.file, true)
- .then(null, do_report_unexpected_exception);
- }
- catch (e) {
- do_throw(" Restore should not have failed");
- }
- }.bind(this));
- }
+ run: Task.async(function* () {
+ this.file = yield promiseFile("bookmarks-test_restoreNotification.init.html");
+ addBookmarks();
+ yield BookmarkHTMLUtils.exportToFile(this.file);
+ yield PlacesUtils.bookmarks.eraseEverything();
+ try {
+ BookmarkHTMLUtils.importFromFile(this.file, true)
+ .then(null, do_report_unexpected_exception);
+ }
+ catch (e) {
+ do_throw(" Restore should not have failed");
+ }
+ })
},
{
desc: "HTML initial restore: empty file should succeed",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_SUCCESS,
data: NSIOBSERVER_DATA_HTML_INIT,
folderId: null,
- run: function () {
- Task.spawn(function () {
- this.file = yield promiseFile("bookmarks-test_restoreNotification.init.html");
- try {
- BookmarkHTMLUtils.importFromFile(this.file, true)
- .then(null, do_report_unexpected_exception);
- }
- catch (e) {
- do_throw(" Restore should not have failed");
- }
- }.bind(this));
- }
+ run: Task.async(function* () {
+ this.file = yield promiseFile("bookmarks-test_restoreNotification.init.html");
+ try {
+ BookmarkHTMLUtils.importFromFile(this.file, true)
+ .then(null, do_report_unexpected_exception);
+ }
+ catch (e) {
+ do_throw(" Restore should not have failed");
+ }
+ })
},
{
desc: "HTML initial restore: nonexistent file should fail",
currTopic: NSIOBSERVER_TOPIC_BEGIN,
finalTopic: NSIOBSERVER_TOPIC_FAILED,
data: NSIOBSERVER_DATA_HTML_INIT,
folderId: null,
- run: Task.async(function* () {
+ run: Task.async(function* () {
this.file = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
this.file.append("this file doesn't exist because nobody created it 3");
try {
yield BookmarkHTMLUtils.importFromFile(this.file, true);
do_throw("Should fail!");
}
catch (e) {}
- }.bind(this))
+ })
}
];
// nsIObserver that observes bookmarks-restore-begin.
var beginObserver = {
observe: function _beginObserver(aSubject, aTopic, aData) {
var test = tests[currTestIndex];
--- a/toolkit/components/places/tests/unit/test_frecency.js
+++ b/toolkit/components/places/tests/unit/test_frecency.js
@@ -117,17 +117,17 @@ try {
var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
getService(Ci.nsITaggingService);
var bmksvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
} catch(ex) {
do_throw("Could not get history service\n");
}
-function task_setCountDate(aURI, aCount, aDate)
+function* task_setCountDate(aURI, aCount, aDate)
{
// We need visits so that frecency can be computed over multiple visits
let visits = [];
for (let i = 0; i < aCount; i++) {
visits.push({ uri: aURI, visitDate: aDate, transition: TRANSITION_TYPED });
}
yield PlacesTestUtils.addVisits(visits);
}
--- a/toolkit/components/places/tests/unit/test_history_observer.js
+++ b/toolkit/components/places/tests/unit/test_history_observer.js
@@ -34,29 +34,25 @@ function onNotify(callback) {
};
PlacesUtils.history.addObserver(obs, false);
return deferred.promise;
}
/**
* Asynchronous task that adds a visit to the history database.
*/
-function task_add_visit(uri, timestamp, transition) {
+function* task_add_visit(uri, timestamp, transition) {
uri = uri || NetUtil.newURI("http://firefox.com/");
timestamp = timestamp || Date.now() * 1000;
yield PlacesTestUtils.addVisits({
uri: uri,
transition: transition || TRANSITION_TYPED,
visitDate: timestamp
});
- throw new Task.Result([uri, timestamp]);
-}
-
-function run_test() {
- run_next_test();
+ return [uri, timestamp];
}
add_task(function* test_onVisit() {
let promiseNotify = onNotify(function onVisit(aURI, aVisitID, aTime,
aSessionID, aReferringID,
aTransitionType, aGUID,
aHidden) {
do_check_true(aURI.equals(testuri));
--- a/toolkit/components/places/tests/unit/test_hosts_triggers.js
+++ b/toolkit/components/places/tests/unit/test_hosts_triggers.js
@@ -145,17 +145,17 @@ add_task(function* test_moz_hosts_typed_
yield PlacesTestUtils.addVisits(places);
do_check_true(isHostInMozHosts(TEST_URI, true, null));
yield PlacesTestUtils.clearHistory();
});
add_task(function* test_moz_hosts_www_remove()
{
- function test_removal(aURIToRemove, aURIToKeep, aCallback) {
+ function* test_removal(aURIToRemove, aURIToKeep, aCallback) {
let places = [{ uri: aURIToRemove
, title: "test for " + aURIToRemove.spec
, transition: TRANSITION_TYPED
},
{ uri: aURIToKeep
, title: "test for " + aURIToKeep.spec
, transition: TRANSITION_TYPED
}];
--- a/toolkit/components/places/tests/unit/test_isvisited.js
+++ b/toolkit/components/places/tests/unit/test_isvisited.js
@@ -60,15 +60,18 @@ add_task(function* test_execute()
// but the account is not set up and so the URL is invalid for us.
// Note this in the log but ignore as it's not the subject of this test.
do_print("Could not construct URI for '" + currentURL + "'; ignoring");
}
if (cantAddUri) {
try {
yield PlacesTestUtils.addVisits({uri: cantAddUri, referrer: referrer});
do_throw("Should have generated an exception.");
- } catch(ex if ex && ex.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
+ } catch(ex) {
+ if (ex.result != Cr.NS_ERROR_ILLEGAL_VALUE) {
+ throw ex;
+ }
}
do_check_false(yield promiseIsURIVisited(cantAddUri));
}
}
});
--- a/toolkit/components/places/tests/unit/test_null_interfaces.js
+++ b/toolkit/components/places/tests/unit/test_null_interfaces.js
@@ -63,29 +63,29 @@ function run_test()
func.apply(s, args);
do_print(`The function did not throw! Is it one of the nothrow? ${nothrow}`);
Assert.notEqual(nothrow.indexOf(n), -1);
do_print("Must have been an expected nothrow, so no need to try again");
tryAgain = false;
}
- catch(ex if ex.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
- do_print(`Caught an expected exception: ${ex.name}`);
-
- do_print("Moving on to the next test..");
- tryAgain = false;
- }
- catch(ex if ex.result == Cr.NS_ERROR_XPC_NEED_OUT_OBJECT) {
- let pos = Number(ex.message.match(/object arg (\d+)/)[1]);
- do_print(`Function call expects an out object at ${pos}`);
- args[pos] = {};
- }
- catch(ex if ex.result == Cr.NS_ERROR_NOT_IMPLEMENTED) {
- do_print(`Method not implemented exception: ${ex.name}`);
-
- do_print("Moving on to the next test..");
- tryAgain = false;
+ catch(ex) {
+ if (ex.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
+ do_print(`Caught an expected exception: ${ex.name}`);
+ do_print("Moving on to the next test..");
+ tryAgain = false;
+ } else if (ex.result == Cr.NS_ERROR_XPC_NEED_OUT_OBJECT) {
+ let pos = Number(ex.message.match(/object arg (\d+)/)[1]);
+ do_print(`Function call expects an out object at ${pos}`);
+ args[pos] = {};
+ } else if (ex.result == Cr.NS_ERROR_NOT_IMPLEMENTED) {
+ do_print(`Method not implemented exception: ${ex.name}`);
+ do_print("Moving on to the next test..");
+ tryAgain = false;
+ } else {
+ throw ex;
+ }
}
}
}
}
}
--- a/toolkit/components/places/tests/unit/test_preventive_maintenance.js
+++ b/toolkit/components/places/tests/unit/test_preventive_maintenance.js
@@ -1069,17 +1069,17 @@ tests.push({
});
//------------------------------------------------------------------------------
tests.push({
name: "L.2",
desc: "Recalculate visit_count and last_visit_date",
- setup: function() {
+ setup: function* () {
function setVisitCount(aURL, aValue) {
let stmt = mDBConn.createStatement(
"UPDATE moz_places SET visit_count = :count WHERE url = :url"
);
stmt.params.count = aValue;
stmt.params.url = aURL;
stmt.execute();
stmt.finalize();
@@ -1262,17 +1262,17 @@ tests.push({
//------------------------------------------------------------------------------
// main
function run_test()
{
run_next_test();
}
-add_task(function test_preventive_maintenance()
+add_task(function* test_preventive_maintenance()
{
// Force initialization of the bookmarks hash. This test could cause
// it to go out of sync due to direct queries on the database.
yield PlacesTestUtils.addVisits(uri("http://force.bookmarks.hash"));
do_check_false(bs.isBookmarked(uri("http://force.bookmarks.hash")));
// Get current bookmarks max ID for cleanup
let stmt = mDBConn.createStatement("SELECT MAX(id) FROM moz_bookmarks");
--- a/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
+++ b/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
@@ -206,27 +206,27 @@ function* test_promiseBookmarksTreeAgain
yield PlacesUtils.promiseItemId(aItemGuid) : PlacesUtils.placesRootId;
let node = PlacesUtils.getFolderContents(itemId).root;
return yield test_promiseBookmarksTreeForEachNode(node, aOptions, aExcludedGuids);
}
add_task(function* () {
// Add some bookmarks to cover various use cases.
yield new_bookmark({ parentGuid: PlacesUtils.bookmarks.toolbarGuid });
- yield new_folder({ parentGuid: PlacesUtils.bookmarks.menuGuid
- , annotations: [{ name: "TestAnnoA", value: "TestVal"
- , name: "TestAnnoB", value: 0 }]});
+ yield new_folder({ parentGuid: PlacesUtils.bookmarks.menuGuid,
+ annotations: [{ name: "TestAnnoA", value: "TestVal" },
+ { name: "TestAnnoB", value: 0 }]});
let sepInfo = { parentGuid: PlacesUtils.bookmarks.menuGuid };
yield PlacesTransactions.NewSeparator(sepInfo).transact();
let folderGuid = yield new_folder({ parentGuid: PlacesUtils.bookmarks.menuGuid });
- yield new_bookmark({ title: null
- , parentGuid: folderGuid
- , keyword: "test_keyword"
- , tags: ["TestTagA", "TestTagB"]
- , annotations: [{ name: "TestAnnoA", value: "TestVal2"}]});
+ yield new_bookmark({ title: null,
+ parentGuid: folderGuid,
+ keyword: "test_keyword",
+ tags: ["TestTagA", "TestTagB"],
+ annotations: [{ name: "TestAnnoA", value: "TestVal2"}]});
let urlWithCharsetAndFavicon = uri("http://charset.and.favicon");
yield new_bookmark({ parentGuid: folderGuid, url: urlWithCharsetAndFavicon });
yield PlacesUtils.setCharsetForURI(urlWithCharsetAndFavicon, "UTF-8");
yield promiseSetIconForPage(urlWithCharsetAndFavicon, SMALLPNG_DATA_URI);
// Test the default places root without specifying it.
yield test_promiseBookmarksTreeAgainstResult();
// Do specify it
--- a/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
+++ b/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
@@ -10,17 +10,17 @@ const PLACE_URI = uri("place:queryType=0
function* cleanup() {
yield PlacesTestUtils.clearHistory();
yield PlacesUtils.bookmarks.eraseEverything();
// This is needed to remove place: entries.
DBConn().executeSimpleSQL("DELETE FROM moz_places");
}
-add_task(function remove_visits_outside_unbookmarked_uri() {
+add_task(function* remove_visits_outside_unbookmarked_uri() {
do_print("*** TEST: Remove some visits outside valid timeframe from an unbookmarked URI");
do_print("Add 10 visits for the URI from way in the past.");
let visits = [];
for (let i = 0; i < 10; i++) {
visits.push({ uri: TEST_URI, visitDate: NOW - 1000 - i });
}
yield PlacesTestUtils.addVisits(visits);
@@ -51,17 +51,17 @@ add_task(function remove_visits_outside_
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Frecency should be positive.")
do_check_true(frecencyForUrl(TEST_URI) > 0);
yield cleanup();
});
-add_task(function remove_visits_outside_bookmarked_uri() {
+add_task(function* remove_visits_outside_bookmarked_uri() {
do_print("*** TEST: Remove some visits outside valid timeframe from a bookmarked URI");
do_print("Add 10 visits for the URI from way in the past.");
let visits = [];
for (let i = 0; i < 10; i++) {
visits.push({ uri: TEST_URI, visitDate: NOW - 1000 - i });
}
yield PlacesTestUtils.addVisits(visits);
@@ -98,17 +98,17 @@ add_task(function remove_visits_outside_
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Frecency should be positive.")
do_check_true(frecencyForUrl(TEST_URI) > 0);
yield cleanup();
});
-add_task(function remove_visits_unbookmarked_uri() {
+add_task(function* remove_visits_unbookmarked_uri() {
do_print("*** TEST: Remove some visits from an unbookmarked URI");
do_print("Add 10 visits for the URI from now to 9 usecs in the past.");
let visits = [];
for (let i = 0; i < 10; i++) {
visits.push({ uri: TEST_URI, visitDate: NOW - i });
}
yield PlacesTestUtils.addVisits(visits);
@@ -139,17 +139,17 @@ add_task(function remove_visits_unbookma
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Frecency should be positive.")
do_check_true(frecencyForUrl(TEST_URI) > 0);
yield cleanup();
});
-add_task(function remove_visits_bookmarked_uri() {
+add_task(function* remove_visits_bookmarked_uri() {
do_print("*** TEST: Remove some visits from a bookmarked URI");
do_print("Add 10 visits for the URI from now to 9 usecs in the past.");
let visits = [];
for (let i = 0; i < 10; i++) {
visits.push({ uri: TEST_URI, visitDate: NOW - i });
}
yield PlacesTestUtils.addVisits(visits);
@@ -186,17 +186,17 @@ add_task(function remove_visits_bookmark
yield PlacesTestUtils.promiseAsyncUpdates()
do_print("Frecency should be positive.")
do_check_true(frecencyForUrl(TEST_URI) > 0);
yield cleanup();
});
-add_task(function remove_all_visits_unbookmarked_uri() {
+add_task(function* remove_all_visits_unbookmarked_uri() {
do_print("*** TEST: Remove all visits from an unbookmarked URI");
do_print("Add some visits for the URI.");
let visits = [];
for (let i = 0; i < 10; i++) {
visits.push({ uri: TEST_URI, visitDate: NOW - i });
}
yield PlacesTestUtils.addVisits(visits);
@@ -219,17 +219,17 @@ add_task(function remove_all_visits_unbo
root.containerOpen = false;
do_print("asyncHistory.isURIVisited should return false.");
do_check_false(yield promiseIsURIVisited(TEST_URI));
yield cleanup();
});
-add_task(function remove_all_visits_unbookmarked_place_uri() {
+add_task(function* remove_all_visits_unbookmarked_place_uri() {
do_print("*** TEST: Remove all visits from an unbookmarked place: URI");
do_print("Add some visits for the URI.");
let visits = [];
for (let i = 0; i < 10; i++) {
visits.push({ uri: PLACE_URI, visitDate: NOW - i });
}
yield PlacesTestUtils.addVisits(visits);
@@ -255,17 +255,17 @@ add_task(function remove_all_visits_unbo
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Frecency should be zero.")
do_check_eq(frecencyForUrl(PLACE_URI.spec), 0);
yield cleanup();
});
-add_task(function remove_all_visits_bookmarked_uri() {
+add_task(function* remove_all_visits_bookmarked_uri() {
do_print("*** TEST: Remove all visits from a bookmarked URI");
do_print("Add some visits for the URI.");
let visits = [];
for (let i = 0; i < 10; i++) {
visits.push({ uri: TEST_URI, visitDate: NOW - i });
}
yield PlacesTestUtils.addVisits(visits);
@@ -301,17 +301,17 @@ add_task(function remove_all_visits_book
yield PlacesTestUtils.promiseAsyncUpdates();
do_print("Frecency should be negative.")
do_check_true(frecencyForUrl(TEST_URI) < 0);
yield cleanup();
});
-add_task(function remove_all_visits_bookmarked_uri() {
+add_task(function* remove_all_visits_bookmarked_uri() {
do_print("*** TEST: Remove some visits from a zero frecency URI retains zero frecency");
do_print("Add some visits for the URI.");
yield PlacesTestUtils.addVisits([
{ uri: TEST_URI, transition: TRANSITION_FRAMED_LINK, visitDate: (NOW - 86400000000) },
{ uri: TEST_URI, transition: TRANSITION_FRAMED_LINK, visitDate: NOW }
]);
@@ -321,12 +321,8 @@ add_task(function remove_all_visits_book
do_print("URI should still exist in moz_places.");
do_check_true(page_in_database(TEST_URI.spec));
do_print("Frecency should be zero.")
do_check_eq(frecencyForUrl(TEST_URI), 0);
yield cleanup();
});
-
-function run_test() {
- run_next_test();
-}