mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1230471 - Basic eslint fixes in places. r=mconley
--HG-- extra : commitid : 3qDaDd3cKSc extra : rebase_source : 8dc99f1b7dc0bb7bb7b9059ff4d8527685a50291
This commit is contained in:
parent
47e1d126ba
commit
7eb562e238
@ -73,7 +73,6 @@ browser/components/downloads/**
|
||||
browser/components/feeds/**
|
||||
browser/components/migration/**
|
||||
browser/components/*.js
|
||||
browser/components/places/**
|
||||
browser/components/pocket/**
|
||||
browser/components/preferences/**
|
||||
browser/components/privatebrowsing/**
|
||||
@ -162,7 +161,6 @@ 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
|
||||
|
@ -188,20 +188,23 @@ PlacesController.prototype = {
|
||||
!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;
|
||||
@ -963,16 +966,13 @@ PlacesController.prototype = {
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
@ -366,7 +366,7 @@ var gEditItemOverlay = {
|
||||
* 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 });
|
||||
}
|
||||
@ -380,7 +380,7 @@ var gEditItemOverlay = {
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ var PlacesOrganizer = {
|
||||
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;
|
||||
@ -465,18 +465,16 @@ var PlacesOrganizer = {
|
||||
/**
|
||||
* 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.
|
||||
@ -521,7 +519,7 @@ var PlacesOrganizer = {
|
||||
PlacesUIUtils.getString("bookmarksRestoreAlert")))
|
||||
return;
|
||||
|
||||
Task.spawn(function() {
|
||||
Task.spawn(function* () {
|
||||
try {
|
||||
yield BookmarkJSONUtils.importFromFile(aFilePath, true);
|
||||
} catch(ex) {
|
||||
@ -633,7 +631,7 @@ var PlacesOrganizer = {
|
||||
// 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 &&
|
||||
@ -653,7 +651,7 @@ var PlacesOrganizer = {
|
||||
// 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;
|
||||
@ -1206,13 +1204,13 @@ var ViewMenu = {
|
||||
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";
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@
|
||||
// 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);
|
||||
@ -247,7 +247,7 @@
|
||||
// Select the specified node...
|
||||
}
|
||||
|
||||
var index = view.treeIndexForNode(node);
|
||||
let index = view.treeIndexForNode(node);
|
||||
if (index == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
|
||||
return;
|
||||
|
||||
@ -659,10 +659,10 @@
|
||||
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;
|
||||
|
@ -7,7 +7,7 @@
|
||||
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 () {
|
||||
@ -35,7 +35,7 @@ add_task(function copy_toolbar_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");
|
||||
|
@ -13,7 +13,7 @@ function makeBookmarkFor(url, 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 ],
|
||||
|
@ -97,7 +97,7 @@ gTests.push({
|
||||
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);
|
||||
|
@ -5,7 +5,7 @@ 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;
|
||||
|
@ -1045,7 +1045,7 @@ BookmarkExporter.prototype = {
|
||||
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("");
|
||||
@ -1072,18 +1072,19 @@ BookmarkExporter.prototype = {
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -1106,7 +1107,7 @@ BookmarkExporter.prototype = {
|
||||
this._writeDescription(aItem, aIndent);
|
||||
},
|
||||
|
||||
_writeItem: function (aItem, aIndent) {
|
||||
*_writeItem(aItem, aIndent) {
|
||||
let uri = null;
|
||||
try {
|
||||
uri = NetUtil.newURI(aItem.uri);
|
||||
@ -1145,7 +1146,7 @@ BookmarkExporter.prototype = {
|
||||
Math.floor(aItem.lastModified / MICROSEC_PER_SEC));
|
||||
},
|
||||
|
||||
_writeFaviconAttribute: function (aItem) {
|
||||
*_writeFaviconAttribute(aItem) {
|
||||
if (!aItem.iconuri)
|
||||
return;
|
||||
let favicon;
|
||||
|
@ -453,7 +453,10 @@ this.PlacesBackups = {
|
||||
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();
|
||||
|
@ -636,7 +636,7 @@ TagAutoCompleteSearch.prototype = {
|
||||
|
||||
var self = this;
|
||||
// generator: if yields true, not done
|
||||
function doSearch() {
|
||||
function* doSearch() {
|
||||
var i = 0;
|
||||
while (i < searchResults.length) {
|
||||
if (self._stopped)
|
||||
@ -682,8 +682,7 @@ TagAutoCompleteSearch.prototype = {
|
||||
|
||||
// chunk the search results via the generator
|
||||
var gen = doSearch();
|
||||
while (gen.next());
|
||||
gen.close();
|
||||
while (gen.next().value);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -266,7 +266,7 @@ function run_test() {
|
||||
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);
|
||||
@ -302,7 +302,7 @@ 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({
|
||||
|
@ -17,7 +17,7 @@ var visitedURIs = [
|
||||
"http://www.test-download.com/"
|
||||
].map(NetUtil.newURI.bind(NetUtil));
|
||||
|
||||
add_task(function () {
|
||||
add_task(function* () {
|
||||
let windowsToClose = [];
|
||||
let placeItemsCount = 0;
|
||||
|
||||
|
@ -72,7 +72,7 @@ add_task(function* test_expire_orphans_optionalarg()
|
||||
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.
|
||||
@ -96,7 +96,7 @@ add_task(function test_expire_limited()
|
||||
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.
|
||||
|
@ -34,7 +34,7 @@ add_task(function* database_is_valid() {
|
||||
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,
|
||||
|
@ -13,7 +13,7 @@ add_task(function* database_is_valid() {
|
||||
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();
|
||||
|
||||
|
@ -42,7 +42,7 @@ const olderthansixmonths = today - (DAY_MICROSEC * 31 * 7);
|
||||
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
|
||||
|
@ -158,16 +158,18 @@ add_task(function* pages_searchterm_is_title_query()
|
||||
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();
|
||||
@ -183,16 +185,18 @@ add_task(function* visits_searchterm_is_title_query()
|
||||
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();
|
||||
|
@ -62,4 +62,4 @@ add_task(function* test_queryMultipleFolders() {
|
||||
Assert.equal(bookmarkIds[i], node.itemId, node.uri);
|
||||
}
|
||||
rootNode.containerOpen = false;
|
||||
});
|
||||
});
|
||||
|
@ -154,7 +154,7 @@ add_task(function* test_sort_date_site_grouping()
|
||||
}
|
||||
|
||||
// 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];
|
||||
@ -163,7 +163,7 @@ add_task(function* test_sort_date_site_grouping()
|
||||
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++)
|
||||
|
@ -11,7 +11,7 @@ var tests = [];
|
||||
tests.push({
|
||||
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_NONE,
|
||||
|
||||
setup: function() {
|
||||
*setup() {
|
||||
do_print("Sorting test 1: SORT BY NONE");
|
||||
|
||||
this._unsortedData = [
|
||||
@ -74,7 +74,7 @@ tests.push({
|
||||
tests.push({
|
||||
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING,
|
||||
|
||||
setup: function() {
|
||||
*setup() {
|
||||
do_print("Sorting test 2: SORT BY TITLE");
|
||||
|
||||
this._unsortedData = [
|
||||
@ -149,7 +149,7 @@ 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;
|
||||
@ -249,7 +249,7 @@ 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;
|
||||
@ -355,7 +355,7 @@ 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;
|
||||
@ -456,7 +456,7 @@ tests.push({
|
||||
tests.push({
|
||||
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_ASCENDING,
|
||||
|
||||
setup: function() {
|
||||
*setup() {
|
||||
do_print("Sorting test 6: SORT BY KEYWORD");
|
||||
|
||||
this._unsortedData = [
|
||||
@ -555,7 +555,7 @@ 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;
|
||||
@ -645,7 +645,7 @@ 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;
|
||||
@ -743,7 +743,7 @@ tests.push({
|
||||
tests.push({
|
||||
_sortingMode: Ci.nsINavHistoryQueryOptions.SORT_BY_TAGS_ASCENDING,
|
||||
|
||||
setup: function() {
|
||||
*setup() {
|
||||
do_print("Sorting test 9: SORT BY TAGS");
|
||||
|
||||
this._unsortedData = [
|
||||
@ -844,7 +844,7 @@ tests.push({
|
||||
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;
|
||||
@ -940,7 +940,7 @@ tests.push({
|
||||
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;
|
||||
@ -1022,7 +1022,7 @@ tests.push({
|
||||
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;
|
||||
@ -1104,7 +1104,7 @@ tests.push({
|
||||
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;
|
||||
@ -1186,7 +1186,7 @@ tests.push({
|
||||
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;
|
||||
|
@ -449,7 +449,7 @@ function* addTestEngine(basename, httpServer=undefined) {
|
||||
|
||||
// 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);
|
||||
|
||||
|
@ -73,7 +73,7 @@ add_task(function* test_default_behavior_host() {
|
||||
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/"
|
||||
|
@ -17,7 +17,10 @@ add_task(function* test_execute()
|
||||
{
|
||||
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.
|
||||
}
|
||||
});
|
||||
|
@ -42,12 +42,12 @@ add_task(function* test_execute()
|
||||
]);
|
||||
|
||||
// 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
|
||||
|
@ -37,7 +37,8 @@ add_task(function* test_initialize()
|
||||
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
|
||||
|
@ -371,7 +371,10 @@ add_task(function* test_non_addable_uri_errors() {
|
||||
};
|
||||
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.
|
||||
@ -1080,7 +1083,10 @@ add_task(function* test_callbacks_not_supplied() {
|
||||
};
|
||||
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.
|
||||
|
@ -327,7 +327,7 @@ function* ensureNonExistent(...aGuids) {
|
||||
}
|
||||
|
||||
add_task(function* test_recycled_transactions() {
|
||||
function ensureTransactThrowsFor(aTransaction) {
|
||||
function* ensureTransactThrowsFor(aTransaction) {
|
||||
let [txns, undoPosition] = getTransactionsHistoryState();
|
||||
try {
|
||||
yield aTransaction.transact();
|
||||
|
@ -303,7 +303,7 @@ function* checkItem(aExpected, aNode)
|
||||
{
|
||||
let id = aNode.itemId;
|
||||
|
||||
return Task.spawn(function() {
|
||||
return Task.spawn(function* () {
|
||||
for (prop in aExpected) {
|
||||
switch (prop) {
|
||||
case "type":
|
||||
|
@ -145,7 +145,7 @@ function* testImportedBookmarks() {
|
||||
function* checkItem(aExpected, aNode) {
|
||||
let id = aNode.itemId;
|
||||
|
||||
return Task.spawn(function() {
|
||||
return Task.spawn(function* () {
|
||||
for (prop in aExpected) {
|
||||
switch (prop) {
|
||||
case "type":
|
||||
|
@ -47,21 +47,19 @@ var tests = [
|
||||
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");
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -70,17 +68,15 @@ var tests = [
|
||||
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);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -89,18 +85,16 @@ var tests = [
|
||||
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) {
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -109,21 +103,19 @@ var tests = [
|
||||
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");
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -132,18 +124,16 @@ var tests = [
|
||||
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");
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -152,7 +142,7 @@ var tests = [
|
||||
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 {
|
||||
@ -160,7 +150,7 @@ var tests = [
|
||||
do_throw("Should fail!");
|
||||
}
|
||||
catch (e) {}
|
||||
}.bind(this))
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -169,21 +159,19 @@ var tests = [
|
||||
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");
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -192,18 +180,16 @@ var tests = [
|
||||
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");
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
@ -212,7 +198,7 @@ var tests = [
|
||||
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 {
|
||||
@ -220,7 +206,7 @@ var tests = [
|
||||
do_throw("Should fail!");
|
||||
}
|
||||
catch (e) {}
|
||||
}.bind(this))
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -122,7 +122,7 @@ try {
|
||||
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 = [];
|
||||
|
@ -39,7 +39,7 @@ function onNotify(callback) {
|
||||
/**
|
||||
* 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({
|
||||
@ -47,11 +47,7 @@ function task_add_visit(uri, timestamp, transition) {
|
||||
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() {
|
||||
|
@ -150,7 +150,7 @@ add_task(function* test_moz_hosts_typed_update()
|
||||
|
||||
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
|
||||
|
@ -65,7 +65,10 @@ add_task(function* test_execute()
|
||||
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));
|
||||
}
|
||||
|
@ -68,22 +68,22 @@ function run_test()
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1074,7 +1074,7 @@ 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"
|
||||
@ -1267,7 +1267,7 @@ 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.
|
||||
|
@ -211,17 +211,17 @@ function* test_promiseBookmarksTreeAgainstResult(aItemGuid = "",
|
||||
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");
|
||||
|
@ -15,7 +15,7 @@ function* cleanup() {
|
||||
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.");
|
||||
@ -56,7 +56,7 @@ add_task(function remove_visits_outside_unbookmarked_uri() {
|
||||
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.");
|
||||
@ -103,7 +103,7 @@ add_task(function remove_visits_outside_bookmarked_uri() {
|
||||
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.");
|
||||
@ -144,7 +144,7 @@ add_task(function remove_visits_unbookmarked_uri() {
|
||||
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.");
|
||||
@ -191,7 +191,7 @@ add_task(function remove_visits_bookmarked_uri() {
|
||||
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.");
|
||||
@ -224,7 +224,7 @@ add_task(function remove_all_visits_unbookmarked_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 = [];
|
||||
@ -260,7 +260,7 @@ add_task(function remove_all_visits_unbookmarked_place_uri() {
|
||||
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.");
|
||||
@ -306,7 +306,7 @@ add_task(function remove_all_visits_bookmarked_uri() {
|
||||
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.");
|
||||
@ -326,7 +326,3 @@ add_task(function remove_all_visits_bookmarked_uri() {
|
||||
|
||||
yield cleanup();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user