Bug 676713 - Removed duplicate implementations of waitForClearHistory. r=mak77
--- a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
+++ b/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
@@ -134,23 +134,8 @@ let tests = {
// get the Unsorted Bookmarks node
PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
// now we can see what is in the _content tree
let unsortedNode = PlacesOrganizer._content.view.nodeForTreeIndex(1);
ok(unsortedNode, "unsortedNode is not null: " + unsortedNode.uri);
is(unsortedNode.uri, MOZURISPEC, "node uri's are the same");
},
};
-
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback) {
- const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
--- a/browser/components/places/tests/browser/browser_forgetthissite_single.js
+++ b/browser/components/places/tests/browser/browser_forgetthissite_single.js
@@ -32,35 +32,16 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// This test makes sure that the Forget This Site command is hidden for multiple
// selections.
-
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback) {
- const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
-
- let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
-}
-
function test() {
// initialization
waitForExplicitFinish();
// Add a history entry.
let TEST_URIs = ["http://www.mozilla.org/test1", "http://www.mozilla.org/test2"];
ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
let history = PlacesUtils.history;
--- a/browser/components/places/tests/browser/browser_history_sidebar_search.js
+++ b/browser/components/places/tests/browser/browser_history_sidebar_search.js
@@ -43,30 +43,16 @@ var hs = Cc["@mozilla.org/browser/nav-hi
getService(Ci.nsINavHistoryService);
var bh = hs.QueryInterface(Ci.nsIBrowserHistory);
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
function uri(spec) {
return ios.newURI(spec, null, null);
}
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback(aSubject, aTopic, aData);
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
-
var sidebar = document.getElementById("sidebar");
function add_visit(aURI, aDate) {
var visitId = hs.addVisit(aURI,
aDate,
null, // no referrer
hs.TRANSITION_TYPED, // user typed in URL bar
false, // not redirect
--- a/browser/components/places/tests/browser/browser_library_panel_leak.js
+++ b/browser/components/places/tests/browser/browser_library_panel_leak.js
@@ -78,19 +78,8 @@ function test() {
// Add an history entry.
ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
PlacesUtils.history.addVisit(PlacesUtils._uri(TEST_URI), Date.now() * 1000,
null, PlacesUtils.history.TRANSITION_TYPED,
false, 0);
openLibrary(onLibraryReady);
}
-
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback(aSubject, aTopic, aData);
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
--- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js
+++ b/browser/components/places/tests/browser/browser_sidebarpanels_click.js
@@ -168,24 +168,16 @@ function test() {
EventUtils.synthesizeMouse(aTree.body, x, y, {},
aTree.ownerDocument.defaultView);
}
function changeSidebarDirection(aDirection) {
sidebar.contentDocument.documentElement.style.direction = aDirection;
}
- function waitForClearHistory(aCallback) {
- Services.obs.addObserver(function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(arguments.callee, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback(aSubject, aTopic, aData);
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
- }
-
function runNextTest() {
// Remove eventual tabs created by previous sub-tests.
while (gBrowser.tabs.length > 1) {
gBrowser.removeTab(gBrowser.tabContainer.lastChild);
}
if (tests.length == 0) {
finish();