--- a/browser/base/content/test/general/browser_bug581253.js
+++ b/browser/base/content/test/general/browser_bug581253.js
@@ -8,17 +8,17 @@ var testTag = "581253_tag";
add_task(async function test_remove_bookmark_with_tag_via_edit_bookmark() {
waitForExplicitFinish();
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.eraseEverything();
await BrowserTestUtils.removeTab(tab);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "",
url: testURL,
});
--- a/browser/base/content/test/general/browser_contentAltClick.js
+++ b/browser/base/content/test/general/browser_contentAltClick.js
@@ -9,18 +9,16 @@
*
* The difference between this and the test "browser_contentAreaClick.js" is that
* the code path in e10s uses ContentClick.jsm instead of browser.js::contentAreaClick() util.
*/
"use strict";
ChromeUtils.defineModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
-ChromeUtils.defineModuleGetter(this, "PlacesTestUtils",
- "resource://testing-common/PlacesTestUtils.jsm");
function setup() {
Services.prefs.setBoolPref("browser.altClickSave", true);
let testPage =
"data:text/html," +
'<p><a id="commonlink" href="http://mochi.test/moz/">Common link</a></p>' +
'<p><math id="mathxlink" xmlns="http://www.w3.org/1998/Math/MathML" xlink:type="simple" xlink:href="http://mochi.test/moz/"><mtext>MathML XLink</mtext></math></p>' +
@@ -33,17 +31,17 @@ async function clean_up() {
// Remove downloads.
let downloadList = await Downloads.getList(Downloads.ALL);
let downloads = await downloadList.getAll();
for (let download of downloads) {
await downloadList.remove(download);
await download.finalize(true);
}
// Remove download history.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
Services.prefs.clearUserPref("browser.altClickSave");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}
add_task(async function test_alt_click() {
await setup();
--- a/browser/base/content/test/general/browser_sanitizeDialog.js
+++ b/browser/base/content/test/general/browser_sanitizeDialog.js
@@ -953,17 +953,17 @@ async function blankSlate() {
},
handleError(error) {
reject(error);
throw new Error("Error occurred updating form history: " + error);
}
});
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
/**
* Ensures that the given pref is the expected value.
*
* @param aPrefName
* The pref's sub-branch under the privacy branch
* @param aExpectedVal
--- a/browser/base/content/test/metaTags/browser_meta_tags.js
+++ b/browser/base/content/test/metaTags/browser_meta_tags.js
@@ -17,17 +17,17 @@ add_task(async function test_metadata()
const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
// Wait until places has stored the page info
const pageInfo = await waitForPageInfo(URL);
is(pageInfo.description, "og:description", "got the correct description");
is(pageInfo.previewImageURL.href, "https://test.com/og-image-secure-url.jpg", "got the correct preview image");
await BrowserTestUtils.removeTab(tab);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
/**
* This test is almost like the previous one except it opens a second tab to
* make sure the extra tab does not cause the debounce logic to be skipped. If
* incorrectly skipped, the updated metadata would not include the delayed meta.
*/
add_task(async function multiple_tabs() {
@@ -39,10 +39,10 @@ add_task(async function multiple_tabs()
// Wait until places has stored the page info
const pageInfo = await waitForPageInfo(URL);
is(pageInfo.description, "og:description", "got the correct description");
is(pageInfo.previewImageURL.href, "https://test.com/og-image-secure-url.jpg", "got the correct preview image");
await BrowserTestUtils.removeTab(tab);
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -13,19 +13,18 @@ Services.prefs.setBoolPref(PREF_NEWTAB_A
// affecting these tests.
BrowserOpenTab();
const initialTab = gBrowser.selectedTab;
gBrowser.removeTab(initialTab);
var tmp = {};
ChromeUtils.import("resource://gre/modules/NewTabUtils.jsm", tmp);
ChromeUtils.import("resource:///modules/DirectoryLinksProvider.jsm", tmp);
-ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm", tmp);
Services.scriptloader.loadSubScript("chrome://browser/content/sanitize.js", tmp);
-var {NewTabUtils, Sanitizer, DirectoryLinksProvider, PlacesTestUtils} = tmp;
+var {NewTabUtils, Sanitizer, DirectoryLinksProvider} = tmp;
var gWindow = window;
// Default to dummy/empty directory links
var gDirectorySource = 'data:application/json,{"test":1}';
var gOrigDirectorySource;
// The tests assume all 3 rows and all 3 columns of sites are shown, but the
@@ -119,17 +118,17 @@ function watchLinksChangeOnce() {
DirectoryLinksProvider.addObserver(observer);
});
}
add_task(async function setup() {
registerCleanupFunction(function() {
return new Promise(resolve => {
function cleanupAndFinish() {
- PlacesTestUtils.clearHistory().then(() => {
+ PlacesUtils.history.clear().then(() => {
whenPagesUpdated().then(resolve);
NewTabUtils.restore();
});
}
let callbacks = NewTabUtils.links._populateCallbacks;
let numCallbacks = callbacks.length;
@@ -187,17 +186,17 @@ function setLinks(aLinks) {
});
}
// Call populateCache() once to make sure that all link fetching that is
// currently in progress has ended. We clear the history, fill it with the
// given entries and call populateCache() now again to make sure the cache
// has the desired contents.
NewTabUtils.links.populateCache(function() {
- PlacesTestUtils.clearHistory().then(() => {
+ PlacesUtils.history.clear().then(() => {
fillHistory(links).then(() => {
NewTabUtils.links.populateCache(function() {
NewTabUtils.allPages.update();
resolve();
}, true);
});
});
});
--- a/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
@@ -28,17 +28,17 @@ function is_selected_one_off(index) {
"A one-off is selected, so the listbox should not have a selection");
}
add_task(async function() {
let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla");
registerCleanupFunction(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
await BrowserTestUtils.removeTab(tab);
});
let visits = [];
repeat(maxResults, i => {
visits.push({
uri: makeURI("http://example.com/autocomplete/?" + i),
--- a/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
+++ b/browser/base/content/test/urlbar/browser_bug1003461-switchtab-override.js
@@ -52,10 +52,10 @@ add_task(async function test_switchtab_o
BrowserTestUtils.browserLoaded(secondTab.linkedBrowser).then(deferred.resolve);
EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
EventUtils.synthesizeKey("VK_RETURN", { });
info(`gURLBar.value = ${gURLBar.value}`);
EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
await deferred.promise;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/browser/base/content/test/urlbar/browser_bug1024133-switchtab-override-keynav.js
+++ b/browser/base/content/test/urlbar/browser_bug1024133-switchtab-override-keynav.js
@@ -10,17 +10,17 @@ add_task(async function test_switchtab_o
info("Opening and selecting second tab");
let secondTab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
registerCleanupFunction(() => {
try {
gBrowser.removeTab(tab);
gBrowser.removeTab(secondTab);
} catch (ex) { /* tabs may have already been closed in case of failure */ }
- return PlacesTestUtils.clearHistory();
+ return PlacesUtils.history.clear();
});
gURLBar.focus();
gURLBar.value = "dummy_pag";
EventUtils.synthesizeKey("e", {});
await promiseSearchComplete();
info("Select second autocomplete popup entry");
--- a/browser/base/content/test/urlbar/browser_bug1104165-switchtab-decodeuri.js
+++ b/browser/base/content/test/urlbar/browser_bug1104165-switchtab-decodeuri.js
@@ -19,10 +19,10 @@ add_task(async function test_switchtab_d
gBrowser.tabContainer.addEventListener("TabSelect", function() {
is(gBrowser.selectedTab, tab, "Should have switched to the right tab");
resolve();
}, {once: true});
EventUtils.synthesizeKey("VK_RETURN", { });
});
gBrowser.removeCurrentTab();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/browser/base/content/test/urlbar/browser_search_favicon.js
+++ b/browser/base/content/test/urlbar/browser_search_favicon.js
@@ -1,17 +1,17 @@
var gOriginalEngine;
var gEngine;
var gRestyleSearchesPref = "browser.urlbar.restyleSearches";
registerCleanupFunction(() => {
Services.prefs.clearUserPref(gRestyleSearchesPref);
Services.search.currentEngine = gOriginalEngine;
Services.search.removeEngine(gEngine);
- return PlacesTestUtils.clearHistory();
+ return PlacesUtils.history.clear();
});
add_task(async function() {
Services.prefs.setBoolPref(gRestyleSearchesPref, true);
});
add_task(async function() {
--- a/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
@@ -108,17 +108,17 @@ add_task(async function step_7() {
}
await ensure_opentabs_match_db();
});
add_task(async function cleanup() {
info("Cleaning up");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
function loadTab(tab, url) {
// Because adding visits is async, we will not be notified immediately.
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
let visited = new Promise(resolve => {
Services.obs.addObserver(
function observer(aSubject, aTopic, aData) {
--- a/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
@@ -3,17 +3,17 @@
add_task(async function setup() {
const PREF_TRIMURL = "browser.urlbar.trimURLs";
const PREF_AUTOFILL = "browser.urlbar.autoFill";
registerCleanupFunction(async function() {
Services.prefs.clearUserPref(PREF_TRIMURL);
Services.prefs.clearUserPref(PREF_AUTOFILL);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
gURLBar.handleRevert();
});
Services.prefs.setBoolPref(PREF_TRIMURL, true);
Services.prefs.setBoolPref(PREF_AUTOFILL, true);
// Adding a tab would hit switch-to-tab, so it's safer to just add a visit.
await PlacesTestUtils.addVisits([{
uri: "http://www.autofilltrimurl.com/whatever",
--- a/browser/base/content/test/urlbar/browser_urlbarEnterAfterMouseOver.js
+++ b/browser/base/content/test/urlbar/browser_urlbarEnterAfterMouseOver.js
@@ -14,20 +14,20 @@ async function promiseAutoComplete(input
function is_selected(index) {
is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
}
let gMaxResults;
add_task(async function() {
registerCleanupFunction(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
gMaxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
let visits = [];
repeat(gMaxResults, i => {
visits.push({
uri: makeURI("http://example.com/autocomplete/?" + i),
});
--- a/browser/base/content/test/urlbar/browser_urlbarOneOffs.js
+++ b/browser/base/content/test/urlbar/browser_urlbarOneOffs.js
@@ -8,20 +8,20 @@ add_task(async function init() {
// Add a search suggestion engine and move it to the front so that it appears
// as the first one-off.
let engine = await promiseNewSearchEngine(TEST_ENGINE_BASENAME);
Services.search.moveEngine(engine, 0);
registerCleanupFunction(async function() {
await hidePopup();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let visits = [];
for (let i = 0; i < gMaxResults; i++) {
visits.push({
uri: makeURI("http://example.com/browser_urlbarOneOffs.js/?" + i),
// TYPED so that the visit shows up when the urlbar's drop-down arrow is
// pressed.
transition: Ci.nsINavHistoryService.TRANSITION_TYPED,
--- a/browser/base/content/test/urlbar/browser_urlbarOneOffs_searchSuggestions.js
+++ b/browser/base/content/test/urlbar/browser_urlbarOneOffs_searchSuggestions.js
@@ -1,24 +1,24 @@
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
add_task(async function init() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.oneOffSearches", true],
["browser.urlbar.suggest.searches", true]],
});
let engine = await promiseNewSearchEngine(TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.moveEngine(engine, 0);
Services.search.currentEngine = engine;
registerCleanupFunction(async function() {
Services.search.currentEngine = oldCurrentEngine;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// Make sure the popup is closed for the next test.
gURLBar.blur();
Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
});
});
// Presses the Return key when a one-off is selected after selecting a search
// suggestion.
@@ -43,17 +43,17 @@ add_task(async function oneOffReturnAfte
assertState(2, 0, "foobar");
let resultsPromise =
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false,
`http://mochi.test:8888/?terms=foobar`);
EventUtils.synthesizeKey("VK_RETURN", {});
await resultsPromise;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await BrowserTestUtils.removeTab(tab);
});
// Clicks a one-off engine after selecting a search suggestion.
add_task(async function oneOffClickAfterSuggestion() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
let typedValue = "foo";
@@ -71,17 +71,17 @@ add_task(async function oneOffClickAfter
let oneOffs = gURLBar.popup.oneOffSearchButtons.getSelectableButtons(true);
let resultsPromise =
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false,
`http://mochi.test:8888/?terms=foobar`);
EventUtils.synthesizeMouseAtCenter(oneOffs[0], {});
await resultsPromise;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await BrowserTestUtils.removeTab(tab);
});
add_task(async function overridden_engine_not_reused() {
info("An overridden search suggestion item should not be reused by a search with another engine");
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
let typedValue = "foo";
await promiseAutocompleteResultPopup(typedValue, window, true);
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
@@ -9,17 +9,17 @@ add_task(async function prepare() {
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
registerCleanupFunction(async function() {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.search.currentEngine = oldCurrentEngine;
// Clicking suggestions causes visits to search results pages, so clear that
// history now.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// Make sure the popup is closed for the next test.
gURLBar.blur();
Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
});
});
add_task(async function clickSuggestion() {
--- a/browser/base/content/test/urlbar/browser_urlbarSearchTelemetry.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchTelemetry.js
@@ -14,17 +14,17 @@ add_task(async function prepare() {
Services.search.currentEngine = engine;
registerCleanupFunction(async function() {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.search.currentEngine = oldCurrentEngine;
// Clicking urlbar results causes visits to their associated pages, so clear
// that history now.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// Make sure the popup is closed for the next test.
gURLBar.blur();
Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
});
// Move the mouse away from the urlbar one-offs so that a one-off engine is
// not inadvertently selected.
--- a/browser/base/content/test/urlbar/browser_urlbar_autoFill_backspaced.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_autoFill_backspaced.js
@@ -27,17 +27,17 @@ async function test_autocomplete(data) {
await promisePopupHidden(gURLBar.popup);
gURLBar.blur();
}
add_task(async function() {
registerCleanupFunction(async function() {
Services.prefs.clearUserPref("browser.urlbar.autoFill");
gURLBar.handleRevert();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
// Add a typed visit, so it will be autofilled.
await PlacesTestUtils.addVisits({
uri: NetUtil.newURI("http://example.com/"),
transition: Ci.nsINavHistoryService.TRANSITION_TYPED
});
@@ -137,10 +137,10 @@ add_task(async function() {
onAutoFill: () => {
gURLBar.blur();
gURLBar.focus();
gURLBar.selectionStart = 2;
gURLBar.selectionEnd = 12;
}
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/browser/base/content/test/urlbar/browser_urlbar_canonize_on_autofill.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_canonize_on_autofill.js
@@ -21,17 +21,17 @@ async function test_autocomplete(data) {
await promiseLoad;
gURLBar.blur();
}
add_task(async function() {
registerCleanupFunction(async function() {
Services.prefs.clearUserPref("browser.urlbar.autoFill");
gURLBar.handleRevert();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
// Add a typed visit, so it will be autofilled.
await PlacesTestUtils.addVisits({
uri: "http://example.com/",
transition: Ci.nsINavHistoryService.TRANSITION_TYPED
});
--- a/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js
+++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js
@@ -72,17 +72,17 @@ async function prepareSearchEngine() {
// Make sure the popup is closed for the next test.
gURLBar.blur();
gURLBar.popup.selectedIndex = -1;
gURLBar.popup.hidePopup();
ok(!gURLBar.popup.popupOpen, "popup should be closed");
// Clicking suggestions causes visits to search results pages, so clear that
// history now.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
}
add_task(async function test_webnavigation_urlbar_typed_transitions() {
function backgroundScript() {
browser.webNavigation.onCommitted.addListener((msg) => {
browser.test.assertEq("http://example.com/?q=typed", msg.url,
"Got the expected url");
--- a/browser/components/extensions/test/xpcshell/test_ext_history.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_history.js
@@ -56,17 +56,17 @@ add_task(async function test_delete() {
manifest: {
permissions: ["history"],
},
background: `(${background})()`,
});
await extension.startup();
await extension.awaitMessage("ready");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let historyClearedCount;
let visits = [];
let visitDate = new Date(1999, 9, 9, 9, 9).getTime();
function pushVisit(subvisits) {
visitDate += 1000;
subvisits.push({date: new Date(visitDate)});
@@ -222,17 +222,17 @@ add_task(async function test_search() {
let result = findResult(url, results);
notEqual(result, null, `history.search result was found for ${url}`);
equal(result.visitCount, expectedCount, `history.search reports ${expectedCount} visit(s)`);
equal(result.title, `test visit for ${url}`, "title for search result is correct");
}
await extension.startup();
await extension.awaitMessage("ready");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.history.insertMany(PAGE_INFOS);
extension.sendMessage("check-history");
let results = await extension.awaitMessage("empty-search");
equal(results.length, 3, "history.search with empty text returned 3 results");
checkResult(results, SINGLE_VISIT_URL, 1);
@@ -249,17 +249,17 @@ add_task(async function test_search() {
results = await extension.awaitMessage("date-range-search");
equal(results.length, 2, "history.search with a date range returned 2 result");
checkResult(results, DOUBLE_VISIT_URL, 2);
checkResult(results, SINGLE_VISIT_URL, 1);
await extension.awaitFinish("search");
await extension.unload();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_add_url() {
function background() {
const TEST_DOMAIN = "http://example.com/";
browser.test.onMessage.addListener((msg, testData) => {
let [details, type] = testData;
@@ -316,17 +316,17 @@ add_task(async function test_add_url() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["history"],
},
background: `(${background})()`,
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await extension.startup();
await extension.awaitMessage("ready");
for (let data of addTestData) {
extension.sendMessage("add-url", data);
let results = await extension.awaitMessage("url-added");
await checkUrl(results);
}
@@ -392,17 +392,17 @@ add_task(async function test_get_visits(
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["history"],
},
background: `(${background})()`,
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await extension.startup();
await extension.awaitFinish("get-visits");
await extension.unload();
});
add_task(async function test_transition_types() {
const VISIT_URL_PREFIX = "http://example.com/";
@@ -455,17 +455,17 @@ add_task(async function test_transition_
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["history"],
},
background,
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await extension.startup();
await extension.awaitMessage("ready");
await PlacesUtils.history.insertMany(pageInfos);
extension.sendMessage("search");
let results = await extension.awaitMessage("search-result");
equal(results.length, pageInfos.length, "search returned expected length of results");
@@ -535,17 +535,17 @@ add_task(async function test_on_visited(
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["history"],
},
background: `(${background})()`,
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await extension.startup();
await extension.awaitMessage("ready");
await PlacesUtils.history.insertMany(PAGE_INFOS);
let onVisitedData = await extension.awaitMessage("on-visited-data");
function checkOnVisitedData(index, expected) {
--- a/browser/components/migration/tests/unit/test_automigration.js
+++ b/browser/components/migration/tests/unit/test_automigration.js
@@ -537,17 +537,17 @@ add_task(async function checkUndoVisitsS
});
Assert.deepEqual(undoVisitData.find(v => v.url == "http://www.example.org/"), {
url: "http://www.example.org/",
visitCount: 2,
first: new Date("2015-08-03").getTime() * 1000,
last: new Date("2016-04-03").getTime() * 1000,
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function checkUndoVisitsState() {
MigrationUtils.initializeUndoData();
await MigrationUtils.insertVisitsWrapper([{
uri: NetUtil.newURI("http://www.example.com/"),
title: "Example",
visits: [{
@@ -670,17 +670,17 @@ add_task(async function checkUndoVisitsS
Assert.equal(await visitsForURL("http://www.example.com/"), 1,
"1 example.com visit (out of 5) should have persisted despite being within the range, due to limiting");
Assert.equal(await visitsForURL("http://www.mozilla.org/"), 0,
"0 mozilla.org visits should have persisted (out of 1).");
Assert.equal(await visitsForURL("http://www.example.org/"), 2,
"2 example.org visits should have persisted (out of 4).");
Assert.equal(await visitsForURL("http://www.unrelated.org/"), 1,
"1 unrelated.org visits should have persisted as it's not involved in the import.");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function checkHistoryRemovalCompletion() {
AutoMigrate._errorMap = {bookmarks: 0, visits: 0, logins: 0};
await AutoMigrate._removeSomeVisits([{url: "http://www.example.com/",
first: 0,
last: PlacesUtils.toPRTime(new Date()),
limit: -1}]);
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_cancel.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_cancel.js
@@ -4,17 +4,17 @@
Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
const sandbox = sinon.sandbox.create();
registerCleanupFunction(async function() {
sandbox.restore();
delete window.sinon;
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
let bookmarks; // Bookmarks added via insertTree.
add_task(async function setup() {
bookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -335,17 +335,17 @@ gTests.push({
SidebarUI.hide();
},
async cleanup() {
await this._removeObserver;
delete this._removeObserver;
await PlacesTestUtils.promiseAsyncUpdates();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
});
// ------------------------------------------------------------------------------
add_task(async function test_setup() {
// This test can take some time, if we timeout too early it could run
// in the middle of other tests, or hang them.
--- a/browser/components/places/tests/browser/browser_controller_onDrop.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop.js
@@ -12,17 +12,17 @@ const sandbox = sinon.sandbox.create();
var bookmarks;
var bookmarkIds;
add_task(async function setup() {
registerCleanupFunction(async function() {
sandbox.restore();
delete window.sinon;
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
sandbox.stub(PlacesUIUtils, "getTransactionForData");
sandbox.stub(PlacesTransactions, "batch");
bookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
--- a/browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js
@@ -13,17 +13,17 @@ const TAG_NAME = "testTag";
var bookmarks;
var bookmarkId;
add_task(async function setup() {
registerCleanupFunction(async function() {
sandbox.restore();
delete window.sinon;
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
sandbox.stub(PlacesTransactions, "batch");
sandbox.stub(PlacesTransactions, "Tag");
bookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
--- a/browser/components/places/tests/browser/browser_forgetthissite_single.js
+++ b/browser/components/places/tests/browser/browser_forgetthissite_single.js
@@ -19,17 +19,17 @@ add_task(async function() {
let transition = PlacesUtils.history.TRANSITION_TYPED;
TEST_URIs.forEach(uri => places.push({uri: PlacesUtils._uri(uri), transition}));
await PlacesTestUtils.addVisits(places);
await testForgetThisSiteVisibility(1);
await testForgetThisSiteVisibility(2);
// Cleanup.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
var testForgetThisSiteVisibility = async function(selectionCount) {
let organizer = await promiseLibrary();
// Select History in the left pane.
organizer.PlacesOrganizer.selectLeftPaneQuery("History");
let PO = organizer.PlacesOrganizer;
--- a/browser/components/places/tests/browser/browser_history_sidebar_search.js
+++ b/browser/components/places/tests/browser/browser_history_sidebar_search.js
@@ -7,17 +7,17 @@ add_task(async function test() {
"http://sidebar.mozilla.org/b",
"http://sidebar.mozilla.org/c",
"http://www.mozilla.org/d",
];
// Number of pages that will be filtered out by the search.
const FILTERED_COUNT = 1;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// Add some visited page.
let time = Date.now();
let places = [];
for (let i = 0; i < pages.length; i++) {
places.push({ uri: NetUtil.newURI(pages[i]),
visitDate: (time - i) * 1000,
transition: PlacesUtils.history.TRANSITION_TYPED });
@@ -38,17 +38,17 @@ add_task(async function test() {
check_tree_order(tree, pages, -FILTERED_COUNT);
info("Reset the search");
searchBox.value = "";
searchBox.doCommand();
check_tree_order(tree, pages);
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
function check_tree_order(tree, pages, aNumberOfRowsDelta = 0) {
let treeView = tree.view;
let columns = tree.columns;
is(columns.count, 1, "There should be only 1 column in the sidebar");
let found = 0;
--- a/browser/components/places/tests/browser/browser_library_commands.js
+++ b/browser/components/places/tests/browser/browser_library_commands.js
@@ -7,17 +7,17 @@
/**
* Test enabled commands in the left pane folder of the Library.
*/
const TEST_URI = NetUtil.newURI("http://www.mozilla.org/");
registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_date_container() {
let library = await promiseLibrary();
info("Ensure date containers under History cannot be cut but can be deleted");
await PlacesTestUtils.addVisits(TEST_URI);
--- a/browser/components/places/tests/browser/browser_library_delete_bookmarks_in_tags.js
+++ b/browser/components/places/tests/browser/browser_library_delete_bookmarks_in_tags.js
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Test deleting bookmarks from within tags.
*/
registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_tags() {
const uris = [
Services.io.newURI("http://example.com/1"),
Services.io.newURI("http://example.com/2"),
Services.io.newURI("http://example.com/3"),
];
--- a/browser/components/places/tests/browser/browser_library_delete_tags.js
+++ b/browser/components/places/tests/browser/browser_library_delete_tags.js
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Test enabled commands in the left pane folder of the Library.
*/
registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_tags() {
const TEST_URI = Services.io.newURI("http://example.com/");
await PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: TEST_URI,
title: "example page",
--- a/browser/components/places/tests/browser/browser_library_downloads.js
+++ b/browser/components/places/tests/browser/browser_library_downloads.js
@@ -46,17 +46,17 @@ function test() {
let testURIs = ["http://ubuntu.org/", "http://google.com/"];
for (let element of win.ContentArea.currentView
.associatedElement.children) {
is(element._shell.download.source.url, testURIs.shift(),
"URI matches");
}
win.close();
- PlacesTestUtils.clearHistory().then(finish);
+ PlacesUtils.history.clear().then(finish);
}
});
};
openLibrary(onLibraryReady, "Downloads");
}
function VisitInfo(aTransitionType) {
--- a/browser/components/places/tests/browser/browser_library_infoBox.js
+++ b/browser/components/places/tests/browser/browser_library_infoBox.js
@@ -8,17 +8,17 @@
*/
let gLibrary;
add_task(async function() {
// Open Library.
gLibrary = await promiseLibrary();
registerCleanupFunction(async () => {
gLibrary.close();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
gLibrary.PlacesOrganizer._places.focus();
info("Bug 430148 - Remove or hide the more/less button in details pane...");
let PO = gLibrary.PlacesOrganizer;
let ContentTree = gLibrary.ContentTree;
let infoBoxExpanderWrapper = getAndCheckElmtById("infoBoxExpanderWrapper");
--- a/browser/components/places/tests/browser/browser_library_panel_leak.js
+++ b/browser/components/places/tests/browser/browser_library_panel_leak.js
@@ -34,17 +34,17 @@ function test() {
let selection = contentTree.view.selection;
selection.clearSelection();
selection.rangedSelect(0, 0, true);
// Check the panel is editing the history entry.
is(organizer.gEditItemOverlay.itemId, -1, "Editing an history entry");
// Close Library window.
organizer.close();
// Clean up history.
- PlacesTestUtils.clearHistory().then(finish);
+ PlacesUtils.history.clear().then(finish);
}
waitForExplicitFinish();
// Add an history entry.
ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
PlacesTestUtils.addVisits(
{uri: PlacesUtils._uri(TEST_URI), visitDate: Date.now() * 1000,
transition: PlacesUtils.history.TRANSITION_TYPED}
--- a/browser/components/places/tests/browser/browser_paste_into_tags.js
+++ b/browser/components/places/tests/browser/browser_paste_into_tags.js
@@ -78,17 +78,17 @@ add_task(async function() {
// Remove new Places data we created.
PlacesUtils.tagging.untagURI(MOZURISPEC, ["foo"]);
PlacesUtils.tagging.untagURI(TEST_URL, ["foo"]);
tags = PlacesUtils.tagging.getTagsForURI(TEST_URL);
is(tags.length, 0, "tags are gone");
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
function focusTag(PlacesOrganizer) {
PlacesOrganizer.selectLeftPaneQuery("Tags");
let tags = PlacesOrganizer._places.selectedNode;
tags.containerOpen = true;
let fooTag = tags.getChild(0);
let tagNode = fooTag;
--- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js
+++ b/browser/components/places/tests/browser/browser_sidebarpanels_click.js
@@ -65,17 +65,17 @@ add_task(async function test_sidebarpane
sidebar.contentDocument.getElementById("byvisited").doCommand();
},
selectNode(tree) {
tree.selectNode(tree.view.nodeForTreeIndex(0));
is(tree.selectedNode.uri, TEST_URL, "The correct visit has been selected");
is(tree.selectedNode.itemId, -1, "The selected node is not bookmarked");
},
cleanup(aCallback) {
- return PlacesTestUtils.clearHistory();
+ return PlacesUtils.history.clear();
},
sidebarName: HISTORY_SIDEBAR_ID,
treeName: HISTORY_SIDEBAR_TREE_ID,
desc: "History sidebar test"
});
for (let test of tests) {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
--- a/browser/components/places/tests/chrome/test_bug549192.xul
+++ b/browser/components/places/tests/chrome/test_bug549192.xul
@@ -60,17 +60,17 @@
PlacesUtils.history.addObserver(historyObserver);
});
}
function runTest() {
SimpleTest.waitForExplicitFinish();
(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// Add some visits.
let timeInMicroseconds = PlacesUtils.toPRTime(Date.now() - 10000);
function newTimeInMicroseconds() {
timeInMicroseconds = timeInMicroseconds + 1000;
return timeInMicroseconds;
}
@@ -129,13 +129,13 @@
let promiseDeleted = promiseURIDeleted();
tree.controller.remove("Removing page");
await promiseDeleted;
ok(treeView.treeIndexForNode(node) == -1, node.uri + " removed.");
is(treeView.rowCount, rc - i - 1, "Rows count decreased");
}
// Cleanup.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
})().then(() => SimpleTest.finish());
}
]]></script>
</window>
--- a/browser/components/places/tests/chrome/test_bug549491.xul
+++ b/browser/components/places/tests/chrome/test_bug549491.xul
@@ -43,17 +43,17 @@
* Ensures that changing the details of places tree's root-node doesn't
* throw.
*/
function runTest() {
SimpleTest.waitForExplicitFinish();
(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("http://example.tld/"),
transition: PlacesUtils.history.TRANSITION_TYPED
});
// Make a history query.
let query = PlacesUtils.history.getNewQuery();
@@ -66,13 +66,13 @@
let rootNode = tree.result.root;
let obs = tree.view.QueryInterface(Ci.nsINavHistoryResultObserver);
obs.nodeHistoryDetailsChanged(rootNode, rootNode.time, rootNode.accessCount);
obs.nodeTitleChanged(rootNode, rootNode.title);
ok(true, "No exceptions thrown");
// Cleanup.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
})().then(SimpleTest.finish);
}
]]></script>
</window>
--- a/browser/components/places/tests/chrome/test_treeview_date.xul
+++ b/browser/components/places/tests/chrome/test_treeview_date.xul
@@ -53,17 +53,17 @@
function runTest() {
SimpleTest.waitForExplicitFinish();
function uri(spec) {
return Services.io.newURI(spec);
}
(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let midnight = new Date();
midnight.setHours(0);
midnight.setMinutes(0);
midnight.setSeconds(0);
midnight.setMilliseconds(0);
// Add a visit 1ms before midnight, a visit at midnight, and
@@ -146,14 +146,14 @@
is(text, 1, "Visit count is correct");
break;
}
}
}
// Cleanup.
await PlacesUtils.bookmarks.remove(bm.guid);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
})().then(SimpleTest.finish);
}
]]>
</script>
</window>
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
@@ -10,17 +10,17 @@ add_task(async function test() {
const TEST_URL = "http://mochi.test:8888/browser/browser/components/" +
"privatebrowsing/test/browser/title.sjs";
let cm = Services.cookies;
function cleanup() {
// delete all cookies
cm.removeAll();
// delete all history items
- return PlacesTestUtils.clearHistory();
+ return PlacesUtils.history.clear();
}
await cleanup();
registerCleanupFunction(cleanup);
let win = await BrowserTestUtils.openNewBrowserWindow();
registerCleanupFunction(async () => {
await BrowserTestUtils.closeWindow(win);
--- a/browser/modules/test/browser/browser_UsageTelemetry_content.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_content.js
@@ -30,17 +30,17 @@ add_task(async function setup() {
// Enable event recording for the events tested here.
Services.telemetry.setEventRecordingEnabled("navigation", true);
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
Services.search.currentEngine = originalEngine;
Services.search.removeEngine(engineDefault);
Services.search.removeEngine(engineOneOff);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
});
});
add_task(async function test_context_menu() {
// Let's reset the Telemetry data.
Services.telemetry.clearScalars();
Services.telemetry.clearEvents();
--- a/browser/modules/test/browser/browser_UsageTelemetry_content_aboutHome.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_content_aboutHome.js
@@ -30,17 +30,17 @@ add_task(async function setup() {
// Enable event recording for the events tested here.
Services.telemetry.setEventRecordingEnabled("navigation", true);
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
Services.search.currentEngine = originalEngine;
Services.search.removeEngine(engineDefault);
Services.search.removeEngine(engineOneOff);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
Services.prefs.clearUserPref("browser.newtabpage.activity-stream.aboutHome.enabled");
});
});
add_task(async function test_abouthome_simpleQuery() {
// Make sure Activity Stream about:home is disabled.
Services.prefs.setBoolPref("browser.newtabpage.activity-stream.aboutHome.enabled", false);
--- a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
+++ b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js
@@ -93,33 +93,33 @@ add_task(async function setup() {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
// Enable event recording for the events tested here.
Services.telemetry.setEventRecordingEnabled("navigation", true);
// Clear history so that history added by previous tests doesn't mess up this
// test when it selects results in the urlbar.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// Clear historical search suggestions to avoid interference from previous
// tests.
await SpecialPowers.pushPrefEnv({"set": [["browser.urlbar.maxHistoricalSearchSuggestions", 0]]});
// Use the default matching bucket configuration.
await SpecialPowers.pushPrefEnv({"set": [["browser.urlbar.matchBuckets", "general:5,suggestion:4"]]});
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
Services.telemetry.canRecordExtended = oldCanRecord;
Services.search.currentEngine = originalEngine;
Services.search.removeEngine(engine);
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
});
});
add_task(async function test_simpleQuery() {
// Let's reset the counts.
Services.telemetry.clearScalars();
Services.telemetry.clearEvents();
--- a/services/sync/tests/unit/test_history_engine.js
+++ b/services/sync/tests/unit/test_history_engine.js
@@ -123,17 +123,17 @@ add_task(async function test_history_dow
["place0000005", "place0000006", "place0000007", "place0000008", "place0000009"]);
// Sync again to clear out the backlog.
engine.lastModified = collection.modified;
ping = await sync_engine_and_validate_telem(engine, false);
deepEqual(ping.engines[0].incoming, { applied: 5 });
deepEqual(Array.from(engine.toFetch), []);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_history_visit_roundtrip() {
let engine = new HistoryEngine(Service);
await engine.initialize();
let server = await serverForFoo(engine);
await SyncTestingInfrastructure(server);
@@ -178,17 +178,17 @@ add_task(async function test_history_vis
engine.lastSync = Date.now() / 1000 - 30;
await sync_engine_and_validate_telem(engine, false);
// Make sure that we didn't duplicate the visit when inserting. (Prior to bug
// 1423395, we would insert a duplicate visit, where the timestamp was
// effectively `Math.round(microsecondTimestamp / 1000) * 1000`.)
visits = await PlacesSyncUtils.history.fetchVisitsForURL("https://www.example.com");
equal(visits.length, 2);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_history_visit_dedupe_old() {
let engine = new HistoryEngine(Service);
await engine.initialize();
let server = await serverForFoo(engine);
await SyncTestingInfrastructure(server);
@@ -243,10 +243,10 @@ add_task(async function test_history_vis
includeVisits: true
})).visits;
equal(allVisits.length, 27);
ok(allVisits.find(x => x.date.getTime() === Date.UTC(2017, 11, 4)),
"Should contain the Dec. 4th visit");
ok(allVisits.find(x => x.date.getTime() === Date.UTC(2017, 11, 5)),
"Should contain the Dec. 5th visit");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/services/sync/tests/unit/test_history_store.js
+++ b/services/sync/tests/unit/test_history_store.js
@@ -98,17 +98,17 @@ add_task(async function test_store() {
Assert.equal(queryres.title, "Hol Dir Firefox!");
Assert.deepEqual(queryres.visits, [{
date: new Date(TIMESTAMP2 / 1000),
transition: Ci.nsINavHistoryService.TRANSITION_TYPED,
}, {
date: new Date(TIMESTAMP1 / 1000),
transition: Ci.nsINavHistoryService.TRANSITION_LINK,
}]);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_store_create() {
_("Create a brand new record through the store.");
tbguid = Utils.makeGUID();
tburi = CommonUtils.makeURI("http://getthunderbird.com");
let onVisitObserved = promiseOnVisitObserved();
await applyEnsureNoFailures([
@@ -124,17 +124,17 @@ add_task(async function test_store_creat
let queryres = await PlacesUtils.history.fetch(tburi.spec, {
includeVisits: true,
});
Assert.equal(queryres.title, "The bird is the word!");
Assert.deepEqual(queryres.visits, [{
date: new Date(TIMESTAMP3 / 1000),
transition: Ci.nsINavHistoryService.TRANSITION_TYPED,
}]);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_null_title() {
_("Make sure we handle a null title gracefully (it can happen in some cases, e.g. for resource:// URLs)");
let resguid = Utils.makeGUID();
let resuri = CommonUtils.makeURI("unknown://title");
await applyEnsureNoFailures([
{id: resguid,
@@ -148,17 +148,17 @@ add_task(async function test_null_title(
let queryres = await PlacesUtils.history.fetch(resuri.spec, {
includeVisits: true,
});
Assert.equal(queryres.title, "");
Assert.deepEqual(queryres.visits, [{
date: new Date(TIMESTAMP3 / 1000),
transition: Ci.nsINavHistoryService.TRANSITION_TYPED,
}]);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_invalid_records() {
_("Make sure we handle invalid URLs in places databases gracefully.");
await PlacesUtils.withConnectionWrapper("test_invalid_record", async function(db) {
await db.execute(
"INSERT INTO moz_places "
+ "(url, url_hash, title, rev_host, visit_count, last_visit_date) "
@@ -431,17 +431,17 @@ add_task(async function test_getAllIDs_f
uri,
visitDate: Date.now() * 1000,
transition: PlacesUtils.history.TRANSITION_LINK
});
await visitAddedPromise;
do_check_attribute_count(await store.getAllIDs(), 0);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_applyIncomingBatch_filters_file_uris() {
const guid = Utils.makeGUID();
let uri = CommonUtils.makeURI("file:///Users/eoger/tps/config.json");
await applyEnsureNoFailures([
{id: guid,
histUri: uri.spec,
@@ -453,10 +453,10 @@ add_task(async function test_applyIncomi
let queryres = await PlacesUtils.history.fetch(uri.spec, {
includeVisits: true,
});
Assert.equal(null, queryres);
});
add_task(async function cleanup() {
_("Clean up.");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/services/sync/tests/unit/test_history_tracker.js
+++ b/services/sync/tests/unit/test_history_tracker.js
@@ -48,17 +48,17 @@ async function verifyTrackedItems(tracke
}
async function resetTracker() {
await tracker.clearChangedIDs();
tracker.resetScore();
}
async function cleanup() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await resetTracker();
await tracker.stop();
}
add_task(async function test_empty() {
_("Verify we've got an empty, disabled tracker to work with.");
await verifyTrackerEmpty();
Assert.ok(!tracker._isTracking);
--- a/toolkit/components/places/tests/PlacesTestUtils.jsm
+++ b/toolkit/components/places/tests/PlacesTestUtils.jsm
@@ -128,29 +128,16 @@ this.PlacesTestUtils = Object.freeze({
reject(ex);
}
}));
}
await Promise.all(faviconPromises);
},
/**
- * Clear all history.
- *
- * @return {Promise}
- * @resolves When history was cleared successfully.
- * @rejects JavaScript exception.
- *
- * @deprecated New consumers should directly use PlacesUtils.history.clear().
- */
- clearHistory() {
- return PlacesUtils.history.clear();
- },
-
- /**
* Waits for all pending async statements on the default connection.
*
* @return {Promise}
* @resolves When all pending async statements finished.
* @rejects Never.
*
* @note The result is achieved by asynchronously executing a query requiring
* a write lock. Since all statements on the same connection are
--- a/toolkit/components/places/tests/browser/browser_bug399606.js
+++ b/toolkit/components/places/tests/browser/browser_bug399606.js
@@ -1,14 +1,14 @@
/* 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/. */
add_task(async function() {
- registerCleanupFunction(PlacesTestUtils.clearHistory);
+ registerCleanupFunction(PlacesUtils.history.clear);
const URIS = [
"http://example.com/tests/toolkit/components/places/tests/browser/399606-window.location.href.html",
"http://example.com/tests/toolkit/components/places/tests/browser/399606-history.go-0.html",
"http://example.com/tests/toolkit/components/places/tests/browser/399606-location.replace.html",
"http://example.com/tests/toolkit/components/places/tests/browser/399606-location.reload.html",
"http://example.com/tests/toolkit/components/places/tests/browser/399606-httprefresh.html",
"http://example.com/tests/toolkit/components/places/tests/browser/399606-window.location.html",
--- a/toolkit/components/places/tests/browser/browser_bug461710.js
+++ b/toolkit/components/places/tests/browser/browser_bug461710.js
@@ -1,15 +1,15 @@
const kRed = "rgb(255, 0, 0)";
const kBlue = "rgb(0, 0, 255)";
const prefix = "http://example.com/tests/toolkit/components/places/tests/browser/461710_";
add_task(async function() {
- registerCleanupFunction(PlacesTestUtils.clearHistory);
+ registerCleanupFunction(PlacesUtils.history.clear);
let contentPage = prefix + "iframe.html";
let normalWindow = await BrowserTestUtils.openNewBrowserWindow();
let normalBrowser = normalWindow.gBrowser.selectedBrowser;
await BrowserTestUtils.loadURI(normalBrowser, contentPage);
await BrowserTestUtils.browserLoaded(normalBrowser, false, contentPage);
let privateWindow = await BrowserTestUtils.openNewBrowserWindow({private: true});
--- a/toolkit/components/places/tests/browser/browser_bug646422.js
+++ b/toolkit/components/places/tests/browser/browser_bug646422.js
@@ -41,11 +41,11 @@ add_task(async function() {
});
let newtitle = await newTitlePromise;
await ContentTask.spawn(tab.linkedBrowser, { newtitle }, async function(args) {
Assert.equal(args.newtitle, content.document.title, "Title after pushstate.");
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
gBrowser.removeTab(tab);
});
--- a/toolkit/components/places/tests/browser/browser_bug680727.js
+++ b/toolkit/components/places/tests/browser/browser_bug680727.js
@@ -92,16 +92,16 @@ function reloadListener() {
reloadAsyncListener(kUniqueURI, isVisited);
});
});
});
}
function reloadAsyncListener(aURI, aIsVisited) {
ok(kUniqueURI.equals(aURI) && aIsVisited, "We have visited the URI.");
- PlacesTestUtils.clearHistory().then(finish);
+ PlacesUtils.history.clear().then(finish);
}
registerCleanupFunction(async function() {
Services.prefs.setIntPref("network.proxy.type", proxyPrefValue);
Services.io.offline = false;
await BrowserTestUtils.removeTab(ourTab);
});
--- a/toolkit/components/places/tests/browser/browser_double_redirect.js
+++ b/toolkit/components/places/tests/browser/browser_double_redirect.js
@@ -1,14 +1,14 @@
// Test for bug 411966.
// When a page redirects multiple times, from_visit should point to the
// previous visit in the chain, not to the first visit in the chain.
add_task(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
const BASE_URL = "http://example.com/tests/toolkit/components/places/tests/browser/";
const TEST_URI = NetUtil.newURI(BASE_URL + "begin.html");
const FIRST_REDIRECTING_URI = NetUtil.newURI(BASE_URL + "redirect_twice.sjs");
const FINAL_URI = NetUtil.newURI(BASE_URL + "final.html");
let promiseVisits = new Promise(resolve => {
PlacesUtils.history.addObserver({
@@ -65,10 +65,10 @@ add_task(async function() {
url: TEST_URI.spec,
}, async function(browser) {
// Load begin page, click link on page to record visits.
await BrowserTestUtils.synthesizeMouseAtCenter("#clickme", {}, browser);
await promiseVisits;
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/browser/browser_notfound.js
+++ b/toolkit/components/places/tests/browser/browser_notfound.js
@@ -46,11 +46,11 @@ add_task(async function() {
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
};
PlacesUtils.history.addObserver(historyObserver);
});
let newTabPromise = BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
await Promise.all([visitedPromise, newTabPromise]);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
gBrowser.removeCurrentTab();
});
--- a/toolkit/components/places/tests/browser/browser_settitle.js
+++ b/toolkit/components/places/tests/browser/browser_settitle.js
@@ -61,11 +61,11 @@ add_task(async function() {
is(data[0].guid, getColumn("moz_places", "guid", data[0].uri.spec));
data.forEach(function(item) {
var title = getColumn("moz_places", "title", data[0].uri.spec);
is(title, item.title);
});
gBrowser.removeCurrentTab();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/browser/browser_visited_notfound.js
+++ b/toolkit/components/places/tests/browser/browser_visited_notfound.js
@@ -2,17 +2,17 @@ add_task(async function test() {
const TEST_URL = "http://mochi.test:8888/notFoundPage.html";
// Ensure that decay frecency doesn't kick in during tests (as a result
// of idle-daily).
Services.prefs.setCharPref("places.frecency.decayRate", "1.0");
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
registerCleanupFunction(async function() {
Services.prefs.clearUserPref("places.frecency.decayRate");
await BrowserTestUtils.removeTab(tab);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
// First add a visit to the page, this will ensure that later we skip
// updating the frecency for a newly not-found page.
await PlacesTestUtils.addVisits({ uri: TEST_URL });
let frecency = await PlacesTestUtils.fieldInDB(TEST_URL, "frecency");
is(frecency, 100, "Check initial frecency");
--- a/toolkit/components/places/tests/browser/browser_visituri.js
+++ b/toolkit/components/places/tests/browser/browser_visituri.js
@@ -71,12 +71,12 @@ add_task(async function() {
const testUrl = "http://example.com/tests/toolkit/components/places/tests/browser/begin.html";
await BrowserTestUtils.openNewForegroundTab(gBrowser, testUrl);
// Load begin page, click link on page to record visits.
await BrowserTestUtils.synthesizeMouseAtCenter("#clickme", { }, gBrowser.selectedBrowser);
await visitUriPromise;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
gBrowser.removeCurrentTab();
});
--- a/toolkit/components/places/tests/browser/browser_visituri_nohistory.js
+++ b/toolkit/components/places/tests/browser/browser_visituri_nohistory.js
@@ -30,11 +30,11 @@ add_task(async function() {
let browserLoadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gBrowser.loadURI(FINAL_URL);
await browserLoadedPromise;
let subject = await visitUriPromise;
let uri = subject.QueryInterface(Ci.nsIURI);
is(uri.spec, FINAL_URL, "received expected visit");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
gBrowser.removeCurrentTab();
});
--- a/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
+++ b/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
@@ -25,17 +25,17 @@ add_task(async function setup() {
}
}
};
});
Services.obs.addObserver(observer, "uri-visit-saved");
registerCleanupFunction(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
});
// Note: The private window test must be the first one to run, since we'll listen
// to the first uri-visit-saved notification, and we expect this test to not
// fire any, so we'll just find the non-private window test notification.
add_task(async function test_private_browsing_window() {
await testLoadInWindow({private: true}, initialURL);
--- a/toolkit/components/places/tests/chrome/test_favicon_annotations.xul
+++ b/toolkit/components/places/tests/chrome/test_favicon_annotations.xul
@@ -89,17 +89,17 @@ function loadNextTest()
let img = document.getElementById("favicon");
img.setAttribute("src", nextURI());
}
function test()
{
SimpleTest.waitForExplicitFinish();
(async () => {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
info("Inserting new visit");
await PlacesUtils.history.insert({
url: "http://example.com/favicon_annotations",
visits: [{
transition: PlacesUtils.history.TRANSITIONS.TYPED
}]
});
--- a/toolkit/components/places/tests/expiration/test_clearHistory.js
+++ b/toolkit/components/places/tests/expiration/test_clearHistory.js
@@ -46,17 +46,17 @@ add_task(async function test_historyClea
// expire as well.
let pageURI = uri("http://page_anno." + i + ".mozilla.org/");
await PlacesTestUtils.addVisits({ uri: pageURI });
as.setPageAnnotation(pageURI, "expire", "test", 0, as.EXPIRE_NEVER);
as.setPageAnnotation(pageURI, "expire_session", "test", 0, as.EXPIRE_SESSION);
}
// Expire all visits for the bookmarks
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
["expire_session",
"expire"].forEach(function(aAnno) {
let pages = as.getPagesWithAnnotation(aAnno);
Assert.equal(pages.length, 0);
});
["expire_session", "expire"].forEach(function(aAnno) {
--- a/toolkit/components/places/tests/expiration/test_debug_expiration.js
+++ b/toolkit/components/places/tests/expiration/test_debug_expiration.js
@@ -32,17 +32,17 @@ add_task(async function test_expire_orph
await promiseForceExpirationStep(0);
// Check that visits survived.
Assert.equal(visits_in_database("http://page1.mozilla.org/"), 1);
Assert.equal(visits_in_database("http://page2.mozilla.org/"), 1);
Assert.ok(!page_in_database("http://page3.mozilla.org/"));
// Clean up.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_expire_orphans_optionalarg() {
// Add visits to 2 pages and force a orphan expiration. Visits should survive.
await PlacesTestUtils.addVisits({
uri: uri("http://page1.mozilla.org/"),
visitDate: gNow++
});
@@ -62,17 +62,17 @@ add_task(async function test_expire_orph
await promiseForceExpirationStep();
// Check that visits survived.
Assert.equal(visits_in_database("http://page1.mozilla.org/"), 1);
Assert.equal(visits_in_database("http://page2.mozilla.org/"), 1);
Assert.ok(!page_in_database("http://page3.mozilla.org/"));
// Clean up.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_expire_limited() {
await PlacesTestUtils.addVisits([
{ // Should be expired cause it's the oldest visit
uri: "http://old.mozilla.org/",
visitDate: gNow++
},
@@ -86,17 +86,17 @@ add_task(async function test_expire_limi
await promiseForceExpirationStep(1);
// Check that newer visit survived.
Assert.equal(visits_in_database("http://new.mozilla.org/"), 1);
// Other visits should have been expired.
Assert.ok(!page_in_database("http://old.mozilla.org/"));
// Clean up.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_expire_limited_longurl() {
let longurl = "http://long.mozilla.org/" + "a".repeat(232);
await PlacesTestUtils.addVisits([
{ // Should be expired cause it's the oldest visit
uri: "http://old.mozilla.org/",
visitDate: gNow++
@@ -114,17 +114,17 @@ add_task(async function test_expire_limi
await promiseForceExpirationStep(1);
// Check that some visits survived.
Assert.equal(visits_in_database(longurl), 1);
// Other visits should have been expired.
Assert.ok(!page_in_database("http://old.mozilla.org/"));
// Clean up.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_expire_limited_exoticurl() {
await PlacesTestUtils.addVisits([
{ // Should be expired cause it's the oldest visit
uri: "http://old.mozilla.org/",
visitDate: gNow++
},
@@ -147,17 +147,17 @@ add_task(async function test_expire_limi
// The visits are gone, the url is not yet, cause we limited the expiration
// to one entry, and we already removed http://old.mozilla.org/.
// The page normally would be expired by the next expiration run.
Assert.equal(visits_in_database("http://download.mozilla.org/"), 0);
// Other visits should have been expired.
Assert.ok(!page_in_database("http://old.mozilla.org/"));
// Clean up.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_expire_unlimited() {
let longurl = "http://long.mozilla.org/" + "a".repeat(232);
await PlacesTestUtils.addVisits([
{
uri: "http://old.mozilla.org/",
visitDate: gNow++
@@ -200,17 +200,17 @@ add_task(async function test_expire_unli
Assert.equal(visits_in_database("http://nonexpirable-download.mozilla.org/"), 1);
Assert.equal(visits_in_database(longurl), 1);
// Other visits should have been expired.
Assert.ok(!page_in_database("http://old.mozilla.org/"));
Assert.ok(!page_in_database("http://download.mozilla.org/"));
Assert.ok(!page_in_database("http://new.mozilla.org/"));
// Clean up.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
function run_test() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
// Set maxPages to a low value, so it's easy to go over it.
setMaxPages(1);
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
@@ -96,15 +96,15 @@ add_task(async function test_notificatio
hs.removeObserver(historyObserver, false);
Assert.equal(currentTest.receivedNotifications,
currentTest.expectedNotifications);
// Clean up.
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
clearMaxPages();
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
@@ -124,15 +124,15 @@ add_task(async function test_notificatio
hs.removeObserver(historyObserver, false);
Assert.equal(currentTest.receivedNotifications,
currentTest.expectedNotifications);
// Clean up.
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
clearMaxPages();
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/expiration/test_pref_maxpages.js
+++ b/toolkit/components/places/tests/expiration/test_pref_maxpages.js
@@ -96,14 +96,14 @@ add_task(async function test_pref_maxpag
await promiseForceExpirationStep(-1);
PlacesUtils.history.removeObserver(historyObserver, false);
Assert.equal(currentTest.receivedNotifications,
currentTest.expectedNotifications);
// Clean up.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
clearMaxPages();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/favicons/test_copyFavicons.js
+++ b/toolkit/components/places/tests/favicons/test_copyFavicons.js
@@ -62,17 +62,17 @@ add_task(async function test_copyFavicon
null, "Icon should not have been copied");
info("Known uris, source has icon, private");
await PlacesTestUtils.addVisits(TEST_URI2);
Assert.equal(await copyFavicons(TEST_URI1, TEST_URI2, true),
null, "Icon should not have been copied");
PlacesUtils.favicons.expireAllFavicons();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_copyFavicons() {
info("Normal copy across 2 pages");
await PlacesTestUtils.addVisits(TEST_URI1);
await setFaviconForPage(TEST_URI1, SMALLPNG_DATA_URI);
await setFaviconForPage(TEST_URI1, SMALLSVG_DATA_URI);
await PlacesTestUtils.addVisits(TEST_URI2);
@@ -96,17 +96,17 @@ add_task(async function test_copyFavicon
Assert.equal((await promiseChange).spec,
TEST_URI3.spec, "Notification should have fired");
Assert.equal(await getFaviconUrlForPage(TEST_URI3, 1),
SMALLPNG_DATA_URI.spec, "Small icon found");
Assert.equal(await getFaviconUrlForPage(TEST_URI3),
SMALLSVG_DATA_URI.spec, "Large icon found");
PlacesUtils.favicons.expireAllFavicons();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_copyFavicons_overlap() {
info("Copy to a page that has one of the favicons already");
await PlacesTestUtils.addVisits(TEST_URI1);
await setFaviconForPage(TEST_URI1, SMALLPNG_DATA_URI);
await setFaviconForPage(TEST_URI1, SMALLSVG_DATA_URI);
await PlacesTestUtils.addVisits(TEST_URI2);
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
@@ -78,17 +78,17 @@ add_task(async function test_replaceFavi
pageURI, favicon.mimetype, favicon.data,
function test_replaceFaviconData_validHistoryURI_callback() {
favicon.file.remove(false);
resolve();
});
}, systemPrincipal);
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconData_overrideDefaultFavicon() {
info("test replaceFaviconData to override a later setAndFetchFaviconForPage");
let pageURI = uri("http://test2.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -110,17 +110,17 @@ add_task(async function test_replaceFavi
function test_replaceFaviconData_overrideDefaultFavicon_callback() {
firstFavicon.file.remove(false);
secondFavicon.file.remove(false);
resolve();
});
}, systemPrincipal);
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconData_replaceExisting() {
info("test replaceFaviconData to override a previous setAndFetchFaviconForPage");
let pageURI = uri("http://test3.bar");
await PlacesTestUtils.addVisits(pageURI);
@@ -147,17 +147,17 @@ add_task(async function test_replaceFavi
secondFavicon.file.remove(false);
resolve();
}, systemPrincipal);
});
});
}, systemPrincipal);
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconData_unrelatedReplace() {
info("test replaceFaviconData to not make unrelated changes");
let pageURI = uri("http://test4.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -179,17 +179,17 @@ add_task(async function test_replaceFavi
function test_replaceFaviconData_unrelatedReplace_callback() {
favicon.file.remove(false);
unrelatedFavicon.file.remove(false);
resolve();
});
}, systemPrincipal);
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconData_badInputs() {
info("test replaceFaviconData to throw on bad inputs");
let icon = createFavicon("favicon8.png");
Assert.throws(
() => iconsvc.replaceFaviconData(icon.uri, icon.data, icon.data.length, ""),
@@ -200,17 +200,17 @@ add_task(async function test_replaceFavi
Assert.throws(
() => iconsvc.replaceFaviconData(null, icon.data, icon.data.length, icon.mimetype),
/NS_ERROR_ILLEGAL_VALUE/);
Assert.throws(
() => iconsvc.replaceFaviconData(icon.uri, null, 0, icon.mimetype),
/NS_ERROR_ILLEGAL_VALUE/);
icon.file.remove(false);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconData_twiceReplace() {
info("test replaceFaviconData on multiple replacements");
let pageURI = uri("http://test5.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -235,10 +235,10 @@ add_task(async function test_replaceFavi
function test_replaceFaviconData_twiceReplace_callback() {
firstFavicon.file.remove(false);
secondFavicon.file.remove(false);
resolve();
}, systemPrincipal);
}, systemPrincipal);
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
@@ -80,17 +80,17 @@ add_task(async function test_replaceFavi
pageURI, favicon.mimetype, favicon.data,
function test_replaceFaviconDataFromDataURL_validHistoryURI_callback() {
favicon.file.remove(false);
resolve();
});
}, Services.scriptSecurityManager.getSystemPrincipal());
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
info("test replaceFaviconDataFromDataURL to override a later setAndFetchFaviconForPage");
let pageURI = uri("http://test2.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -111,17 +111,17 @@ add_task(async function test_replaceFavi
function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon_callback() {
firstFavicon.file.remove(false);
secondFavicon.file.remove(false);
resolve();
});
}, Services.scriptSecurityManager.getSystemPrincipal());
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconDataFromDataURL_replaceExisting() {
info("test replaceFaviconDataFromDataURL to override a previous setAndFetchFaviconForPage");
let pageURI = uri("http://test3.bar");
await PlacesTestUtils.addVisits(pageURI);
@@ -145,17 +145,17 @@ add_task(async function test_replaceFavi
firstFavicon.file.remove(false);
secondFavicon.file.remove(false);
resolve();
});
});
}, Services.scriptSecurityManager.getSystemPrincipal());
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
info("test replaceFaviconDataFromDataURL to not make unrelated changes");
let pageURI = uri("http://test4.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -176,17 +176,17 @@ add_task(async function test_replaceFavi
function test_replaceFaviconDataFromDataURL_unrelatedReplace_callback() {
favicon.file.remove(false);
unrelatedFavicon.file.remove(false);
resolve();
});
}, Services.scriptSecurityManager.getSystemPrincipal());
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconDataFromDataURL_badInputs() {
info("test replaceFaviconDataFromDataURL to throw on bad inputs");
let favicon = createFavicon("favicon8.png");
let ex = null;
@@ -206,17 +206,17 @@ add_task(async function test_replaceFavi
} catch (e) {
ex = e;
} finally {
Assert.ok(!!ex);
}
favicon.file.remove(false);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconDataFromDataURL_twiceReplace() {
info("test replaceFaviconDataFromDataURL on multiple replacements");
let pageURI = uri("http://test5.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -239,17 +239,17 @@ add_task(async function test_replaceFavi
function test_replaceFaviconDataFromDataURL_twiceReplace_callback() {
firstFavicon.file.remove(false);
secondFavicon.file.remove(false);
resolve();
});
}, Services.scriptSecurityManager.getSystemPrincipal());
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
info("test replaceFaviconDataFromDataURL after replaceFaviconData");
let pageURI = uri("http://test6.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -273,17 +273,17 @@ add_task(async function test_replaceFavi
function test_replaceFaviconDataFromDataURL_afterRegularAssign_callback() {
firstFavicon.file.remove(false);
secondFavicon.file.remove(false);
resolve();
});
}, Services.scriptSecurityManager.getSystemPrincipal());
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
info("test replaceFaviconDataFromDataURL before replaceFaviconData");
let pageURI = uri("http://test7.bar/");
await PlacesTestUtils.addVisits(pageURI);
@@ -307,17 +307,17 @@ add_task(async function test_replaceFavi
function test_replaceFaviconDataFromDataURL_beforeRegularAssign_callback() {
firstFavicon.file.remove(false);
secondFavicon.file.remove(false);
resolve();
});
}, Services.scriptSecurityManager.getSystemPrincipal());
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
/* toBase64 copied from image/test/unit/test_encoder_png.js */
/* Convert data (an array of integers) to a Base64 string. */
const toBase64Table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +
"0123456789+/";
const base64Pad = "=";
--- a/toolkit/components/places/tests/history/test_async_history_api.js
+++ b/toolkit/components/places/tests/history/test_async_history_api.js
@@ -1082,17 +1082,17 @@ add_task(async function test_callbacks_n
});
PlacesUtils.asyncHistory.updatePlaces(places, {});
await PlacesTestUtils.promiseAsyncUpdates();
});
// Test that we don't wrongly overwrite typed and hidden when adding new visits.
add_task(async function test_typed_hidden_not_overwritten() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let places = [
{ uri: NetUtil.newURI("http://mozilla.org/"),
title: "test",
visits: [
new VisitInfo(TRANSITION_TYPED),
new VisitInfo(TRANSITION_LINK)
]
},
@@ -1112,17 +1112,17 @@ add_task(async function test_typed_hidde
Assert.equal(rows[0].getResultByName("typed"), 1,
"The page should be marked as typed");
Assert.equal(rows[0].getResultByName("hidden"), 0,
"The page should be marked as not hidden");
await PlacesTestUtils.promiseAsyncUpdates();
});
add_task(async function test_omit_frecency_notifications() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let places = [
{ uri: NetUtil.newURI("http://mozilla.org/"),
title: "test",
visits: [
new VisitInfo(TRANSITION_TYPED),
]
},
{ uri: NetUtil.newURI("http://example.org/"),
@@ -1145,17 +1145,17 @@ add_task(async function test_omit_frecen
};
PlacesUtils.history.addObserver(frecencyObserverCheck);
});
await promiseUpdatePlaces(places, {}, true);
await promiseFrecenciesChanged;
});
add_task(async function test_ignore_errors() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// This test ensures that trying to add a visit, with a guid already found in
// another visit, fails - but doesn't report if we told it not to.
let place = {
uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_first"),
visits: [
new VisitInfo(),
],
};
@@ -1186,17 +1186,17 @@ add_task(async function test_ignore_erro
Assert.equal(placesResult.results.length, 0,
"Should have seen 0 results because there were none.");
Assert.equal(placesResult.resultCount, 0,
"Should know that we updated 0 items from the completion callback.");
await PlacesTestUtils.promiseAsyncUpdates();
});
add_task(async function test_ignore_results() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let place = {
uri: NetUtil.newURI("http://mozilla.org/"),
title: "test",
visits: [
new VisitInfo()
]
};
let placesResult = await promiseUpdatePlaces(place, {ignoreResults: true});
@@ -1205,17 +1205,17 @@ add_task(async function test_ignore_resu
Assert.equal(placesResult.errors.length, 0,
"Should have seen 0 errors because there were none.");
Assert.equal(placesResult.resultCount, 1,
"Should know that we updated 1 item from the completion callback.");
await PlacesTestUtils.promiseAsyncUpdates();
});
add_task(async function test_ignore_results_and_errors() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// This test ensures that trying to add a visit, with a guid already found in
// another visit, fails - but doesn't report if we told it not to.
let place = {
uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_first"),
visits: [
new VisitInfo(),
],
};
--- a/toolkit/components/places/tests/history/test_fetch.js
+++ b/toolkit/components/places/tests/history/test_fetch.js
@@ -1,13 +1,13 @@
/* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_fetch_existent() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
// Populate places and historyvisits.
let uriString = `http://mozilla.com/test_browserhistory/test_fetch`;
let uri = NetUtil.newURI(uriString);
let title = `Test Visit ${Math.random()}`;
let dates = [];
let visits = [];
@@ -73,17 +73,17 @@ add_task(async function test_fetch_exist
}
}
Assert.deepEqual(idealPageInfo, pageInfo);
}
}
});
add_task(async function test_fetch_page_meta_info() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let TEST_URI = NetUtil.newURI("http://mozilla.com/test_fetch_page_meta_info");
await PlacesTestUtils.addVisits(TEST_URI);
Assert.ok(page_in_database(TEST_URI));
// Test fetching the null values
let includeMeta = true;
let pageInfo = await PlacesUtils.history.fetch(TEST_URI, {includeMeta});
@@ -102,17 +102,17 @@ add_task(async function test_fetch_page_
includeMeta = false;
pageInfo = await PlacesUtils.history.fetch(TEST_URI, {includeMeta});
Assert.ok(!("description" in pageInfo), "fetch should not return a description if includeMeta is false");
Assert.ok(!("previewImageURL" in pageInfo), "fetch should not return a previewImageURL if includeMeta is false");
});
add_task(async function test_fetch_nonexistent() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
let uri = NetUtil.newURI("http://doesntexist.in.db");
let pageInfo = await PlacesUtils.history.fetch(uri);
Assert.equal(pageInfo, null);
});
add_task(async function test_error_cases() {
--- a/toolkit/components/places/tests/history/test_hasVisits.js
+++ b/toolkit/components/places/tests/history/test_hasVisits.js
@@ -21,23 +21,23 @@ add_task(async function test_has_visits_
/TypeError: Invalid url or guid: \[object Object\]/,
`passing an invalid (not of type URI or nsIURI) object to History.hasVisits
should throw a TypeError`
);
});
add_task(async function test_history_has_visits() {
const TEST_URL = "http://mozilla.com/";
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
Assert.equal(await PlacesUtils.history.hasVisits(TEST_URL), false,
"Test Url should not be in history.");
Assert.equal(await PlacesUtils.history.hasVisits(Services.io.newURI(TEST_URL)),
false, "Test Url should not be in history.");
await PlacesTestUtils.addVisits(TEST_URL);
Assert.equal(await PlacesUtils.history.hasVisits(TEST_URL), true,
"Test Url should be in history.");
Assert.equal(await PlacesUtils.history.hasVisits(Services.io.newURI(TEST_URL)),
true, "Test Url should be in history.");
let guid = await PlacesTestUtils.fieldInDB(TEST_URL, "guid");
Assert.equal(await PlacesUtils.history.hasVisits(guid),
true, "Test Url should be in history.");
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/history/test_insert.js
+++ b/toolkit/components/places/tests/history/test_insert.js
@@ -141,11 +141,11 @@ add_task(async function test_history_ins
for (let transition of [TRANSITION_LINK, null]) {
await inserter("Testing History.insert() with an nsIURI", x => x, referrer, date, transition);
await inserter("Testing History.insert() with a string url", x => x.spec, referrer, date, transition);
await inserter("Testing History.insert() with a URL object", x => new URL(x.spec), referrer, date, transition);
}
}
}
} finally {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
});
--- a/toolkit/components/places/tests/history/test_insertMany.js
+++ b/toolkit/components/places/tests/history/test_insertMany.js
@@ -66,17 +66,17 @@ add_task(async function test_insertMany(
};
PlacesUtils.history.addObserver(obs);
});
}
info(name);
info(`filter: ${filter}`);
info(`useCallbacks: ${useCallbacks}`);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let result;
let allUrls = GOOD_URLS.concat(BAD_URLS);
let pageInfos = await makePageInfos(allUrls, filter);
if (useCallbacks) {
let onResultUrls = [];
let onErrorUrls = [];
@@ -119,17 +119,17 @@ add_task(async function test_insertMany(
// Test rejection when no items added
let pageInfos = await makePageInfos(BAD_URLS);
PlacesUtils.history.insertMany(pageInfos).then(() => {
Assert.ok(false, "History.insertMany rejected promise with all bad URLs");
}, error => {
Assert.equal("No items were added to history.", error.message, "History.insertMany rejected promise with all bad URLs");
});
} finally {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
});
add_task(async function test_transitions() {
const places = Object.keys(PlacesUtils.history.TRANSITIONS).map(transition => {
return { url: `http://places.test/${transition}`,
visits: [
{ transition: PlacesUtils.history.TRANSITIONS[transition] }
--- a/toolkit/components/places/tests/history/test_remove.js
+++ b/toolkit/components/places/tests/history/test_remove.js
@@ -5,17 +5,17 @@
"use strict";
Cu.importGlobalProperties(["URL"]);
// Test removing a single page
add_task(async function test_remove_single() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
let WITNESS_URI = NetUtil.newURI("http://mozilla.com/test_browserhistory/test_remove/" + Math.random());
await PlacesTestUtils.addVisits(WITNESS_URI);
Assert.ok(page_in_database(WITNESS_URI));
let remover = async function(name, filter, options) {
@@ -126,22 +126,22 @@ add_task(async function test_remove_sing
await remover("Testing History.remove() with a single string url", x => x.spec, options);
await remover("Testing History.remove() with a single string guid", x => do_get_guid_for_uri(x), options);
await remover("Testing History.remove() with a single URI in an array", x => [x], options);
await remover("Testing History.remove() with a single string url in an array", x => [x.spec], options);
await remover("Testing History.remove() with a single string guid in an array", x => [do_get_guid_for_uri(x)], options);
}
}
} finally {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
});
add_task(async function cleanup() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
});
// Test the various error cases
add_task(async function test_error_cases() {
Assert.throws(
() => PlacesUtils.history.remove(),
/TypeError: Invalid url/,
--- a/toolkit/components/places/tests/history/test_removeByFilter.js
+++ b/toolkit/components/places/tests/history/test_removeByFilter.js
@@ -15,17 +15,17 @@
* Case B 3: Page has multiple subhosts, not removed since wildcard doesn't match
* Case C: Combinations tests
* Case C 1: Single hostname, multiple visits, at least one in timeframe and hostname
* Case C 2: Random subhosts, multiple visits, at least one in timeframe and hostname-wildcard
*/
add_task(async function test_removeByFilter() {
// Cleanup
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
// Adding a witness URI
let witnessURI = NetUtil.newURI("http://witnessmozilla.org/test_browserhistory/test_removeByFilter" + Math.random());
await PlacesTestUtils.addVisits(witnessURI);
Assert.ok((await PlacesTestUtils.isPageInDB(witnessURI)), "Witness URI is in database");
let removeByFilterTester = async function(visits, filter, checkBeforeRemove, checkAfterRemove, useCallback, bookmarkedUri) {
--- a/toolkit/components/places/tests/history/test_removeMany.js
+++ b/toolkit/components/places/tests/history/test_removeMany.js
@@ -6,17 +6,17 @@
"use strict";
// Test removing a list of pages
add_task(async function test_remove_many() {
// This is set so that we are guaranteed to trigger REMOVE_PAGES_CHUNKLEN.
const SIZE = 310;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
info("Adding a witness page");
let WITNESS_URI = NetUtil.newURI("http://mozilla.com/test_browserhistory/test_remove/" + Math.random());
await PlacesTestUtils.addVisits(WITNESS_URI);
Assert.ok(page_in_database(WITNESS_URI), "Witness page added");
info("Generating samples");
@@ -138,11 +138,11 @@ add_task(async function test_remove_many
Assert.ok(page.onFrecencyChangedCalled ^ page.onDeleteURICalled, "Either onFrecencyChanged or onDeleteURI was called");
}
Assert.notEqual(visits_in_database(WITNESS_URI), 0, "Witness URI still has visits");
Assert.notEqual(page_in_database(WITNESS_URI), 0, "Witness URI is still here");
});
add_task(async function cleanup() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
});
--- a/toolkit/components/places/tests/history/test_removeVisits.js
+++ b/toolkit/components/places/tests/history/test_removeVisits.js
@@ -1,14 +1,14 @@
const JS_NOW = Date.now();
const DB_NOW = JS_NOW * 1000;
const TEST_URI = uri("http://example.com/");
async function cleanup() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
// This is needed to remove place: entries.
DBConn().executeSimpleSQL("DELETE FROM moz_places");
}
add_task(async function remove_visits_outside_unbookmarked_uri() {
info("*** TEST: Remove some visits outside valid timeframe from an unbookmarked URI");
--- a/toolkit/components/places/tests/history/test_removeVisitsByFilter.js
+++ b/toolkit/components/places/tests/history/test_removeVisitsByFilter.js
@@ -13,17 +13,17 @@ add_task(async function test_removeVisit
let referenceDate = new Date(1999, 9, 9, 9, 9);
// Populate a database with 20 entries, remove a subset of entries,
// ensure consistency.
let remover = async function(options) {
info("Remover with options " + JSON.stringify(options));
let SAMPLE_SIZE = options.sampleSize;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
// Populate the database.
// Create `SAMPLE_SIZE` visits, from the oldest to the newest.
let bookmarkIndices = new Set(options.bookmarks);
let visits = [];
let frecencyChangePromises = new Map();
@@ -253,17 +253,17 @@ add_task(async function test_removeVisit
options.url = 1;
await remover(options);
options.url = 2;
await remover(options);
options.url = 3;
await remover(options);
}
}
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
// Test the various error cases
add_task(async function test_error_cases() {
Assert.throws(
() => PlacesUtils.history.removeVisitsByFilter(),
/TypeError: Expected a filter/
);
--- a/toolkit/components/places/tests/history/test_update.js
+++ b/toolkit/components/places/tests/history/test_update.js
@@ -63,17 +63,17 @@ add_task(async function test_error_cases
Assert.throws(
() => PlacesUtils.history.update({ url: "http://valid.uri.com" }),
/TypeError: pageInfo object must at least/,
"passing a pageInfo with neither description nor previewImageURL should throw a TypeError"
);
});
add_task(async function test_description_change_saved() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let TEST_URL = "http://mozilla.org/test_description_change_saved";
await PlacesTestUtils.addVisits(TEST_URL);
Assert.ok(await PlacesTestUtils.isPageInDB(TEST_URL));
let description = "Test description";
await PlacesUtils.history.update({ url: TEST_URL, description });
let descriptionInDB = await PlacesTestUtils.fieldInDB(TEST_URL, "description");
@@ -97,17 +97,17 @@ add_task(async function test_description
description = null;
await PlacesUtils.history.update({ url: TEST_URL, description});
descriptionInDB = await PlacesTestUtils.fieldInDB(TEST_URL, "description");
Assert.strictEqual(description, descriptionInDB, "a null description should set it to null in the database");
});
add_task(async function test_previewImageURL_change_saved() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let TEST_URL = "http://mozilla.org/test_previewImageURL_change_saved";
let IMAGE_URL = "http://mozilla.org/test_preview_image.png";
await PlacesTestUtils.addVisits(TEST_URL);
Assert.ok(await PlacesTestUtils.isPageInDB(TEST_URL));
let previewImageURL = IMAGE_URL;
await PlacesUtils.history.update({ url: TEST_URL, previewImageURL });
@@ -122,17 +122,17 @@ add_task(async function test_previewImag
let guid = await PlacesTestUtils.fieldInDB(TEST_URL, "guid");
previewImageURL = IMAGE_URL;
await PlacesUtils.history.update({ url: TEST_URL, guid, previewImageURL });
previewImageURLInDB = await PlacesTestUtils.fieldInDB(TEST_URL, "preview_image_url");
Assert.equal(previewImageURL, previewImageURLInDB, "previewImageURL should be updated via GUID as expected");
});
add_task(async function test_change_both_saved() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let TEST_URL = "http://mozilla.org/test_change_both_saved";
await PlacesTestUtils.addVisits(TEST_URL);
Assert.ok(await PlacesTestUtils.isPageInDB(TEST_URL));
let description = "Test description";
let previewImageURL = "http://mozilla.org/test_preview_image.png";
--- a/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
+++ b/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
@@ -63,17 +63,17 @@ add_task(async function pages_query() {
let uri = NetUtil.newURI(node.uri);
await PlacesTestUtils.addVisits({uri, title: "changedTitle"});
Assert.equal(node.title, "changedTitle");
await PlacesTestUtils.addVisits({uri, title: gTestData[i].title});
Assert.equal(node.title, gTestData[i].title);
}
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function visits_query() {
await task_populateDB(gTestData);
let [query, options] = newQueryWithOptions();
options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT;
let root = PlacesUtils.history.executeQuery(query, options).root;
@@ -89,17 +89,17 @@ add_task(async function visits_query() {
node = searchNodeHavingUrl(root, testData.uri);
Assert.equal(node.title, "changedTitle");
await PlacesTestUtils.addVisits({uri, title: testData.title});
node = searchNodeHavingUrl(root, testData.uri);
Assert.equal(node.title, testData.title);
}
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function pages_searchterm_query() {
await task_populateDB(gTestData);
let [query, options] = newQueryWithOptions();
query.searchTerms = "example";
let root = PlacesUtils.history.executeQuery(query, options).root;
@@ -112,17 +112,17 @@ add_task(async function pages_searchterm
Assert.equal(node.title, gTestData[i].title);
await PlacesTestUtils.addVisits({uri, title: "changedTitle"});
Assert.equal(node.title, "changedTitle");
await PlacesTestUtils.addVisits({uri, title: gTestData[i].title});
Assert.equal(node.title, gTestData[i].title);
}
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function visits_searchterm_query() {
await task_populateDB(gTestData);
let [query, options] = newQueryWithOptions();
query.searchTerms = "example";
options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT;
@@ -138,17 +138,17 @@ add_task(async function visits_searchter
node = searchNodeHavingUrl(root, testData.uri);
Assert.equal(node.title, "changedTitle");
await PlacesTestUtils.addVisits({uri, title: testData.title});
node = searchNodeHavingUrl(root, testData.uri);
Assert.equal(node.title, testData.title);
}
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function pages_searchterm_is_title_query() {
await task_populateDB(gTestData);
let [query, options] = newQueryWithOptions();
query.searchTerms = "match";
let root = PlacesUtils.history.executeQuery(query, options).root;
@@ -163,17 +163,17 @@ add_task(async function pages_searchterm
compareArrayToResult([data], root);
data.title = origTitle;
await PlacesTestUtils.addVisits({ uri, title: data.title,
visitDate: data.lastVisit });
compareArrayToResult([], root);
}
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function visits_searchterm_is_title_query() {
await task_populateDB(gTestData);
let [query, options] = newQueryWithOptions();
query.searchTerms = "match";
options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT;
@@ -194,10 +194,10 @@ add_task(async function visits_searchter
info("Clobbering " + uri.spec);
await PlacesTestUtils.addVisits({ uri, title: data.title,
visitDate: data.lastVisit });
compareArrayToResult([], root);
}
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/queries/test_redirects.js
+++ b/toolkit/components/places/tests/queries/test_redirects.js
@@ -293,10 +293,10 @@ add_task(async function test_redirects()
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING,
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING];
// Will execute check_results_callback() for each generated combination.
cartProd([includeHidden_options, maxResults_options, sorting_options],
check_results_callback);
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/queries/test_sorting.js
+++ b/toolkit/components/places/tests/queries/test_sorting.js
@@ -1249,11 +1249,11 @@ 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 PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
});
--- a/toolkit/components/places/tests/queries/test_tags.js
+++ b/toolkit/components/places/tests/queries/test_tags.js
@@ -602,17 +602,17 @@ function addBookmark(aURI) {
});
}
/**
* Asynchronous task that removes all pages from history and bookmarks.
*/
async function task_cleanDatabase(aCallback) {
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
/**
* Sets up a query with the specified tags, converts it to a URI, and makes sure
* the URI is what we expect it to be.
*
* @param aTags
* The query's tags will be set to those in this array
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -36,17 +36,17 @@ async function cleanup() {
"openpage",
"searches",
];
for (let type of suggestPrefs) {
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
}
Services.prefs.clearUserPref("browser.search.suggest.enabled");
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
registerCleanupFunction(cleanup);
/**
* @param {Array} aSearches Array of AutoCompleteSearch names.
*/
function AutoCompleteInput(aSearches) {
this.searches = aSearches;
--- a/toolkit/components/places/tests/unit/test_317472.js
+++ b/toolkit/components/places/tests/unit/test_317472.js
@@ -36,17 +36,17 @@ add_task(async function test_execute() {
Assert.equal(PlacesUtils.annotations.getPageAnnotation(TEST_URI, CHARSET_ANNO), charset);
// get charset from not-bookmarked page
Assert.equal((await PlacesUtils.getCharsetForURI(TEST_URI)), charset);
// get charset from bookmarked page
Assert.equal((await PlacesUtils.getCharsetForURI(TEST_BOOKMARKED_URI)), charset);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
// ensure that charset has gone for not-bookmarked page
Assert.notEqual((await PlacesUtils.getCharsetForURI(TEST_URI)), charset);
// check that page annotation has been removed
try {
PlacesUtils.annotations.getPageAnnotation(TEST_URI, CHARSET_ANNO);
do_throw("Charset page annotation has not been removed correctly");
--- a/toolkit/components/places/tests/unit/test_412132.js
+++ b/toolkit/components/places/tests/unit/test_412132.js
@@ -36,17 +36,17 @@ add_task(async function changeuri_unvisi
});
await PlacesTestUtils.promiseAsyncUpdates();
Assert.equal(frecencyForUrl(TEST_URL1), 0,
"Unvisited URI no longer bookmarked => frecency should = 0");
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function changeuri_visited_bookmark() {
info("After changing URI of bookmark, frecency of bookmark's " +
"original URI should not be zero if original URI is visited.");
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "bookmark title",
@@ -68,17 +68,17 @@ add_task(async function changeuri_visite
});
await PlacesTestUtils.promiseAsyncUpdates();
Assert.notEqual(frecencyForUrl(TEST_URL1), 0,
"*Visited* URI no longer bookmarked => frecency should != 0");
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function changeuri_bookmark_still_bookmarked() {
info("After changing URI of bookmark, frecency of bookmark's " +
"original URI should not be zero if original URI is still " +
"bookmarked.");
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
@@ -103,17 +103,17 @@ add_task(async function changeuri_bookma
});
await PlacesTestUtils.promiseAsyncUpdates();
info("URI still bookmarked => frecency should != 0");
Assert.notEqual(frecencyForUrl(TEST_URL2), 0);
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function changeuri_nonexistent_bookmark() {
// Try a bogus guid.
await Assert.rejects(PlacesUtils.bookmarks.update({
guid: "ABCDEDFGHIJK",
url: TEST_URL2
}), /No bookmarks found for the provided GUID/,
@@ -130,10 +130,10 @@ add_task(async function changeuri_nonexi
await Assert.rejects(PlacesUtils.bookmarks.update({
guid: bookmark.guid,
url: TEST_URL2
}), /No bookmarks found for the provided GUID/,
"Changing the URI of a non-existent bookmark should fail.");
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/places/tests/unit/test_adaptive.js
+++ b/toolkit/components/places/tests/unit/test_adaptive.js
@@ -385,15 +385,15 @@ add_task(async function test_adaptive()
// Cleanup.
await PlacesUtils.bookmarks.eraseEverything();
let types = ["history", "bookmark", "openpage"];
for (let type of types) {
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
}
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let resultsCompletedPromise = promiseResultsCompleted();
await test();
await resultsCompletedPromise;
}
});
--- a/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
+++ b/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
@@ -70,12 +70,12 @@ add_task(async function test_bookmarks_q
cleanupTest().then(resolve);
},
});
});
});
function cleanupTest() {
return Promise.all([
- PlacesTestUtils.clearHistory(),
+ PlacesUtils.history.clear(),
PlacesUtils.bookmarks.eraseEverything()
]);
}
--- a/toolkit/components/places/tests/unit/test_browserhistory.js
+++ b/toolkit/components/places/tests/unit/test_browserhistory.js
@@ -53,17 +53,17 @@ add_task(async function test_removePages
// Check the annotation on the non-bookmarked page does not exist anymore.
try {
PlacesUtils.annotations.getPageAnnotation(pages[ANNO_INDEX], ANNO_NAME);
do_throw("did not expire expire_never anno on a not bookmarked item");
} catch (ex) {}
// Cleanup.
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_removePagesByTimeframe() {
let visits = [];
let startDate = (Date.now() - 10000) * 1000;
for (let i = 0; i < 10; i++) {
visits.push({
uri: NetUtil.newURI(TEST_URI.spec + i),
@@ -95,17 +95,17 @@ add_task(async function test_removePages
add_task(async function test_removePagesFromHost_keepSubdomains() {
await PlacesTestUtils.addVisits([{ uri: TEST_URI }, { uri: TEST_SUBDOMAIN_URI }]);
PlacesUtils.history.removePagesFromHost("mozilla.com", false);
Assert.equal(1, PlacesUtils.history.hasHistoryEntries);
});
add_task(async function test_history_clear() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
Assert.equal(0, PlacesUtils.history.hasHistoryEntries);
});
add_task(async function test_getObservers() {
// Ensure that getObservers() invalidates the hasHistoryEntries cache.
await PlacesTestUtils.addVisits(TEST_URI);
Assert.equal(1, PlacesUtils.history.hasHistoryEntries);
// This is just for testing purposes, never do it.
--- a/toolkit/components/places/tests/unit/test_download_history.js
+++ b/toolkit/components/places/tests/unit/test_download_history.js
@@ -115,17 +115,17 @@ add_test(function test_dh_addMultiRemove
waitForOnVisit(function DHAD_onVisit(aURI) {
Assert.ok(aURI.equals(DOWNLOAD_URI));
Assert.ok(!!page_in_database(DOWNLOAD_URI));
waitForOnDeleteVisits(function DHRAD_onDeleteVisits(aDeletedURI) {
Assert.ok(aDeletedURI.equals(DOWNLOAD_URI));
Assert.ok(!!page_in_database(DOWNLOAD_URI));
- PlacesTestUtils.clearHistory().then(run_next_test);
+ PlacesUtils.history.clear().then(run_next_test);
});
gDownloadHistory.removeAllDownloads();
});
gDownloadHistory.addDownload(DOWNLOAD_URI, null, Date.now() * 1000);
});
});
@@ -140,17 +140,17 @@ add_task(async function test_dh_addBookm
waitForOnVisit(function DHAD_onVisit(aURI) {
Assert.ok(aURI.equals(DOWNLOAD_URI));
Assert.ok(!!page_in_database(DOWNLOAD_URI));
waitForOnDeleteVisits(function DHRAD_onDeleteVisits(aDeletedURI) {
Assert.ok(aDeletedURI.equals(DOWNLOAD_URI));
Assert.ok(!!page_in_database(DOWNLOAD_URI));
- PlacesTestUtils.clearHistory().then(resolve);
+ PlacesUtils.history.clear().then(resolve);
});
gDownloadHistory.removeAllDownloads();
});
gDownloadHistory.addDownload(DOWNLOAD_URI, null, Date.now() * 1000);
});
});
@@ -162,17 +162,17 @@ add_test(function test_dh_addDownload_re
waitForOnVisit(function DHAD_onVisit(aVisitedURI, unused, unused2, unused3,
aReferringID) {
Assert.ok(aVisitedURI.equals(DOWNLOAD_URI));
Assert.equal(aReferringID, referrerVisitId);
// Verify that the URI is already available in results at this time.
Assert.ok(!!page_in_database(DOWNLOAD_URI));
- PlacesTestUtils.clearHistory().then(run_next_test);
+ PlacesUtils.history.clear().then(run_next_test);
});
gDownloadHistory.addDownload(DOWNLOAD_URI, REFERRER_URI, Date.now() * 1000);
});
// Note that we don't pass the optional callback argument here because we must
// ensure that we receive the onVisits notification before we call addDownload.
PlacesUtils.asyncHistory.updatePlaces({
@@ -190,17 +190,17 @@ add_test(function test_dh_addDownload_di
// test is based on the assumption that visit notifications are received in
// the same order of the addDownload calls, which is currently true because
// database access is serialized on the same worker thread.
Assert.ok(aURI.equals(DOWNLOAD_URI));
Assert.ok(!!page_in_database(DOWNLOAD_URI));
Assert.ok(!page_in_database(PRIVATE_URI));
- PlacesTestUtils.clearHistory().then(run_next_test);
+ PlacesUtils.history.clear().then(run_next_test);
});
Services.prefs.setBoolPref("places.history.enabled", false);
gDownloadHistory.addDownload(PRIVATE_URI, REFERRER_URI, Date.now() * 1000);
// The addDownload functions calls CanAddURI synchronously, thus we can set
// the preference back to true immediately (not all apps enable places by
// default).
@@ -223,17 +223,17 @@ add_test(function test_dh_details() {
let titleSet = false;
let destinationFileUriSet = false;
function checkFinished() {
if (titleSet && destinationFileUriSet) {
PlacesUtils.annotations.removeObserver(annoObserver);
PlacesUtils.history.removeObserver(historyObserver);
- PlacesTestUtils.clearHistory().then(run_next_test);
+ PlacesUtils.history.clear().then(run_next_test);
}
}
let annoObserver = {
onPageAnnotationSet: function AO_onPageAnnotationSet(aPage, aName) {
if (aPage.equals(SOURCE_URI)) {
let value = PlacesUtils.annotations.getPageAnnotation(aPage, aName);
switch (aName) {
--- a/toolkit/components/places/tests/unit/test_frecency.js
+++ b/toolkit/components/places/tests/unit/test_frecency.js
@@ -268,16 +268,16 @@ add_task(async function test_frecency()
Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.urlbar.autoFill"));
// always search in history + bookmarks, no matter what the default is
Services.prefs.setBoolPref("browser.urlbar.suggest.history", true);
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true);
Services.prefs.setBoolPref("browser.urlbar.suggest.openpage", false);
for (let test of tests) {
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await test();
}
for (let type of ["history", "bookmark", "openpage"]) {
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
}
});
--- a/toolkit/components/places/tests/unit/test_frecency_observers.js
+++ b/toolkit/components/places/tests/unit/test_frecency_observers.js
@@ -40,17 +40,17 @@ add_task(async function test_nsNavHistor
title: "test"
});
PlacesUtils.history.removePagesFromHost(url.host, false);
await onFrecencyChanged(url);
});
// nsNavHistory::invalidateFrecencies for all pages
add_task(async function test_nsNavHistory_invalidateFrecencies_allPages() {
- await Promise.all([onManyFrecenciesChanged(), PlacesTestUtils.clearHistory()]);
+ await Promise.all([onManyFrecenciesChanged(), PlacesUtils.history.clear()]);
});
// nsNavHistory::DecayFrecency and nsNavHistory::FixInvalidFrecencies
add_task(async function test_nsNavHistory_DecayFrecency_and_nsNavHistory_FixInvalidFrecencies() {
// FixInvalidFrecencies is at the end of a path that DecayFrecency is also on,
// so expect two notifications. Trigger the path by making nsNavHistory
// observe the idle-daily notification.
PlacesUtils.history.QueryInterface(Ci.nsIObserver).
--- a/toolkit/components/places/tests/unit/test_hosts_triggers.js
+++ b/toolkit/components/places/tests/unit/test_hosts_triggers.js
@@ -116,33 +116,33 @@ add_task(async function test_bookmark_ch
Assert.ok(isHostInMozPlaces(testUri));
// Change the hostname
await PlacesUtils.bookmarks.update({
guid: bookmark.guid,
url: NEW_URL,
});
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
let newUri = NetUtil.newURI(NEW_URL);
Assert.ok(isHostInMozPlaces(newUri));
checkHostInMozHosts(newUri, false, null);
checkHostNotInMozHosts(NetUtil.newURI("http://test.mozilla.org"), false, null);
});
add_task(async function test_bookmark_removal() {
// Get the last bookmark.
let unfiledBookmarksRoot =
await PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
let itemGuid =
unfiledBookmarksRoot.getChild(unfiledBookmarksRoot.childCount - 1).bookmarkGuid;
await PlacesUtils.bookmarks.remove(itemGuid);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
checkHostNotInMozHosts(Services.io.newURI(NEW_URL), false, null);
});
add_task(async function test_moz_hosts_typed_update() {
const TEST_URI = NetUtil.newURI("http://typed.mozilla.com");
let places = [{ uri: TEST_URI,
title: "test for " + TEST_URI.spec
@@ -150,17 +150,17 @@ add_task(async function test_moz_hosts_t
{ uri: TEST_URI,
title: "test for " + TEST_URI.spec,
transition: TRANSITION_TYPED
}];
await PlacesTestUtils.addVisits(places);
checkHostInMozHosts(TEST_URI, true, null);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_moz_hosts_www_remove() {
async function test_removal(aURIToRemove, aURIToKeep, aCallback) {
let places = [{ uri: aURIToRemove,
title: "test for " + aURIToRemove.spec,
transition: TRANSITION_TYPED
},
@@ -179,17 +179,17 @@ add_task(async function test_moz_hosts_w
dump_table("moz_places");
checkHostInMozHosts(aURIToKeep, true, prefix);
}
const TEST_URI = NetUtil.newURI("http://rem.mozilla.com");
const TEST_WWW_URI = NetUtil.newURI("http://www.rem.mozilla.com");
await test_removal(TEST_URI, TEST_WWW_URI);
await test_removal(TEST_WWW_URI, TEST_URI);
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_moz_hosts_ftp_matchall() {
const TEST_URI_1 = NetUtil.newURI("ftp://www.mozilla.com/");
const TEST_URI_2 = NetUtil.newURI("ftp://mozilla.com/");
await PlacesTestUtils.addVisits([
{ uri: TEST_URI_1, transition: TRANSITION_TYPED },
--- a/toolkit/components/places/tests/unit/test_isURIVisited.js
+++ b/toolkit/components/places/tests/unit/test_isURIVisited.js
@@ -51,17 +51,17 @@ function* step() {
handleResult() {},
handleCompletion() {
info("Added visit to " + uri.spec);
history.isURIVisited(uri, function(aURI2, aIsVisited2) {
Assert.ok(uri.equals(aURI2));
Assert.ok(SCHEMES[scheme] ? aIsVisited2 : !aIsVisited2);
- PlacesTestUtils.clearHistory().then(function() {
+ PlacesUtils.history.clear().then(function() {
history.isURIVisited(uri, function(aURI3, aIsVisited3) {
Assert.ok(uri.equals(aURI3));
Assert.ok(!aIsVisited3);
gRunner.next();
});
});
});
},
--- a/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
+++ b/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
@@ -115,17 +115,17 @@ add_test(function check_history_query()
// nsINavHistoryResultObserver.sortingChanged
resultObserver.invalidatedContainer = null;
result.sortingMode = options.SORT_BY_TITLE_ASCENDING;
Assert.equal(resultObserver.sortingMode, options.SORT_BY_TITLE_ASCENDING);
Assert.equal(resultObserver.invalidatedContainer, result.root);
// nsINavHistoryResultObserver.invalidateContainer
- PlacesTestUtils.clearHistory().then(() => {
+ PlacesUtils.history.clear().then(() => {
Assert.equal(root.uri, resultObserver.invalidatedContainer.uri);
// nsINavHistoryResultObserver.batching
Assert.ok(!resultObserver.inBatchMode);
PlacesUtils.history.runInBatchMode({
runBatched(aUserData) {
Assert.ok(resultObserver.inBatchMode);
}
--- a/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
+++ b/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
@@ -129,17 +129,17 @@ add_task(async function test_addVisitAnd
let root = histsvc.executeQuery(query, options).root;
root.containerOpen = true;
Assert.equal(root.childCount, 1);
do_check_valid_places_guid(root.getChild(0).pageGuid);
Assert.equal(root.getChild(0).bookmarkGuid, "");
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_addItemsWithInvalidGUIDsFails() {
const INVALID_GUID = "XYZ";
try {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
guid: INVALID_GUID,
--- a/toolkit/components/places/tests/unit/test_resultsAsVisit_details.js
+++ b/toolkit/components/places/tests/unit/test_resultsAsVisit_details.js
@@ -54,17 +54,17 @@ add_task(async function test_addVisitChe
child = root.getChild(0);
equal(child.visitType, 0, "Visit type should be 0");
equal(child.visitId, -1, "Visit ID should be -1");
equal(child.fromVisitId, -1, "Referrer visit id should be -1");
root.containerOpen = false;
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_bookmarkFields() {
let bookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
title: "test folder",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
--- a/toolkit/components/places/tests/unit/test_sync_utils.js
+++ b/toolkit/components/places/tests/unit/test_sync_utils.js
@@ -176,17 +176,17 @@ add_task(async function test_fetchURLFre
// Do not add visits to the following URLs, and then check if frecency for those URLs is -1.
let arrayOfURLsNotVisited = ["https://bugzilla.org", "https://example.org"];
for (let url of arrayOfURLsNotVisited) {
let frecency = await PlacesSyncUtils.history.fetchURLFrecency(url);
equal(frecency, -1, "The frecency of this url should be -1");
}
// Remove the visits added during this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_determineNonSyncableGuids() {
// Add visits to the following URLs with different transition types.
let arrayOfVisits = [{ uri: "https://www.mozilla.org/en-US/", transition: TRANSITION_TYPED },
{ uri: "http://getfirefox.com/", transition: TRANSITION_LINK },
{ uri: "http://getthunderbird.com/", transition: TRANSITION_FRAMED_LINK }];
for (let visit of arrayOfVisits) {
@@ -210,17 +210,17 @@ add_task(async function test_determineNo
if (visit.transition === TRANSITION_FRAMED_LINK) {
ok(filteredGuids.includes(dictURLGuid[visit.uri]), "This url should be one of the filtered guids.");
} else {
ok(!filteredGuids.includes(dictURLGuid[visit.uri]), "This url should not be one of the filtered guids.");
}
}
// Remove the visits added during this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_changeGuid() {
// Add some visits of the following URLs.
let arrayOfURLsToVisit = ["https://www.mozilla.org/en-US/", "http://getfirefox.com/", "http://getthunderbird.com/"];
for (let url of arrayOfURLsToVisit) {
await PlacesTestUtils.addVisits(url);
}
@@ -236,17 +236,17 @@ add_task(async function test_changeGuid(
let newGuidFetched = await PlacesSyncUtils.history.fetchGuidForURL(url);
// Check that the URL has the new GUID as its GUID and not the original one.
equal(newGuid, newGuidFetched, "These should be equal since we changed the guid for the visit.");
notEqual(originalGuid, newGuidFetched, "These should be different since we changed the guid for the visit.");
}
// Remove the visits added during this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_fetchVisitsForURL() {
// Get the date for this moment and a date for a minute ago.
let now = new Date();
let aMinuteAgo = new Date(now.getTime() - (1 * 60000));
// Add some visits of the following URLs, specifying the transition and the visit date.
@@ -267,17 +267,17 @@ add_task(async function test_fetchVisits
let dateInMilliseconds = visits[iLast].date * 0.001;
// Check that the info we provided for this URL is the same one retrieved.
equal(dateInMilliseconds, elem.visitDate.getTime(), "The date we provided should be the same we retrieved.");
equal(visits[iLast].type, elem.transition, "The transition type we provided should be the same we retrieved.");
}
// Remove the visits added during this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_fetchGuidForURL() {
// Add some visits of the following URLs.
let arrayOfURLsToVisit = ["https://www.mozilla.org/en-US/", "http://getfirefox.com/", "http://getthunderbird.com/"];
for (let url of arrayOfURLsToVisit) {
await PlacesTestUtils.addVisits(url);
}
@@ -294,17 +294,17 @@ add_task(async function test_fetchGuidFo
await PlacesSyncUtils.history.changeGuid(url, newGuid);
let newGuid2 = await PlacesSyncUtils.history.fetchGuidForURL(url);
equal(url, info.url, "The url provided and the url retrieved should be the same.");
equal(newGuid, newGuid2, "The changed guid and the retrieved guid should be the same.");
}
// Remove the visits added during this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_fetchURLInfoForGuid() {
// Add some visits of the following URLs. specifying the title.
let visits = [{ uri: "https://www.mozilla.org/en-US/", title: "mozilla" },
{ uri: "http://getfirefox.com/", title: "firefox" },
{ uri: "http://getthunderbird.com/", title: "thunderbird" },
{ uri: "http://quantum.mozilla.com/", title: null}];
@@ -325,17 +325,17 @@ add_task(async function test_fetchURLInf
// Create a "fake" GUID and check that the result of fetchURLInfoForGuid is null.
let guid = makeGuid();
let info = await PlacesSyncUtils.history.fetchURLInfoForGuid(guid);
equal(info, null, "The information object of a non-existent guid should be null.");
// Remove the visits added during this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_getAllURLs() {
// Add some visits of the following URLs.
let arrayOfURLsToVisit = ["https://www.mozilla.org/en-US/", "http://getfirefox.com/", "http://getthunderbird.com/"];
for (let url of arrayOfURLsToVisit) {
await PlacesTestUtils.addVisits(url);
}
@@ -347,17 +347,17 @@ add_task(async function test_getAllURLs(
equal(allURLs.length, arrayOfURLsToVisit.length, "The amount of urls retrived should match the amount of urls provided.");
// Check that the correct URLs were retrived.
for (let url of arrayOfURLsToVisit) {
ok(allURLs.includes(url), "The urls retrieved should match the ones used in this test.");
}
// Remove the visits added during this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function test_order() {
info("Insert some bookmarks");
let guids = await populateTree(PlacesUtils.bookmarks.menuGuid, {
kind: "bookmark",
title: "childBmk",
url: "http://getfirefox.com",
--- a/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js
+++ b/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js
@@ -28,17 +28,17 @@ add_task(async function removed_bookmark
await PlacesUtils.bookmarks.remove(bm);
await PlacesTestUtils.promiseAsyncUpdates();
info("Unvisited URI no longer bookmarked => frecency should = 0");
Assert.equal(frecencyForUrl(TEST_URI), 0);
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function removed_but_visited_bookmark() {
info("After removing bookmark, frecency of bookmark's URI should " +
"not be zero if URI is visited.");
const TEST_URI = Services.io.newURI("http://example.com/1");
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
@@ -53,17 +53,17 @@ add_task(async function removed_but_visi
await PlacesTestUtils.addVisits(TEST_URI);
await PlacesUtils.bookmarks.remove(bm);
await PlacesTestUtils.promiseAsyncUpdates();
info("*Visited* URI no longer bookmarked => frecency should != 0");
Assert.notEqual(frecencyForUrl(TEST_URI), 0);
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function remove_bookmark_still_bookmarked() {
info("After removing bookmark, frecency of bookmark's URI should " +
"not be zero if URI is still bookmarked.");
const TEST_URI = Services.io.newURI("http://example.com/1");
let bm1 = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
@@ -82,17 +82,17 @@ add_task(async function remove_bookmark_
await PlacesUtils.bookmarks.remove(bm1);
await PlacesTestUtils.promiseAsyncUpdates();
info("URI still bookmarked => frecency should != 0");
Assert.notEqual(frecencyForUrl(TEST_URI), 0);
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function cleared_parent_of_visited_bookmark() {
info("After removing all children from bookmark's parent, frecency " +
"of bookmark's URI should not be zero if URI is visited.");
const TEST_URI = Services.io.newURI("http://example.com/1");
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
@@ -107,17 +107,17 @@ add_task(async function cleared_parent_o
await PlacesTestUtils.addVisits(TEST_URI);
await PlacesUtils.bookmarks.eraseEverything();
await PlacesTestUtils.promiseAsyncUpdates();
info("*Visited* URI no longer bookmarked => frecency should != 0");
Assert.notEqual(frecencyForUrl(TEST_URI), 0);
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
add_task(async function cleared_parent_of_bookmark_still_bookmarked() {
info("After removing all children from bookmark's parent, frecency " +
"of bookmark's URI should not be zero if URI is still " +
"bookmarked.");
const TEST_URI = Services.io.newURI("http://example.com/1");
await PlacesUtils.bookmarks.insert({
@@ -142,10 +142,10 @@ add_task(async function cleared_parent_o
Assert.notEqual(frecencyForUrl(TEST_URI), 0);
await PlacesUtils.bookmarks.remove(folder);
await PlacesTestUtils.promiseAsyncUpdates();
// URI still bookmarked => frecency should != 0.
Assert.notEqual(frecencyForUrl(TEST_URI), 0);
await PlacesUtils.bookmarks.eraseEverything();
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
--- a/toolkit/components/thumbnails/test/browser_thumbnails_bg_topsites.js
+++ b/toolkit/components/thumbnails/test/browser_thumbnails_bg_topsites.js
@@ -33,10 +33,10 @@ function* runTests() {
let topSites = yield gBrowserThumbnails._topSiteURLs;
ok(topSites.includes("http://mozilla1.com/"), "Top site did not have a rich icon - get a screenshot");
ok(topSites.includes("http://mozilla3.com/"), "Top site did not have an icon - get a screenshot");
ok(topSites.includes("http://mozilla4.com/"), "Site is pinned - get a screenshot");
ok(!topSites.includes("http://mozilla2.com/"), "Top site had a rich icon - do not get a screenshot");
// Clean up
NewTabUtils.pinnedLinks.unpin(pinnedSite);
- yield PlacesTestUtils.clearHistory();
+ yield PlacesUtils.history.clear();
}
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -207,17 +207,17 @@ async function test_history_not_cleared_
const TEST_URI = Services.io.newURI("http://ilovemozilla.org/foo");
Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
await PlacesTestUtils.addVisits(TEST_URI);
Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
await ForgetAboutSite.removeDataFromDomain("mozilla.org");
Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
// Clear history since we left something there from this test.
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
}
// Cookie Service
async function test_cookie_cleared_with_direct_match() {
const TEST_DOMAIN = "mozilla.org";
add_cookie(TEST_DOMAIN);
await ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_cookie_exists(TEST_DOMAIN, false);
--- a/toolkit/modules/tests/xpcshell/head.js
+++ b/toolkit/modules/tests/xpcshell/head.js
@@ -29,17 +29,17 @@ function timeDaysAgo(numDays) {
function isVisitDateOK(timestampMS) {
let range = 10 * 24 * 60 * 60 * 1000;
return Math.abs(Date.now() - timestampMS) < range;
}
// a set up function to prep the activity stream provider
function setUpActivityStreamTest() {
return (async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.eraseEverything();
let faviconExpiredPromise = new Promise(resolve => {
Services.obs.addObserver(resolve, "places-favicons-expired");
});
PlacesUtils.favicons.expireAllFavicons();
await faviconExpiredPromise;
})();
}