/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim:set ts=2 sw=2 sts=2 et: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
check_reverse() { // no reverse sorting for SORT BY NONE
},
});
// if titles are equal, should fall back to URI
{
isBookmark: true,
uri: "http://example.com/b2",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
title: "y",
isInQuery: true,
},
];
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
// if dates are equal, should fall back to title
{
isVisit: true,
isDetails: true,
isBookmark: true,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 3,
uri: "http://example.com/c2",
lastVisit: timeInMicroseconds - 2000,
title: "x2",
isInQuery: true,
},
// if dates and title are equal, should fall back to bookmark index
{
isVisit: true,
isDetails: true,
isBookmark: true,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 4,
uri: "http://example.com/c2",
lastVisit: timeInMicroseconds - 2000,
title: "x2",
isInQuery: true,
},
];
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
// if URIs are equal, should fall back to date
{
isBookmark: true,
isDetails: true,
lastVisit: timeInMicroseconds + 1000,
uri: "http://example.com/c",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 3,
title: "x",
isInQuery: true,
},
// if no URI (e.g., node is a folder), should fall back to title
{
isFolder: true,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 4,
title: "y",
isInQuery: true,
},
// if URIs and dates are equal, should fall back to bookmark index
{
isBookmark: true,
isDetails: true,
lastVisit: timeInMicroseconds + 1000,
uri: "http://example.com/c",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 5,
title: "x",
isInQuery: true,
},
// if no URI and titles are equal, should fall back to bookmark index
{
isFolder: true,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 6,
title: "y",
isInQuery: true,
},
// if no URI and titles are equal, should fall back to title
{
isFolder: true,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 7,
title: "z",
isInQuery: true,
},
// Separator should go after folders.
{
isSeparator: true,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 8,
isInQuery: true,
},
];
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
// if visitCounts are equal, should fall back to date
{
isBookmark: true,
uri: "http://example.com/b2",
lastVisit: timeInMicroseconds + 1000,
title: "y2a",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 3,
isInQuery: true,
},
// if visitCounts and dates are equal, should fall back to bookmark index
{
isBookmark: true,
uri: "http://example.com/b2",
lastVisit: timeInMicroseconds + 1000,
title: "y2b",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 4,
isInQuery: true,
},
];
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
// if dateAddeds are equal, should fall back to title
{
isBookmark: true,
uri: "http://example.com/b2",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 3,
title: "y2",
dateAdded: timeInMicroseconds - 1000,
isInQuery: true,
},
// if dateAddeds and titles are equal, should fall back to bookmark index
{
isBookmark: true,
uri: "http://example.com/b3",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 4,
title: "y3",
dateAdded: timeInMicroseconds - 1000,
isInQuery: true,
},
];
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
// if lastModifieds are equal, should fall back to title
{
isBookmark: true,
uri: "http://example.com/b2",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 3,
title: "y2",
dateAdded: timeAddedInMicroseconds,
lastModified: timeInMicroseconds - 1000,
isInQuery: true,
},
// if lastModifieds and titles are equal, should fall back to bookmark // index
{
isBookmark: true,
uri: "http://example.com/b3",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 4,
title: "y3",
dateAdded: timeAddedInMicroseconds,
lastModified: timeInMicroseconds - 1000,
isInQuery: true,
},
];
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
// if tags are equal, should fall back to title
{
isBookmark: true,
uri: "http://url1b.com/",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
title: "title y2",
isTag: true,
tagArray: ["b", "a"],
isInQuery: true,
},
// if tags are equal, should fall back to title
{
isBookmark: true,
uri: "http://url3b.com/",
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
title: "title w2",
isInQuery: true,
},
];
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() { // Query var query = PlacesUtils.history.getNewQuery();
query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
// query options var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification. var result = PlacesUtils.history.executeQuery(query, options); var root = result.root;
root.containerOpen = true;
compareArrayToResult(this._sortedData, root);
root.containerOpen = false;
},
add_task(async function test_sorting() { for (let test of tests) {
await test.setup();
await PlacesTestUtils.promiseAsyncUpdates();
test.check(); // sorting reversed, usually SORT_BY have ASC and DESC
test.check_reverse(); // Execute cleanup tasks
await PlacesUtils.bookmarks.eraseEverything();
await PlacesUtils.history.clear();
}
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-06-06)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.