Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
/* -*- 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
add_task(async function test_execute() {
let count_visited_URIs = [
];
let notcount_visited_URIs = [
];
// add visits, one for each transition type
await PlacesTestUtils.addVisits([
{
transition: TRANSITION_BOOKMARK,
},
{
transition: TRANSITION_FRAMED_LINK,
},
{
transition: TRANSITION_REDIRECT_PERMANENT,
},
{
transition: TRANSITION_REDIRECT_TEMPORARY,
},
{
transition: TRANSITION_DOWNLOAD,
},
]);
// check that all links are marked as visited
for (let visited_uri of count_visited_URIs) {
Assert.ok(await PlacesUtils.history.hasVisits(uri(visited_uri)));
}
for (let visited_uri of notcount_visited_URIs) {
Assert.ok(await PlacesUtils.history.hasVisits(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();
query.minVisits = 1;
let root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
let cc = root.childCount;
Assert.equal(cc, count_visited_URIs.length);
for (let i = 0; i < cc; i++) {
let node = root.getChild(i);
Assert.notEqual(count_visited_URIs.indexOf(node.uri), -1);
}
root.containerOpen = false;
});