diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index f7d3a2c7050..825d806bb60 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 872ba95cc99..4eefd6a91ae 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index a8944db01e5..8c04ddede37 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 8771e12ed79..153752ecc70 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 872ba95cc99..4eefd6a91ae 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 868db93faf7..dbb9fd296d6 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index ae899cd92e3..37fe74c814d 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 338b8ad4c0d..e42c66259b7 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
{
"git": {
- "git_revision": "e45c5dbdcfc2d598c889dfbea72fa11157422afe",
+ "git_revision": "917b6c36717fddc6e71ffc1ec249633c8044c93c",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
- "revision": "ecc956a2747963c2db6edf513cd3a8a75ca8884a",
+ "revision": "3033c2214b5863d8ac50d2067b34c5cb02fb054d",
"repo_path": "integration/gaia-central"
}
diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml
index 35af55566cc..b89f8433b22 100644
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml
index 7117e308ca6..e1f3880f466 100644
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 8bd6e3bc230..d9e82dafb97 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml
index d24b438df8d..aad2ff0689d 100644
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/browser/base/content/test/general/browser_action_searchengine.js b/browser/base/content/test/general/browser_action_searchengine.js
index 96130a3d54b..0f9eba739bb 100644
--- a/browser/base/content/test/general/browser_action_searchengine.js
+++ b/browser/base/content/test/general/browser_action_searchengine.js
@@ -26,7 +26,7 @@ add_task(function* () {
gBrowser.removeTab(tab);
} catch(ex) { /* tab may have already been closed in case of failure */ }
- return promiseClearHistory();
+ return PlacesTestUtils.clearHistory();
});
yield promiseAutocompleteResultPopup("open a search");
diff --git a/browser/base/content/test/general/browser_action_searchengine_alias.js b/browser/base/content/test/general/browser_action_searchengine_alias.js
index 9a252204b36..7fd966554a3 100644
--- a/browser/base/content/test/general/browser_action_searchengine_alias.js
+++ b/browser/base/content/test/general/browser_action_searchengine_alias.js
@@ -26,7 +26,7 @@ add_task(function* () {
gBrowser.removeTab(tab);
} catch(ex) { /* tab may have already been closed in case of failure */ }
- return promiseClearHistory();
+ return PlacesTestUtils.clearHistory();
});
yield promiseAutocompleteResultPopup("moz open a search");
diff --git a/browser/base/content/test/general/browser_autocomplete_autoselect.js b/browser/base/content/test/general/browser_autocomplete_autoselect.js
index 123e97693ba..cd2571b00cd 100644
--- a/browser/base/content/test/general/browser_autocomplete_autoselect.js
+++ b/browser/base/content/test/general/browser_autocomplete_autoselect.js
@@ -15,7 +15,7 @@ add_task(function*() {
return;
}
- registerCleanupFunction(promiseClearHistory);
+ registerCleanupFunction(() => PlacesTestUtils.clearHistory());
let visits = [];
repeat(10, i => {
diff --git a/browser/base/content/test/general/browser_autocomplete_oldschool_wrap.js b/browser/base/content/test/general/browser_autocomplete_oldschool_wrap.js
index b60012e3a49..110c1ffefed 100644
--- a/browser/base/content/test/general/browser_autocomplete_oldschool_wrap.js
+++ b/browser/base/content/test/general/browser_autocomplete_oldschool_wrap.js
@@ -15,7 +15,7 @@ add_task(function*() {
return;
}
- registerCleanupFunction(promiseClearHistory);
+ registerCleanupFunction(() => PlacesTestUtils.clearHistory());
let visits = [];
repeat(10, i => {
diff --git a/browser/base/content/test/general/browser_bug1003461-switchtab-override.js b/browser/base/content/test/general/browser_bug1003461-switchtab-override.js
index 8b1b68b90cd..b94cf7f3c64 100644
--- a/browser/base/content/test/general/browser_bug1003461-switchtab-override.js
+++ b/browser/base/content/test/general/browser_bug1003461-switchtab-override.js
@@ -66,5 +66,5 @@ add_task(function* test_switchtab_override() {
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
yield deferred.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/browser/base/content/test/general/browser_bug1024133-switchtab-override-keynav.js b/browser/base/content/test/general/browser_bug1024133-switchtab-override-keynav.js
index 2a5fb0b7265..8a781e00a23 100644
--- a/browser/base/content/test/general/browser_bug1024133-switchtab-override-keynav.js
+++ b/browser/base/content/test/general/browser_bug1024133-switchtab-override-keynav.js
@@ -18,7 +18,7 @@ add_task(function* test_switchtab_override_keynav() {
gBrowser.removeTab(tab);
gBrowser.removeTab(secondTab);
} catch(ex) { /* tabs may have already been closed in case of failure */ }
- return promiseClearHistory();
+ return PlacesTestUtils.clearHistory();
});
gURLBar.focus();
diff --git a/browser/base/content/test/general/browser_bug581253.js b/browser/base/content/test/general/browser_bug581253.js
index 3d257511894..373fc6999d9 100644
--- a/browser/base/content/test/general/browser_bug581253.js
+++ b/browser/base/content/test/general/browser_bug581253.js
@@ -70,22 +70,6 @@ function onPanelShown(aEvent) {
}
}
-/**
- * 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();
-}
-
function onPanelHidden(aEvent) {
if (aEvent.target == StarUI.panel) {
StarUI.panel.removeEventListener("popuphidden", arguments.callee, false);
@@ -96,7 +80,7 @@ function onPanelHidden(aEvent) {
is(BookmarkingUI.status, BookmarkingUI.STATUS_UNSTARRED,
"star button indicates that the bookmark has been removed");
gBrowser.removeCurrentTab();
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
}
}
diff --git a/browser/base/content/test/general/browser_sanitizeDialog.js b/browser/base/content/test/general/browser_sanitizeDialog.js
index b4152d350d4..0612d695fce 100644
--- a/browser/base/content/test/general/browser_sanitizeDialog.js
+++ b/browser/base/content/test/general/browser_sanitizeDialog.js
@@ -976,40 +976,32 @@ function formNameExists(name)
* Removes all history visits, downloads, and form entries.
*/
function blankSlate() {
- PlacesUtils.bhistory.removeAllPages();
-
- // The promise is resolved only when removing both downloads and form history are done.
- let deferred = Promise.defer();
- let formHistoryDone = false, downloadsDone = false;
-
- Task.spawn(function deleteAllDownloads() {
+ let deleteDownloads = Task.spawn(function* deleteAllDownloads() {
let publicList = yield Downloads.getList(Downloads.PUBLIC);
let downloads = yield publicList.getAll();
for (let download of downloads) {
yield publicList.remove(download);
yield download.finalize(true);
}
- downloadsDone = true;
- if (formHistoryDone) {
- deferred.resolve();
- }
}).then(null, Components.utils.reportError);
- FormHistory.update({ op: "remove" },
- { handleError: function (error) {
- do_throw("Error occurred updating form history: " + error);
- deferred.reject(error);
- },
- handleCompletion: function (reason) {
- if (!reason) {
- formHistoryDone = true;
- if (downloadsDone) {
- deferred.resolve();
- }
- }
- }
- });
- return deferred.promise;
+ let updateFormHistory = new Promise((resolve, reject) => {
+ FormHistory.update({op: "remove"}, {
+ handleCompletion(reason) {
+ if (!reason) {
+ resolve();
+ }
+ },
+
+ handleError(error) {
+ do_throw("Error occurred updating form history: " + error);
+ reject(error);
+ }
+ });
+ });
+
+ return Promise.all([
+ PlacesTestUtils.clearHistory(), deleteDownloads, updateFormHistory]);
}
/**
diff --git a/browser/base/content/test/general/browser_search_favicon.js b/browser/base/content/test/general/browser_search_favicon.js
index 81b329cc4be..c16ebe9e913 100644
--- a/browser/base/content/test/general/browser_search_favicon.js
+++ b/browser/base/content/test/general/browser_search_favicon.js
@@ -72,7 +72,7 @@ registerCleanupFunction(() => {
Services.prefs.clearUserPref(gRestyleSearchesPref);
Services.search.currentEngine = gOriginalEngine;
Services.search.removeEngine(gEngine);
- return promiseClearHistory();
+ return PlacesTestUtils.clearHistory();
});
add_task(function*() {
diff --git a/browser/base/content/test/general/browser_tabMatchesInAwesomebar.js b/browser/base/content/test/general/browser_tabMatchesInAwesomebar.js
index 88ae2b9f93e..bdf01bb244e 100644
--- a/browser/base/content/test/general/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/general/browser_tabMatchesInAwesomebar.js
@@ -150,8 +150,7 @@ function nextStep() {
gBrowser.removeCurrentTab();
}
- waitForClearHistory(finish);
-
+ PlacesTestUtils.clearHistory().then(finish);
return;
}
@@ -184,22 +183,6 @@ function ensure_opentabs_match_db(aCallback) {
checkAutocompleteResults(tabs, aCallback);
}
-/**
- * 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();
-}
-
function checkAutocompleteResults(aExpected, aCallback)
{
gController.input = {
diff --git a/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js b/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js
index 88c74cac129..57377f39a4c 100644
--- a/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js
+++ b/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js
@@ -61,20 +61,12 @@ function continue_test() {
EventUtils.synthesizeKey("VK_DOWN", {});
is(gURLBar.textValue, "www.autofilltrimurl.com/whatever", "trim was applied correctly");
gURLBar.closePopup();
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
});
});
}
-function waitForClearHistory(aCallback) {
- Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
-
let gOnSearchComplete = null;
function waitForSearchComplete(aCallback) {
info("Waiting for onSearchComplete");
diff --git a/browser/base/content/test/general/browser_urlbarEnterAfterMouseOver.js b/browser/base/content/test/general/browser_urlbarEnterAfterMouseOver.js
index 47f7873212d..6eb6b2c5839 100644
--- a/browser/base/content/test/general/browser_urlbarEnterAfterMouseOver.js
+++ b/browser/base/content/test/general/browser_urlbarEnterAfterMouseOver.js
@@ -16,9 +16,9 @@ function is_selected(index) {
}
add_task(function*() {
- registerCleanupFunction(promiseClearHistory);
+ registerCleanupFunction(() => PlacesTestUtils.clearHistory());
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
let tabCount = gBrowser.tabs.length;
let visits = [];
diff --git a/browser/base/content/test/general/head.js b/browser/base/content/test/general/head.js
index 707930910e2..a4fffd65df2 100644
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -383,40 +383,6 @@ function promiseHistoryClearedState(aURIs, aShouldBeCleared) {
return deferred.promise;
}
-/**
- * Allows waiting for an observer notification once.
- *
- * @param topic
- * Notification topic to observe.
- *
- * @return {Promise}
- * @resolves The array [subject, data] from the observed notification.
- * @rejects Never.
- */
-function promiseTopicObserved(topic)
-{
- let deferred = Promise.defer();
- info("Waiting for observer topic " + topic);
- Services.obs.addObserver(function PTO_observe(subject, topic, data) {
- Services.obs.removeObserver(PTO_observe, topic);
- deferred.resolve([subject, data]);
- }, topic, false);
- return deferred.promise;
-}
-
-/**
- * Clears history asynchronously.
- *
- * @return {Promise}
- * @resolves When history has been cleared.
- * @rejects Never.
- */
-function promiseClearHistory() {
- let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- PlacesUtils.bhistory.removeAllPages();
- return promise;
-}
-
/**
* Waits for the next top-level document load in the current browser. The URI
* of the document is compared against aExpectedURL. The load is then stopped
diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js
index 890939847dc..58a33e1c6de 100644
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -10,11 +10,12 @@ let tmp = {};
Cu.import("resource://gre/modules/Promise.jsm", tmp);
Cu.import("resource://gre/modules/NewTabUtils.jsm", tmp);
Cu.import("resource:///modules/DirectoryLinksProvider.jsm", tmp);
+Cu.import("resource://testing-common/PlacesTestUtils.jsm", tmp);
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://browser/content/sanitize.js", tmp);
Cu.import("resource://gre/modules/Timer.jsm", tmp);
-let {Promise, NewTabUtils, Sanitizer, clearTimeout, setTimeout, DirectoryLinksProvider} = tmp;
+let {Promise, NewTabUtils, Sanitizer, clearTimeout, setTimeout, DirectoryLinksProvider, PlacesTestUtils} = tmp;
let uri = Services.io.newURI("about:newtab", null, null);
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
@@ -154,7 +155,7 @@ let TestRunner = {
*/
finish: function () {
function cleanupAndFinish() {
- clearHistory(function () {
+ PlacesTestUtils.clearHistory().then(() => {
whenPagesUpdated(finish);
NewTabUtils.restore();
});
@@ -229,7 +230,7 @@ function setLinks(aLinks, aCallback = TestRunner.next) {
// given entries and call populateCache() now again to make sure the cache
// has the desired contents.
NewTabUtils.links.populateCache(function () {
- clearHistory(function () {
+ PlacesTestUtils.clearHistory().then(() => {
fillHistory(links, function () {
NewTabUtils.links.populateCache(function () {
NewTabUtils.allPages.update();
@@ -240,15 +241,6 @@ function setLinks(aLinks, aCallback = TestRunner.next) {
});
}
-function clearHistory(aCallback) {
- Services.obs.addObserver(function observe(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observe, aTopic);
- executeSoon(aCallback);
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
-
- PlacesUtils.history.removeAllPages();
-}
-
function fillHistory(aLinks, aCallback = TestRunner.next) {
let numLinks = aLinks.length;
if (!numLinks) {
diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml
index eb6226f5654..dd9fac9f9f2 100644
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -2211,7 +2211,6 @@
_doorhangerTitle.value =
gNavigatorBundle.getFormattedString(
"badContentBlocked.notblocked.message", [this._brandShortName]);
-
if (this.notification.options.state &
Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT) {
_doorhangerTitle.value =
@@ -2252,6 +2251,10 @@
Services.urlFormatter.formatURLPref("app.support.baseURL")
+ "tracking-protection";
}
+ if (Services.prefs.getBoolPref("privacy.trackingprotection.enabled")) {
+ let histogram = Services.telemetry.getHistogramById("TRACKING_PROTECTION_EVENTS");
+ histogram.add(0);
+ }
]]>
+
+
+
diff --git a/browser/components/loop/standalone/content/js/webapp.js b/browser/components/loop/standalone/content/js/webapp.js
index de5509a7a42..c491356ffe8 100644
--- a/browser/components/loop/standalone/content/js/webapp.js
+++ b/browser/components/loop/standalone/content/js/webapp.js
@@ -19,6 +19,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
var sharedModels = loop.shared.models;
var sharedViews = loop.shared.views;
var sharedUtils = loop.shared.utils;
+ var WEBSOCKET_REASONS = loop.shared.utils.WEBSOCKET_REASONS;
var multiplexGum = loop.standaloneMedia.multiplexGum;
@@ -892,7 +893,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
_handleCallTerminated: function(reason) {
multiplexGum.reset();
- if (reason === "cancel") {
+ if (reason === WEBSOCKET_REASONS.CANCEL) {
this.setState({callStatus: "start"});
return;
}
diff --git a/browser/components/loop/test/functional/config.py b/browser/components/loop/test/functional/config.py
index 71aabe4b471..ed95163322a 100644
--- a/browser/components/loop/test/functional/config.py
+++ b/browser/components/loop/test/functional/config.py
@@ -7,7 +7,7 @@ FIREFOX_PREFERENCES = {
# Some more changes might be necesarry to have this working in offline mode
"media.peerconnection.default_iceservers": "[]",
"media.peerconnection.use_document_iceservers": False,
- "stun.allow_loopback": True,
+ "media.peerconnection.ice.loopback": True,
"devtools.chrome.enabled": True,
"devtools.debugger.prompt-connection": False,
"devtools.debugger.remote-enabled": True,
diff --git a/browser/components/loop/test/functional/test_1_browser_call.py b/browser/components/loop/test/functional/test_1_browser_call.py
index 078dbdfbbf1..13109b1010a 100644
--- a/browser/components/loop/test/functional/test_1_browser_call.py
+++ b/browser/components/loop/test/functional/test_1_browser_call.py
@@ -10,6 +10,8 @@ import os
import sys
sys.path.insert(1, os.path.dirname(os.path.abspath(__file__)))
+import pyperclip
+
from serversetup import LoopTestServers
from config import *
@@ -39,13 +41,29 @@ class Test1BrowserCall(MarionetteTestCase):
.until(lambda m: m.find_element(by, locator).is_displayed())
return self.marionette.find_element(by, locator)
- # XXX workaround for Marionette bug 1055309
+ def wait_for_subelement_displayed(self, parent, by, locator, timeout=None):
+ Wait(self.marionette, timeout,
+ ignored_exceptions=[NoSuchElementException, StaleElementException])\
+ .until(lambda m: parent.find_element(by, locator).is_displayed())
+ return parent.find_element(by, locator)
+
+ # XXX workaround for Marionette bug 1094246
def wait_for_element_exists(self, by, locator, timeout=None):
Wait(self.marionette, timeout,
ignored_exceptions=[NoSuchElementException, StaleElementException]) \
.until(lambda m: m.find_element(by, locator))
return self.marionette.find_element(by, locator)
+ def wait_for_element_enabled(self, element, timeout=10):
+ Wait(self.marionette, timeout) \
+ .until(lambda e: element.is_enabled(),
+ message="Timed out waiting for element to be enabled")
+
+ def wait_for_element_attribute_to_be_false(self, element, attribute, timeout=10):
+ Wait(self.marionette, timeout) \
+ .until(lambda e: element.get_attribute(attribute) == "false",
+ message="Timeout out waiting for " + attribute + " to be false")
+
def switch_to_panel(self):
button = self.marionette.find_element(By.ID, "loop-button")
@@ -56,66 +74,80 @@ class Test1BrowserCall(MarionetteTestCase):
frame = self.marionette.find_element(By.ID, "loop-panel-iframe")
self.marionette.switch_to_frame(frame)
- def load_and_verify_standalone_ui(self, url):
- self.marionette.set_context("content")
- self.marionette.navigate(url)
-
- def start_a_conversation(self):
- # TODO: wait for react elements
- sleep(2)
- button = self.marionette.find_element(By.CSS_SELECTOR, ".rooms .btn-info")
-
- # click the element
- button.click()
-
- def get_and_verify_call_url(self):
- # in the new room model we have to first start a conversation
- self.start_a_conversation()
-
- # TODO: wait for react elements
- sleep(2)
- call_url = self.marionette.find_element(By.CLASS_NAME, \
- "room-url-link").text
-
- self.assertIn(urlparse.urlparse(call_url).scheme, ['http', 'https'],
- "call URL returned by server " + call_url +
- " has invalid scheme")
- return call_url
-
- def start_and_verify_outgoing_call(self):
- # TODO: wait for react elements
- sleep(2)
- # make the call!
- call_button = self.marionette.find_element(By.CLASS_NAME,
- "btn-join")
- call_button.click()
-
- def accept_and_verify_incoming_call(self):
+ def switch_to_chatbox(self):
self.marionette.set_context("chrome")
self.marionette.switch_to_frame()
# XXX should be using wait_for_element_displayed, but need to wait
- # for Marionette bug 1055309 to be fixed.
+ # for Marionette bug 1094246 to be fixed.
chatbox = self.wait_for_element_exists(By.TAG_NAME, 'chatbox')
script = ("return document.getAnonymousElementByAttribute("
"arguments[0], 'class', 'chat-frame');")
frame = self.marionette.execute_script(script, [chatbox])
self.marionette.switch_to_frame(frame)
- # expect a video container on desktop side
- video = self.wait_for_element_displayed(By.CLASS_NAME, "media")
- self.assertEqual(video.tag_name, "div", "expect a video container")
+ def switch_to_standalone(self):
+ self.marionette.set_context("content")
- def hangup_call_and_verify_feedback(self):
- self.marionette.set_context("chrome")
+ def local_start_a_conversation(self):
+ button = self.marionette.find_element(By.CSS_SELECTOR, ".rooms .btn-info")
+
+ self.wait_for_element_enabled(button, 120)
+
+ button.click()
+
+ def local_check_room_self_video(self):
+ self.switch_to_chatbox()
+
+ # expect a video container on desktop side
+ media_container = self.wait_for_element_displayed(By.CLASS_NAME, "media")
+ self.assertEqual(media_container.tag_name, "div", "expect a video container")
+
+ def local_get_and_verify_room_url(self):
+ button = self.wait_for_element_displayed(By.CLASS_NAME, "btn-copy")
+
+ button.click()
+
+ # click the element
+ room_url = pyperclip.paste()
+
+ self.assertIn(urlparse.urlparse(room_url).scheme, ['http', 'https'],
+ "room URL returned by server " + room_url +
+ " has invalid scheme")
+ return room_url
+
+ def standalone_load_and_join_room(self, url):
+ self.switch_to_standalone()
+ self.marionette.navigate(url)
+
+ # Join the room
+ join_button = self.wait_for_element_displayed(By.CLASS_NAME,
+ "btn-join")
+ join_button.click()
+
+ # Assumes the standlone or the conversation window is selected first.
+ def check_remote_video(self):
+ # TODO: This is disabled currently due to bug 1122486
+ # video_wrapper = self.wait_for_element_displayed(By.CSS_SELECTOR, ".media .OT_subscriber .OT_video-container", 20)
+ # video = self.wait_for_subelement_displayed(video_wrapper, By.TAG_NAME, "video")
+
+ # self.wait_for_element_attribute_to_be_false(video, "paused")
+ # self.assertEqual(video.get_attribute("ended"), "false")
+
+ # Due to the above waits being disabled, we do a sleep.
+ sleep(15)
+
+ def standalone_check_remote_video(self):
+ self.switch_to_standalone()
+ self.check_remote_video()
+
+ def local_check_remote_video(self):
+ self.switch_to_chatbox()
+ self.check_remote_video()
+
+ def local_leave_room_and_verify_feedback(self):
button = self.marionette.find_element(By.CLASS_NAME, "btn-hangup")
- # XXX bug 1080095 For whatever reason, the click doesn't take effect
- # unless we wait for a bit (even if we wait for the element to
- # actually be displayed first, which we're not currently bothering
- # with). It's not entirely clear whether the click is being
- # delivered in this case, or whether there's a Marionette bug here.
- sleep(5)
button.click()
# check that the feedback form is displayed
@@ -125,22 +157,22 @@ class Test1BrowserCall(MarionetteTestCase):
def test_1_browser_call(self):
self.switch_to_panel()
- call_url = self.get_and_verify_call_url()
+ self.local_start_a_conversation()
+
+ # Check the self video in the conversation window
+ self.local_check_room_self_video()
+
+ room_url = self.local_get_and_verify_room_url()
# load the link clicker interface into the current content browser
- self.load_and_verify_standalone_ui(call_url)
+ self.standalone_load_and_join_room(room_url)
- self.start_and_verify_outgoing_call()
-
- # Switch to the conversation window and answer
- self.accept_and_verify_incoming_call()
-
- # Let's wait for the call/media to get established.
- # TODO: replace this with some media detection
- sleep(5)
+ # Check we get the video streams
+ self.standalone_check_remote_video()
+ self.local_check_remote_video()
# hangup the call
- self.hangup_call_and_verify_feedback()
+ self.local_leave_room_and_verify_feedback()
def tearDown(self):
self.loop_test_servers.shutdown()
diff --git a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js b/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
index 8688a938fe7..ade50f194de 100644
--- a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
+++ b/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
@@ -57,7 +57,7 @@ function onClipboardReady() {
is(tags.length, 0, "tags are gone");
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
let tests = {
diff --git a/browser/components/places/tests/browser/browser_bookmarksProperties.js b/browser/components/places/tests/browser/browser_bookmarksProperties.js
index 26271a28dae..7077fd5ef1d 100644
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -474,8 +474,7 @@ gTests.push({
},
cleanup: function() {
- var bh = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
- bh.removeAllPages();
+ return PlacesTestUtils.clearHistory();
}
});
@@ -498,10 +497,11 @@ function test() {
function runNextTest() {
// Cleanup from previous test.
if (gCurrentTest) {
- gCurrentTest.cleanup();
- info("End of test: " + gCurrentTest.desc);
- gCurrentTest = null;
- waitForAsyncUpdates(runNextTest);
+ Promise.resolve(gCurrentTest.cleanup()).then(() => {
+ info("End of test: " + gCurrentTest.desc);
+ gCurrentTest = null;
+ waitForAsyncUpdates(runNextTest);
+ });
return;
}
diff --git a/browser/components/places/tests/browser/browser_forgetthissite_single.js b/browser/components/places/tests/browser/browser_forgetthissite_single.js
index f52ce7dbb2b..1eb09622273 100644
--- a/browser/components/places/tests/browser/browser_forgetthissite_single.js
+++ b/browser/components/places/tests/browser/browser_forgetthissite_single.js
@@ -20,7 +20,7 @@ function test() {
testForgetThisSiteVisibility(1, function() {
testForgetThisSiteVisibility(2, function() {
// Cleanup
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
});
});
diff --git a/browser/components/places/tests/browser/browser_history_sidebar_search.js b/browser/components/places/tests/browser/browser_history_sidebar_search.js
index 93e5305bbf4..d8cff292c34 100644
--- a/browser/components/places/tests/browser/browser_history_sidebar_search.js
+++ b/browser/components/places/tests/browser/browser_history_sidebar_search.js
@@ -31,7 +31,7 @@ function test() {
waitForExplicitFinish();
// Cleanup.
- waitForClearHistory(continue_test);
+ PlacesTestUtils.clearHistory().then(continue_test);
}
function continue_test() {
@@ -64,7 +64,7 @@ function continue_test() {
// Cleanup.
toggleSidebar("viewHistorySidebar", false);
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
}, true);
}
diff --git a/browser/components/places/tests/browser/browser_library_commands.js b/browser/components/places/tests/browser/browser_library_commands.js
index b7e2a923836..da9be8e9f8c 100644
--- a/browser/components/places/tests/browser/browser_library_commands.js
+++ b/browser/components/places/tests/browser/browser_library_commands.js
@@ -12,7 +12,7 @@ const TEST_URI = NetUtil.newURI("http://www.mozilla.org/");
registerCleanupFunction(function* () {
yield PlacesUtils.bookmarks.eraseEverything();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function* test_date_container() {
diff --git a/browser/components/places/tests/browser/browser_library_downloads.js b/browser/components/places/tests/browser/browser_library_downloads.js
index c761fa15cfe..a39e6923545 100644
--- a/browser/components/places/tests/browser/browser_library_downloads.js
+++ b/browser/components/places/tests/browser/browser_library_downloads.js
@@ -52,7 +52,7 @@ function test() {
}
win.close();
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
})
}
diff --git a/browser/components/places/tests/browser/browser_library_infoBox.js b/browser/components/places/tests/browser/browser_library_infoBox.js
index 9de80211798..e609241c508 100644
--- a/browser/components/places/tests/browser/browser_library_infoBox.js
+++ b/browser/components/places/tests/browser/browser_library_infoBox.js
@@ -108,7 +108,7 @@ gTests.push({
menuNode.containerOpen = false;
- waitForClearHistory(nextTest);
+ PlacesTestUtils.clearHistory().then(nextTest);
}
// add a visit to browser history
addVisits(
diff --git a/browser/components/places/tests/browser/browser_library_panel_leak.js b/browser/components/places/tests/browser/browser_library_panel_leak.js
index 470c45a56a1..afb8b303669 100644
--- a/browser/components/places/tests/browser/browser_library_panel_leak.js
+++ b/browser/components/places/tests/browser/browser_library_panel_leak.js
@@ -39,7 +39,7 @@ function test() {
// Close Library window.
organizer.close();
// Clean up history.
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
waitForExplicitFinish();
diff --git a/browser/components/places/tests/browser/browser_library_search.js b/browser/components/places/tests/browser/browser_library_search.js
index 0cc703f0f68..e39bc75d189 100644
--- a/browser/components/places/tests/browser/browser_library_search.js
+++ b/browser/components/places/tests/browser/browser_library_search.js
@@ -157,7 +157,7 @@ function onLibraryAvailable() {
// Cleanup.
PlacesUtils.tagging.untagURI(PlacesUtils._uri(TEST_URL), ["dummyTag"]);
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/browser/components/places/tests/browser/browser_sidebarpanels_click.js b/browser/components/places/tests/browser/browser_sidebarpanels_click.js
index e66b2c2d41d..5ecfa8aab6d 100644
--- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js
+++ b/browser/components/places/tests/browser/browser_sidebarpanels_click.js
@@ -68,7 +68,7 @@ function test() {
is(tree.selectedNode.itemId, -1, "The selected node is not bookmarked");
},
cleanup: function(aCallback) {
- waitForClearHistory(aCallback);
+ PlacesTestUtils.clearHistory().then(aCallback);
},
sidebarName: HISTORY_SIDEBAR_ID,
treeName: HISTORY_SIDEBAR_TREE_ID,
@@ -154,5 +154,5 @@ function test() {
}
// Ensure history is clean before starting the test.
- waitForClearHistory(runNextTest);
+ PlacesTestUtils.clearHistory().then(runNextTest);
}
diff --git a/browser/components/places/tests/browser/head.js b/browser/components/places/tests/browser/head.js
index 187f5d569de..746369a2f18 100644
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -6,6 +6,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
// We need to cache this before test runs...
let cachedLeftPaneFolderIdGetter;
@@ -73,21 +75,6 @@ function promiseClipboard(aPopulateClipboardFn, aFlavor) {
return deferred.promise;
}
-/**
- * Waits for completion of a clear history operation, before
- * proceeding with aCallback.
- *
- * @param aCallback
- * Function to be called when done.
- */
-function waitForClearHistory(aCallback) {
- Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
-
/**
* Waits for all pending async statements on the default connection, before
* proceeding with aCallback.
@@ -372,37 +359,3 @@ function promiseHistoryNotification(notification, conditionFn) {
}, 2000);
});
}
-
-/**
- * Clears history asynchronously.
- *
- * @return {Promise}
- * @resolves When history has been cleared.
- * @rejects Never.
- */
-function promiseClearHistory() {
- let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- PlacesUtils.bhistory.removeAllPages();
- return promise;
-}
-
-/**
- * Allows waiting for an observer notification once.
- *
- * @param topic
- * Notification topic to observe.
- *
- * @return {Promise}
- * @resolves The array [subject, data] from the observed notification.
- * @rejects Never.
- */
-function promiseTopicObserved(topic)
-{
- let deferred = Promise.defer();
- info("Waiting for observer topic " + topic);
- Services.obs.addObserver(function PTO_observe(subject, topic, data) {
- Services.obs.removeObserver(PTO_observe, topic);
- deferred.resolve([subject, data]);
- }, topic, false);
- return deferred.promise;
-}
diff --git a/browser/components/places/tests/chrome/head.js b/browser/components/places/tests/chrome/head.js
index 878c28c9291..3bcd3601971 100644
--- a/browser/components/places/tests/chrome/head.js
+++ b/browser/components/places/tests/chrome/head.js
@@ -1,3 +1,11 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
+
/**
* Asynchronously adds visits to a page, invoking a callback function when done.
*
@@ -53,17 +61,3 @@ function addVisits(aPlaceInfo, aCallback) {
}
);
}
-
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback) {
- const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
- Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observer, TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, TOPIC_EXPIRATION_FINISHED, false);
- Cc["@mozilla.org/browser/nav-history-service;1"]
- .getService(Ci.nsINavHistoryService)
- .QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
-}
diff --git a/browser/components/places/tests/chrome/test_bug549192.xul b/browser/components/places/tests/chrome/test_bug549192.xul
index d4c443516a7..6592b007458 100644
--- a/browser/components/places/tests/chrome/test_bug549192.xul
+++ b/browser/components/places/tests/chrome/test_bug549192.xul
@@ -45,7 +45,7 @@
function runTest() {
// The mochitest page is added to history.
- waitForClearHistory(continue_test);
+ PlacesTestUtils.clearHistory().then(continue_test);
}
function continue_test() {
@@ -106,7 +106,7 @@
}
// Cleanup.
- waitForClearHistory(SimpleTest.finish);
+ PlacesTestUtils.clearHistory().then(SimpleTest.finish);
});
});
}
diff --git a/browser/components/places/tests/chrome/test_bug549491.xul b/browser/components/places/tests/chrome/test_bug549491.xul
index fdc4992452f..2cc4c8d098c 100644
--- a/browser/components/places/tests/chrome/test_bug549491.xul
+++ b/browser/components/places/tests/chrome/test_bug549491.xul
@@ -48,7 +48,7 @@
function runTest() {
// The mochitest page is added to history.
- waitForClearHistory(continue_test);
+ PlacesTestUtils.clearHistory().then(continue_test);
}
function continue_test() {
@@ -72,26 +72,9 @@
ok(true, "No exceptions thrown");
// Cleanup.
- waitForClearHistory(SimpleTest.finish);
+ PlacesTestUtils.clearHistory().then(SimpleTest.finish);
});
}
- /**
- * 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();
- }
-
]]>
diff --git a/browser/components/places/tests/chrome/test_treeview_date.xul b/browser/components/places/tests/chrome/test_treeview_date.xul
index ba8aa2cc681..5feec8f2eac 100644
--- a/browser/components/places/tests/chrome/test_treeview_date.xul
+++ b/browser/components/places/tests/chrome/test_treeview_date.xul
@@ -54,7 +54,7 @@
function runTest() {
// The mochitest page is added to history.
- waitForClearHistory(continue_test);
+ PlacesTestUtils.clearHistory().then(continue_test);
}
function continue_test() {
@@ -148,7 +148,7 @@
}
// Cleanup.
bs.removeItem(itemId);
- waitForClearHistory(SimpleTest.finish);
+ PlacesTestUtils.clearHistory().then(SimpleTest.finish);
}
// Add a visit 1ms before midnight, a visit at midnight, and
@@ -166,23 +166,6 @@
addVisitsCallback);
}
- /**
- * 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();
- }
-
]]>
diff --git a/browser/components/preferences/tests/browser_chunk_permissions.js b/browser/components/preferences/tests/browser_chunk_permissions.js
index cdc9deff557..e89aecb1e03 100644
--- a/browser/components/preferences/tests/browser_chunk_permissions.js
+++ b/browser/components/preferences/tests/browser_chunk_permissions.js
@@ -1,7 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
-Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
@@ -64,7 +63,7 @@ function cleanUp() {
function runNextTest() {
if (gTestIndex == tests.length) {
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
return;
}
@@ -136,15 +135,3 @@ function getSiteItem(aHost) {
return gBrowser.contentDocument.
querySelector(".site[value='" + aHost + "']");
}
-
-// copied from toolkit/components/places/tests/head_common.js
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
diff --git a/browser/components/preferences/tests/browser_permissions.js b/browser/components/preferences/tests/browser_permissions.js
index 00524b3a4be..bd108ceba3b 100644
--- a/browser/components/preferences/tests/browser_permissions.js
+++ b/browser/components/preferences/tests/browser_permissions.js
@@ -1,7 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
-Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const ABOUT_PERMISSIONS_SPEC = "about:permissions";
@@ -81,7 +80,7 @@ function cleanUp() {
function runNextTest() {
if (gTestIndex == tests.length) {
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
return;
}
@@ -275,7 +274,7 @@ var tests = [
function test_forget_site() {
// click "Forget About This Site" button
gBrowser.contentDocument.getElementById("forget-site-button").doCommand();
- waitForClearHistory(function() {
+ PlacesTestUtils.clearHistory().then(() => {
is(gSiteLabel.value, "", "site label cleared");
let allSitesItem = gBrowser.contentDocument.getElementById("all-sites-item");
@@ -329,15 +328,3 @@ function addWindowListener(aURL, aCallback) {
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
});
}
-
-// copied from toolkit/components/places/tests/head_common.js
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
diff --git a/browser/components/preferences/tests/head.js b/browser/components/preferences/tests/head.js
index b86de7c40dd..b2b1382f056 100644
--- a/browser/components/preferences/tests/head.js
+++ b/browser/components/preferences/tests/head.js
@@ -1,5 +1,8 @@
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
+
/**
* Asynchronously adds visits to a page, invoking a callback function when done.
*
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
index 2d9d736529d..250b2e67160 100644
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
@@ -31,7 +31,7 @@ function test() {
});
- waitForClearHistory(function () {
+ PlacesTestUtils.clearHistory().then(() => {
historyObserver = {
onTitleChanged: function(aURI, aPageTitle) {
switch (++testNumber) {
@@ -89,7 +89,7 @@ function test() {
function afterFirstVisitInPrivateWindow() {
is(PlacesUtils.history.getPageTitle(TEST_URI), TITLE_2, "The title remains the same after visiting in private window");
- waitForClearHistory(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
function whenPageLoad(aWin, aCallback) {
@@ -107,17 +107,5 @@ function test() {
executeSoon(function() { aCallback(aWin) });
});
}
-
- function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
-
- PlacesUtils.bhistory.removeAllPages();
- }
}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
index 61303646241..6511c8db68c 100644
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
@@ -16,11 +16,7 @@ function test() {
// delete all cookies
cm.removeAll();
// delete all history items
- Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
+ PlacesTestUtils.clearHistory().then(aCallback);
}
let testNumber = 0;
diff --git a/browser/components/privatebrowsing/test/browser/head.js b/browser/components/privatebrowsing/test/browser/head.js
index bed9c14b57f..f4cdf04a9f3 100644
--- a/browser/components/privatebrowsing/test/browser/head.js
+++ b/browser/components/privatebrowsing/test/browser/head.js
@@ -1,6 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
+
function whenNewWindowLoaded(aOptions, aCallback) {
let win = OpenBrowserWindow(aOptions);
let gotLoad = false;
diff --git a/browser/components/uitour/test/browser.ini b/browser/components/uitour/test/browser.ini
index 2658e148f35..5fa6ce3fb1b 100644
--- a/browser/components/uitour/test/browser.ini
+++ b/browser/components/uitour/test/browser.ini
@@ -9,8 +9,8 @@ support-files =
skip-if = os == "linux" || e10s # Intermittent failures, bug 951965
[browser_UITour2.js]
skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly
-[browser_UITour3.js]
-skip-if = os == "linux" || e10s # Linux: Bug 986760, Bug 989101; e10s: Bug 941428 - UITour.jsm not e10s friendly
+# [browser_UITour3.js] Bug 1113038
+# skip-if = os == "linux" || e10s # Linux: Bug 986760, Bug 989101; e10s: Bug 941428 - UITour.jsm not e10s friendly
[browser_UITour_availableTargets.js]
skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly
[browser_UITour_detach_tab.js]
diff --git a/ipc/nfc/Nfc.cpp b/ipc/nfc/Nfc.cpp
index 04f6fca4298..62b96d5ab56 100644
--- a/ipc/nfc/Nfc.cpp
+++ b/ipc/nfc/Nfc.cpp
@@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim: set sw=4 ts=8 et ft=cpp: */
+/* vim: set sw=2 ts=8 et ft=cpp: */
/* 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/. */
@@ -22,88 +22,86 @@
#include "jsfriendapi.h"
#include "mozilla/ArrayUtils.h"
+#include "mozilla/ipc/UnixSocketConnector.h"
#include "nsThreadUtils.h" // For NS_IsMainThread.
using namespace mozilla::ipc;
namespace {
-const char* NFC_SOCKET_NAME = "/dev/socket/nfcd";
+static const char NFC_SOCKET_NAME[] = "/dev/socket/nfcd";
// Network port to connect to for adb forwarded sockets when doing
// desktop development.
-const uint32_t NFC_TEST_PORT = 6400;
+static const uint32_t NFC_TEST_PORT = 6400;
-class SendNfcSocketDataTask : public nsRunnable
+class SendNfcSocketDataTask MOZ_FINAL : public nsRunnable
{
public:
- SendNfcSocketDataTask(NfcConsumer* aConsumer, UnixSocketRawData* aRawData)
- : mConsumer(aConsumer), mRawData(aRawData)
- { }
+ SendNfcSocketDataTask(NfcConsumer* aConsumer, UnixSocketRawData* aRawData)
+ : mConsumer(aConsumer)
+ , mRawData(aRawData)
+ { }
- NS_IMETHOD Run()
- {
- MOZ_ASSERT(NS_IsMainThread());
+ NS_IMETHOD Run()
+ {
+ MOZ_ASSERT(NS_IsMainThread());
- if (!mConsumer ||
- mConsumer->GetConnectionStatus() != SOCKET_CONNECTED) {
- // Probably shuting down.
- delete mRawData;
- return NS_OK;
- }
-
- mConsumer->SendSocketData(mRawData);
- return NS_OK;
+ if (!mConsumer ||
+ mConsumer->GetConnectionStatus() != SOCKET_CONNECTED) {
+ // Probably shuting down.
+ return NS_OK;
}
+ mConsumer->SendSocketData(mRawData.forget());
+ return NS_OK;
+ }
+
private:
- NfcConsumer* mConsumer;
- UnixSocketRawData* mRawData;
+ NfcConsumer* mConsumer;
+ nsAutoPtr mRawData;
};
-class NfcConnector : public mozilla::ipc::UnixSocketConnector
+class NfcConnector MOZ_FINAL : public mozilla::ipc::UnixSocketConnector
{
public:
- NfcConnector()
- {}
+ NfcConnector()
+ { }
- virtual ~NfcConnector()
- {}
-
- virtual int Create();
- virtual bool CreateAddr(bool aIsServer,
- socklen_t& aAddrSize,
- sockaddr_any& aAddr,
- const char* aAddress);
- virtual bool SetUp(int aFd);
- virtual bool SetUpListenSocket(int aFd);
- virtual void GetSocketAddr(const sockaddr_any& aAddr,
- nsAString& aAddrStr);
+ int Create() MOZ_OVERRIDE;
+ bool CreateAddr(bool aIsServer,
+ socklen_t& aAddrSize,
+ sockaddr_any& aAddr,
+ const char* aAddress) MOZ_OVERRIDE;
+ bool SetUp(int aFd) MOZ_OVERRIDE;
+ bool SetUpListenSocket(int aFd) MOZ_OVERRIDE;
+ void GetSocketAddr(const sockaddr_any& aAddr,
+ nsAString& aAddrStr) MOZ_OVERRIDE;
};
int
NfcConnector::Create()
{
- MOZ_ASSERT(!NS_IsMainThread());
+ MOZ_ASSERT(!NS_IsMainThread());
- int fd = -1;
+ int fd = -1;
#if defined(MOZ_WIDGET_GONK)
- fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+ fd = socket(AF_LOCAL, SOCK_STREAM, 0);
#else
- // If we can't hit a local loopback, fail later in connect.
- fd = socket(AF_INET, SOCK_STREAM, 0);
+ // If we can't hit a local loopback, fail later in connect.
+ fd = socket(AF_INET, SOCK_STREAM, 0);
#endif
- if (fd < 0) {
- NS_WARNING("Could not open nfc socket!");
- return -1;
- }
+ if (fd < 0) {
+ NS_WARNING("Could not open nfc socket!");
+ return -1;
+ }
- if (!SetUp(fd)) {
- NS_WARNING("Could not set up socket!");
- }
- return fd;
+ if (!SetUp(fd)) {
+ NS_WARNING("Could not set up socket!");
+ }
+ return fd;
}
bool
@@ -112,56 +110,56 @@ NfcConnector::CreateAddr(bool aIsServer,
sockaddr_any& aAddr,
const char* aAddress)
{
- // We never open nfc socket as server.
- MOZ_ASSERT(!aIsServer);
- uint32_t af;
+ // We never open nfc socket as server.
+ MOZ_ASSERT(!aIsServer);
+ uint32_t af;
#if defined(MOZ_WIDGET_GONK)
- af = AF_LOCAL;
+ af = AF_LOCAL;
#else
- af = AF_INET;
+ af = AF_INET;
#endif
- switch (af) {
- case AF_LOCAL:
- aAddr.un.sun_family = af;
- if(strlen(aAddress) > sizeof(aAddr.un.sun_path)) {
- NS_WARNING("Address too long for socket struct!");
- return false;
- }
- strcpy((char*)&aAddr.un.sun_path, aAddress);
- aAddrSize = strlen(aAddress) + offsetof(struct sockaddr_un, sun_path) + 1;
- break;
- case AF_INET:
- aAddr.in.sin_family = af;
- aAddr.in.sin_port = htons(NFC_TEST_PORT);
- aAddr.in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- aAddrSize = sizeof(sockaddr_in);
- break;
- default:
- NS_WARNING("Socket type not handled by connector!");
- return false;
+ switch (af) {
+ case AF_LOCAL:
+ aAddr.un.sun_family = af;
+ if(strlen(aAddress) > sizeof(aAddr.un.sun_path)) {
+ NS_WARNING("Address too long for socket struct!");
+ return false;
}
- return true;
+ strcpy((char*)&aAddr.un.sun_path, aAddress);
+ aAddrSize = strlen(aAddress) + offsetof(struct sockaddr_un, sun_path) + 1;
+ break;
+ case AF_INET:
+ aAddr.in.sin_family = af;
+ aAddr.in.sin_port = htons(NFC_TEST_PORT);
+ aAddr.in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ aAddrSize = sizeof(sockaddr_in);
+ break;
+ default:
+ NS_WARNING("Socket type not handled by connector!");
+ return false;
+ }
+ return true;
}
bool
NfcConnector::SetUp(int aFd)
{
- // Nothing to do here.
- return true;
+ // Nothing to do here.
+ return true;
}
bool
NfcConnector::SetUpListenSocket(int aFd)
{
- // Nothing to do here.
- return true;
+ // Nothing to do here.
+ return true;
}
void
NfcConnector::GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr)
{
- MOZ_CRASH("This should never be called!");
+ MOZ_CRASH("This should never be called!");
}
} // anonymous namespace
@@ -170,66 +168,71 @@ namespace mozilla {
namespace ipc {
NfcConsumer::NfcConsumer(NfcSocketListener* aListener)
- : mListener(aListener)
- , mShutdown(false)
+ : mListener(aListener)
+ , mShutdown(false)
{
- mAddress = NFC_SOCKET_NAME;
+ mAddress = NFC_SOCKET_NAME;
- ConnectSocket(new NfcConnector(), mAddress.get());
+ Connect(new NfcConnector(), mAddress.get());
}
void
NfcConsumer::Shutdown()
{
- MOZ_ASSERT(NS_IsMainThread());
+ MOZ_ASSERT(NS_IsMainThread());
- mShutdown = true;
- CloseSocket();
+ mShutdown = true;
+ Close();
}
bool
NfcConsumer::PostToNfcDaemon(const uint8_t* aData, size_t aSize)
{
- MOZ_ASSERT(!NS_IsMainThread());
+ MOZ_ASSERT(!NS_IsMainThread());
- UnixSocketRawData* raw = new UnixSocketRawData(aData, aSize);
- nsRefPtr task = new SendNfcSocketDataTask(this, raw);
- NS_DispatchToMainThread(task);
- return true;
+ UnixSocketRawData* raw = new UnixSocketRawData(aData, aSize);
+ nsRefPtr task = new SendNfcSocketDataTask(this, raw);
+ NS_DispatchToMainThread(task);
+ return true;
}
void
NfcConsumer::ReceiveSocketData(nsAutoPtr& aData)
{
- MOZ_ASSERT(NS_IsMainThread());
+ MOZ_ASSERT(NS_IsMainThread());
- if (mListener) {
- mListener->ReceiveSocketData(aData);
- }
+ if (mListener) {
+ mListener->ReceiveSocketData(aData);
+ }
}
void
NfcConsumer::OnConnectSuccess()
{
- // Nothing to do here.
- CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
+ // Nothing to do here.
+ CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
}
void
NfcConsumer::OnConnectError()
{
- CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
- CloseSocket();
+ CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
+ Close();
}
void
NfcConsumer::OnDisconnect()
{
- CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
- if (!mShutdown) {
- ConnectSocket(new NfcConnector(), mAddress.get(),
- GetSuggestedConnectDelayMs());
- }
+ CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
+ if (!mShutdown) {
+ Connect(new NfcConnector(), mAddress.get(), GetSuggestedConnectDelayMs());
+ }
+}
+
+ConnectionOrientedSocketIO*
+NfcConsumer::GetIO()
+{
+ return PrepareAccept(new NfcConnector());
}
} // namespace ipc
diff --git a/ipc/nfc/Nfc.h b/ipc/nfc/Nfc.h
index 56cbd9600e2..8f0b9683fb5 100644
--- a/ipc/nfc/Nfc.h
+++ b/ipc/nfc/Nfc.h
@@ -9,7 +9,7 @@
#ifndef mozilla_ipc_Nfc_h
#define mozilla_ipc_Nfc_h 1
-#include
+#include
namespace mozilla {
namespace ipc {
@@ -20,21 +20,23 @@ public:
virtual void ReceiveSocketData(nsAutoPtr& aData) = 0;
};
-class NfcConsumer : public mozilla::ipc::UnixSocketConsumer
+class NfcConsumer MOZ_FINAL : public mozilla::ipc::StreamSocket
{
public:
NfcConsumer(NfcSocketListener* aListener);
- virtual ~NfcConsumer() { }
void Shutdown();
bool PostToNfcDaemon(const uint8_t* aData, size_t aSize);
-private:
- virtual void ReceiveSocketData(nsAutoPtr& aData);
+ ConnectionOrientedSocketIO* GetIO() MOZ_OVERRIDE;
- virtual void OnConnectSuccess();
- virtual void OnConnectError();
- virtual void OnDisconnect();
+private:
+ void ReceiveSocketData(
+ nsAutoPtr& aData) MOZ_OVERRIDE;
+
+ void OnConnectSuccess() MOZ_OVERRIDE;
+ void OnConnectError() MOZ_OVERRIDE;
+ void OnDisconnect() MOZ_OVERRIDE;
private:
NfcSocketListener* mListener;
diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build
index ea958d264b4..df060575e29 100644
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -418,6 +418,7 @@ gbjar.sources += [
'tabs/TabHistoryFragment.java',
'tabs/TabHistoryItemRow.java',
'tabs/TabHistoryPage.java',
+ 'tabs/TabPanelBackButton.java',
'tabs/TabsGridLayout.java',
'tabs/TabsLayoutAdapter.java',
'tabs/TabsLayoutItemView.java',
diff --git a/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_panel_back_button.xml b/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_panel_back_button.xml
index a1176928c98..7570dc4045d 100644
--- a/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_panel_back_button.xml
+++ b/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_panel_back_button.xml
@@ -3,12 +3,15 @@
- 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/. -->
-
+
diff --git a/mobile/android/base/resources/layout/tabs_panel_default.xml b/mobile/android/base/resources/layout/tabs_panel_default.xml
index ff8821ffef3..e3f2212f3e0 100644
--- a/mobile/android/base/resources/layout/tabs_panel_default.xml
+++ b/mobile/android/base/resources/layout/tabs_panel_default.xml
@@ -28,6 +28,7 @@
android:layout_height="match_parent"
android:tabStripEnabled="false"
android:divider="@drawable/tab_indicator_divider"
+ android:dividerPadding="@dimen/new_tablet_tab_panel_divider_vertical_padding"
android:layout="@layout/tabs_panel_indicator"/>
+
+
+
+
+
diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml
index f389fbf074c..1cfff1b83cd 100644
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -22,6 +22,10 @@
21dp
63dp
+
+ 12dp
+
48dp
208dp
-28dp
diff --git a/mobile/android/base/tabs/TabPanelBackButton.java b/mobile/android/base/tabs/TabPanelBackButton.java
new file mode 100644
index 00000000000..7ea02407e9b
--- /dev/null
+++ b/mobile/android/base/tabs/TabPanelBackButton.java
@@ -0,0 +1,55 @@
+/* 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/. */
+
+package org.mozilla.gecko.tabs;
+
+import org.mozilla.gecko.R;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+
+public class TabPanelBackButton extends ImageButton {
+
+ private int dividerWidth = 0;
+
+ private final Drawable divider;
+ private final int dividerPadding;
+
+ public TabPanelBackButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabPanelBackButton);
+ divider = a.getDrawable(R.styleable.TabPanelBackButton_rightDivider);
+ dividerPadding = (int) a.getDimension(R.styleable.TabPanelBackButton_dividerVerticalPadding, 0);
+ a.recycle();
+
+ if (divider != null) {
+ dividerWidth = divider.getIntrinsicWidth();
+ }
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ setMeasuredDimension(getMeasuredWidth() + dividerWidth, getMeasuredHeight());
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ if (divider != null) {
+ final ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) getLayoutParams();
+ final int left = getRight() - lp.rightMargin - dividerWidth;
+
+ divider.setBounds(left, getPaddingTop() + dividerPadding,
+ left + dividerWidth, getHeight() - getPaddingBottom() - dividerPadding);
+ divider.draw(canvas);
+ }
+ }
+}
diff --git a/toolkit/components/jsdownloads/test/unit/common_test_Download.js b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
index bf58cd1ff9d..e8f78af445f 100644
--- a/toolkit/components/jsdownloads/test/unit/common_test_Download.js
+++ b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
@@ -2116,7 +2116,7 @@ add_task(function test_history()
mustInterruptResponses();
// We will wait for the visit to be notified during the download.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
let promiseVisit = promiseWaitForVisit(httpUrl("interruptible.txt"));
// Start a download that is not allowed to finish yet.
@@ -2128,7 +2128,7 @@ add_task(function test_history()
do_check_eq(transitionType, Ci.nsINavHistoryService.TRANSITION_DOWNLOAD);
// Restart and complete the download after clearing history.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
download.cancel();
continueResponses();
yield download.start();
@@ -2144,7 +2144,7 @@ add_task(function test_history()
add_task(function test_history_tryToKeepPartialData()
{
// We will wait for the visit to be notified during the download.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
let promiseVisit =
promiseWaitForVisit(httpUrl("interruptible_resumable.txt"));
diff --git a/toolkit/components/jsdownloads/test/unit/head.js b/toolkit/components/jsdownloads/test/unit/head.js
index d9d0575ecf6..8a643f174c7 100644
--- a/toolkit/components/jsdownloads/test/unit/head.js
+++ b/toolkit/components/jsdownloads/test/unit/head.js
@@ -31,6 +31,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "HttpServer",
"resource://testing-common/httpd.js");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
@@ -169,43 +171,6 @@ function promiseTimeout(aTime)
return deferred.promise;
}
-/**
- * Allows waiting for an observer notification once.
- *
- * @param aTopic
- * Notification topic to observe.
- *
- * @return {Promise}
- * @resolves The array [aSubject, aData] from the observed notification.
- * @rejects Never.
- */
-function promiseTopicObserved(aTopic)
-{
- let deferred = Promise.defer();
-
- Services.obs.addObserver(
- function PTO_observe(aSubject, aTopic, aData) {
- Services.obs.removeObserver(PTO_observe, aTopic);
- deferred.resolve([aSubject, aData]);
- }, aTopic, false);
-
- return deferred.promise;
-}
-
-/**
- * Clears history asynchronously.
- *
- * @return {Promise}
- * @resolves When history has been cleared.
- * @rejects Never.
- */
-function promiseClearHistory()
-{
- let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- do_execute_soon(function() PlacesUtils.bhistory.removeAllPages());
- return promise;
-}
-
/**
* Waits for a new history visit to be notified for the specified URI.
*
diff --git a/toolkit/components/jsdownloads/test/unit/test_DownloadList.js b/toolkit/components/jsdownloads/test/unit/test_DownloadList.js
index 2599af59a95..d33c891a581 100644
--- a/toolkit/components/jsdownloads/test/unit/test_DownloadList.js
+++ b/toolkit/components/jsdownloads/test/unit/test_DownloadList.js
@@ -353,7 +353,7 @@ add_task(function test_history_expiration()
// We must replace the visits added while executing the downloads with visits
// that are older than 7 days, otherwise they will not be expired.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
yield promiseExpirableDownloadVisit();
yield promiseExpirableDownloadVisit(httpUrl("interruptible.txt"));
@@ -396,7 +396,7 @@ add_task(function test_history_clear()
yield downloadOne.start();
yield downloadTwo.start();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
// Wait for the removal notifications that may still be pending.
yield deferred.promise;
diff --git a/toolkit/components/places/tests/PlacesTestUtils.jsm b/toolkit/components/places/tests/PlacesTestUtils.jsm
index 3ee74896168..5cdd43b2457 100644
--- a/toolkit/components/places/tests/PlacesTestUtils.jsm
+++ b/toolkit/components/places/tests/PlacesTestUtils.jsm
@@ -7,6 +7,7 @@ this.EXPORTED_SYMBOLS = [
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
@@ -73,4 +74,22 @@ this.PlacesTestUtils = Object.freeze({
);
});
},
+
+ /**
+ * Clear all history.
+ *
+ * @return {Promise}
+ * @resolves When history was cleared successfully.
+ * @rejects JavaScript exception.
+ */
+ clearHistory() {
+ let expirationFinished = new Promise(resolve => {
+ Services.obs.addObserver(function observe(subj, topic, data) {
+ Services.obs.removeObserver(observe, topic);
+ resolve();
+ }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
+ });
+
+ return Promise.all([expirationFinished, PlacesUtils.history.clear()]);
+ }
});
diff --git a/toolkit/components/places/tests/browser/browser_bug248970.js b/toolkit/components/places/tests/browser/browser_bug248970.js
index 3907bb7d02a..42965b5c023 100644
--- a/toolkit/components/places/tests/browser/browser_bug248970.js
+++ b/toolkit/components/places/tests/browser/browser_bug248970.js
@@ -27,7 +27,7 @@ add_task(function () {
});
});
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
// Ensure we wait for the default bookmarks import.
let bookmarksDeferred = Promise.defer();
diff --git a/toolkit/components/places/tests/browser/browser_bug399606.js b/toolkit/components/places/tests/browser/browser_bug399606.js
index 27d0ba89e09..92e5058353c 100644
--- a/toolkit/components/places/tests/browser/browser_bug399606.js
+++ b/toolkit/components/places/tests/browser/browser_bug399606.js
@@ -47,7 +47,7 @@ function test() {
is(historyObserver.visitCount[aURI], 1,
"onVisit has been received right number of times for " + aURI);
}
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
var loadCount = 0;
diff --git a/toolkit/components/places/tests/browser/browser_bug680727.js b/toolkit/components/places/tests/browser/browser_bug680727.js
index 26f0208d3cf..db32befed82 100644
--- a/toolkit/components/places/tests/browser/browser_bug680727.js
+++ b/toolkit/components/places/tests/browser/browser_bug680727.js
@@ -98,7 +98,7 @@ function reloadListener() {
function reloadAsyncListener(aURI, aIsVisited) {
ok(kUniqueURI.equals(aURI) && aIsVisited, "We have visited the URI.");
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
registerCleanupFunction(function() {
diff --git a/toolkit/components/places/tests/browser/browser_notfound.js b/toolkit/components/places/tests/browser/browser_notfound.js
index 66391dc496e..465cd65a9b1 100644
--- a/toolkit/components/places/tests/browser/browser_notfound.js
+++ b/toolkit/components/places/tests/browser/browser_notfound.js
@@ -26,7 +26,7 @@ function test() {
is(aHidden, 0, "Page should not be hidden");
fieldForUrl(aURI, "typed", function (aTyped) {
is(aTyped, 0, "page should not be marked as typed");
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
});
});
diff --git a/toolkit/components/places/tests/browser/browser_redirect.js b/toolkit/components/places/tests/browser/browser_redirect.js
index b2029cdd4c8..f774f3d662f 100644
--- a/toolkit/components/places/tests/browser/browser_redirect.js
+++ b/toolkit/components/places/tests/browser/browser_redirect.js
@@ -43,7 +43,7 @@ function test() {
fieldForUrl(TARGET_URI, "hidden", function (aHidden) {
is(aHidden, 0, "The target page should not be hidden");
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
});
});
diff --git a/toolkit/components/places/tests/browser/browser_settitle.js b/toolkit/components/places/tests/browser/browser_settitle.js
index 6fe43652e1e..22f3a323929 100644
--- a/toolkit/components/places/tests/browser/browser_settitle.js
+++ b/toolkit/components/places/tests/browser/browser_settitle.js
@@ -8,7 +8,7 @@ gBrowser.selectedTab = gBrowser.addTab();
function finishAndCleanUp()
{
gBrowser.removeCurrentTab();
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
/**
diff --git a/toolkit/components/places/tests/browser/browser_visited_notfound.js b/toolkit/components/places/tests/browser/browser_visited_notfound.js
index 7debe10c4e1..b2b4f25b8e3 100644
--- a/toolkit/components/places/tests/browser/browser_visited_notfound.js
+++ b/toolkit/components/places/tests/browser/browser_visited_notfound.js
@@ -41,7 +41,7 @@ function continueTest(aOldFrecency) {
is(aHidden, 0, "Page should not be hidden");
fieldForUrl(aURI, "typed", function (aTyped) {
is(aTyped, 0, "page should not be marked as typed");
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
});
});
diff --git a/toolkit/components/places/tests/browser/browser_visituri.js b/toolkit/components/places/tests/browser/browser_visituri.js
index 47ad283219b..67fc5a2bbcd 100644
--- a/toolkit/components/places/tests/browser/browser_visituri.js
+++ b/toolkit/components/places/tests/browser/browser_visituri.js
@@ -8,7 +8,7 @@ gBrowser.selectedTab = gBrowser.addTab();
function finishAndCleanUp()
{
gBrowser.removeCurrentTab();
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
}
/**
diff --git a/toolkit/components/places/tests/browser/browser_visituri_nohistory.js b/toolkit/components/places/tests/browser/browser_visituri_nohistory.js
index 51ea76e8e01..89902938b9c 100644
--- a/toolkit/components/places/tests/browser/browser_visituri_nohistory.js
+++ b/toolkit/components/places/tests/browser/browser_visituri_nohistory.js
@@ -50,7 +50,7 @@ function test()
if (uri.spec != FINAL_URL)
return;
gBrowser.removeCurrentTab();
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
Services.prefs.setBoolPref("places.history.enabled", false);
diff --git a/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js b/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
index 5c135e879c4..3f991c32832 100644
--- a/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
+++ b/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
@@ -76,7 +76,7 @@ function test() {
// then test when not on private mode
testOnWindow({}, function(aWin) {
doTest(false, aWin, finalURL, function () {
- promiseClearHistory().then(finish);
+ PlacesTestUtils.clearHistory().then(finish);
});
});
});
diff --git a/toolkit/components/places/tests/browser/head.js b/toolkit/components/places/tests/browser/head.js
index 618734beb76..c39d745434f 100644
--- a/toolkit/components/places/tests/browser/head.js
+++ b/toolkit/components/places/tests/browser/head.js
@@ -11,47 +11,13 @@ const TRANSITION_DOWNLOAD = Ci.nsINavHistoryService.TRANSITION_DOWNLOAD;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
-/**
- * Allows waiting for an observer notification once.
- *
- * @param aTopic
- * Notification topic to observe.
- *
- * @return {Promise}
- * @resolves The array [aSubject, aData] from the observed notification.
- * @rejects Never.
- */
-function promiseTopicObserved(aTopic)
-{
- let deferred = Promise.defer();
-
- Services.obs.addObserver(
- function PTO_observe(aSubject, aTopic, aData) {
- Services.obs.removeObserver(PTO_observe, aTopic);
- deferred.resolve([aSubject, aData]);
- }, aTopic, false);
-
- return deferred.promise;
-}
-
-/**
- * Clears history asynchronously.
- *
- * @return {Promise}
- * @resolves When history has been cleared.
- * @rejects Never.
- */
-function promiseClearHistory() {
- let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- PlacesUtils.bhistory.removeAllPages();
- return promise;
-}
-
/**
* Waits for all pending async statements on the default connection.
*
diff --git a/toolkit/components/places/tests/expiration/test_removeAllPages.js b/toolkit/components/places/tests/expiration/test_clearHistory.js
similarity index 92%
rename from toolkit/components/places/tests/expiration/test_removeAllPages.js
rename to toolkit/components/places/tests/expiration/test_clearHistory.js
index 403b9e1144a..30c8871e065 100644
--- a/toolkit/components/places/tests/expiration/test_removeAllPages.js
+++ b/toolkit/components/places/tests/expiration/test_clearHistory.js
@@ -7,7 +7,7 @@
/**
* What this is aimed to test:
*
- * bh.removeAllPages should expire everything but bookmarked pages and valid
+ * History.clear() should expire everything but bookmarked pages and valid
* annos.
*/
@@ -82,7 +82,7 @@ function run_test() {
run_next_test();
}
-add_task(function test_removeAllPages() {
+add_task(function test_historyClear() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
@@ -125,13 +125,8 @@ add_task(function test_removeAllPages() {
add_old_anno(pageURI, "expire_months", "test", as.EXPIRE_MONTHS, 181);
}
- // Expire all visits for the bookmarks. This does the same thing as the
- // promiseClearHistory helper, but it is made explicit here because
- // removeAllPages is the function we are testing.
- let promise =
- promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
- yield promise;
+ // Expire all visits for the bookmarks
+ yield PlacesUtils.history.clear();
["expire_days", "expire_weeks", "expire_months", "expire_session",
"expire"].forEach(function(aAnno) {
diff --git a/toolkit/components/places/tests/expiration/test_debug_expiration.js b/toolkit/components/places/tests/expiration/test_debug_expiration.js
index a41c34e185d..064836f6dc9 100644
--- a/toolkit/components/places/tests/expiration/test_debug_expiration.js
+++ b/toolkit/components/places/tests/expiration/test_debug_expiration.js
@@ -32,7 +32,7 @@ add_task(function test_expire_orphans()
do_check_false(page_in_database("http://page3.mozilla.org/"));
// Clean up.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_expire_orphans_optionalarg()
@@ -57,7 +57,7 @@ add_task(function test_expire_orphans_optionalarg()
do_check_false(page_in_database("http://page3.mozilla.org/"));
// Clean up.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_expire_limited()
@@ -77,7 +77,7 @@ add_task(function test_expire_limited()
do_check_eq(visits_in_database("http://page2.mozilla.org/"), 1);
// Clean up.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_expire_unlimited()
@@ -97,7 +97,7 @@ add_task(function test_expire_unlimited()
do_check_false(page_in_database("http://page2.mozilla.org/"));
// Clean up.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
function run_test()
diff --git a/toolkit/components/places/tests/expiration/test_notifications.js b/toolkit/components/places/tests/expiration/test_notifications.js
index 693cfa94681..8efeaf6a523 100644
--- a/toolkit/components/places/tests/expiration/test_notifications.js
+++ b/toolkit/components/places/tests/expiration/test_notifications.js
@@ -12,8 +12,6 @@
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
-let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
let gObserver = {
notifications: 0,
@@ -27,7 +25,7 @@ function run_test() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
- hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
+ PlacesTestUtils.clearHistory();
do_timeout(2000, check_result);
do_test_pending();
diff --git a/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js b/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
index 7975ede7336..d621fc47ff6 100644
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
@@ -104,10 +104,10 @@ add_task(function test_notifications_onDeleteURI() {
// Clean up.
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
}
clearMaxPages();
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js b/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
index fbf9e23bed6..dbaf3d0bc5b 100644
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
@@ -126,10 +126,10 @@ add_task(function test_notifications_onDeleteVisits() {
// Clean up.
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
}
clearMaxPages();
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/toolkit/components/places/tests/expiration/test_pref_maxpages.js b/toolkit/components/places/tests/expiration/test_pref_maxpages.js
index d4ee7a37f33..cb07eb714a9 100644
--- a/toolkit/components/places/tests/expiration/test_pref_maxpages.js
+++ b/toolkit/components/places/tests/expiration/test_pref_maxpages.js
@@ -116,9 +116,9 @@ add_task(function test_pref_maxpages() {
currentTest.expectedNotifications);
// Clean up.
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
}
clearMaxPages();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/toolkit/components/places/tests/expiration/xpcshell.ini b/toolkit/components/places/tests/expiration/xpcshell.ini
index a20a86a44d1..adf21a84331 100644
--- a/toolkit/components/places/tests/expiration/xpcshell.ini
+++ b/toolkit/components/places/tests/expiration/xpcshell.ini
@@ -10,6 +10,7 @@ skip-if = os == "android"
[test_annos_expire_never.js]
[test_annos_expire_policy.js]
[test_annos_expire_session.js]
+[test_clearHistory.js]
[test_debug_expiration.js]
[test_idle_daily.js]
[test_notifications.js]
@@ -20,4 +21,3 @@ skip-if = os == "android"
# Crashes when timer is used on non-main thread due to JS implemetation in this test
skip-if = "JS implementation of nsITimer"
[test_pref_maxpages.js]
-[test_removeAllPages.js]
diff --git a/toolkit/components/places/tests/favicons/test_replaceFaviconData.js b/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
index 927e5af0742..24148ca3ce9 100644
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
@@ -83,7 +83,7 @@ add_task(function test_replaceFaviconData_validHistoryURI() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
@@ -115,7 +115,7 @@ add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_replaceExisting() {
@@ -152,7 +152,7 @@ add_task(function test_replaceFaviconData_replaceExisting() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_unrelatedReplace() {
@@ -184,7 +184,7 @@ add_task(function test_replaceFaviconData_unrelatedReplace() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_badInputs() {
@@ -224,7 +224,7 @@ add_task(function test_replaceFaviconData_badInputs() {
favicon.file.remove(false);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_twiceReplace() {
@@ -259,5 +259,5 @@ add_task(function test_replaceFaviconData_twiceReplace() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js b/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
index 6803607b834..5d1d1d39571 100644
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
@@ -85,7 +85,7 @@ add_task(function test_replaceFaviconDataFromDataURL_validHistoryURI() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
@@ -115,7 +115,7 @@ add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
@@ -148,7 +148,7 @@ add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
@@ -178,7 +178,7 @@ add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
@@ -206,7 +206,7 @@ add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
favicon.file.remove(false);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
@@ -237,7 +237,7 @@ add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
@@ -270,7 +270,7 @@ add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
@@ -303,7 +303,7 @@ add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
});
yield deferSetAndFetchFavicon.promise;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
/* toBase64 copied from image/test/unit/test_encoder_png.js */
diff --git a/toolkit/components/places/tests/head_common.js b/toolkit/components/places/tests/head_common.js
index aec4c6866e6..a1b31a8fbb1 100644
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -40,6 +40,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
"resource://gre/modules/BookmarkHTMLUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups",
"resource://gre/modules/PlacesBackups.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTransactions",
"resource://gre/modules/PlacesTransactions.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
@@ -388,20 +390,6 @@ function promiseTopicObserved(aTopic)
return deferred.promise;
}
-/**
- * Clears history asynchronously.
- *
- * @return {Promise}
- * @resolves When history has been cleared.
- * @rejects Never.
- */
-function promiseClearHistory() {
- let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- do_execute_soon(function() PlacesUtils.bhistory.removeAllPages());
- return promise;
-}
-
-
/**
* Simulates a Places shutdown.
*/
diff --git a/toolkit/components/places/tests/history/test_remove.js b/toolkit/components/places/tests/history/test_remove.js
index d8b160bf883..26400a6d289 100644
--- a/toolkit/components/places/tests/history/test_remove.js
+++ b/toolkit/components/places/tests/history/test_remove.js
@@ -130,7 +130,7 @@ add_task(function* test_remove_single() {
}
}
} finally {
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
}
return;
});
@@ -268,7 +268,7 @@ add_task(function* test_remove_many() {
Assert.notEqual(page_in_database(WITNESS_URI), 0, "Witness URI is still here");
do_print("Cleaning up");
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/toolkit/components/places/tests/inline/head_autocomplete.js b/toolkit/components/places/tests/inline/head_autocomplete.js
index 95133bab84d..13895cef924 100644
--- a/toolkit/components/places/tests/inline/head_autocomplete.js
+++ b/toolkit/components/places/tests/inline/head_autocomplete.js
@@ -181,7 +181,7 @@ function add_autocomplete_test(aTestData) {
function waitForCleanup(aCallback) {
remove_all_bookmarks();
- promiseClearHistory().then(aCallback);
+ PlacesTestUtils.clearHistory().then(aCallback);
}
function addBookmark(aBookmarkObj) {
diff --git a/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js b/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
index 7bf732c69c9..bb43c8aa3ee 100644
--- a/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
+++ b/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
@@ -68,7 +68,7 @@ add_task(function pages_query()
}
root.containerOpen = false;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function visits_query()
@@ -95,7 +95,7 @@ add_task(function visits_query()
}
root.containerOpen = false;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function pages_searchterm_query()
@@ -119,7 +119,7 @@ add_task(function pages_searchterm_query()
}
root.containerOpen = false;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function visits_searchterm_query()
@@ -146,7 +146,7 @@ add_task(function visits_searchterm_query()
}
root.containerOpen = false;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function pages_searchterm_is_title_query()
@@ -170,7 +170,7 @@ add_task(function pages_searchterm_is_title_query()
});
root.containerOpen = false;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function visits_searchterm_is_title_query()
@@ -195,5 +195,5 @@ add_task(function visits_searchterm_is_title_query()
});
root.containerOpen = false;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/toolkit/components/places/tests/queries/test_redirects.js b/toolkit/components/places/tests/queries/test_redirects.js
index 898c157c75a..de0d57de853 100644
--- a/toolkit/components/places/tests/queries/test_redirects.js
+++ b/toolkit/components/places/tests/queries/test_redirects.js
@@ -300,5 +300,5 @@ add_task(function test_redirects()
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
diff --git a/toolkit/components/places/tests/queries/test_sorting.js b/toolkit/components/places/tests/queries/test_sorting.js
index 97561bd3a84..651e30a3a95 100644
--- a/toolkit/components/places/tests/queries/test_sorting.js
+++ b/toolkit/components/places/tests/queries/test_sorting.js
@@ -1272,6 +1272,6 @@ add_task(function test_sorting()
test.check_reverse();
// Execute cleanup tasks
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
}
});
diff --git a/toolkit/components/places/tests/queries/test_tags.js b/toolkit/components/places/tests/queries/test_tags.js
index 904bf183b51..7be4f35f9c6 100644
--- a/toolkit/components/places/tests/queries/test_tags.js
+++ b/toolkit/components/places/tests/queries/test_tags.js
@@ -577,7 +577,7 @@ function addBookmark(aURI) {
*/
function task_cleanDatabase(aCallback) {
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
}
/**
diff --git a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
index b77bea93e94..5aed5ee6cb7 100644
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -32,7 +32,7 @@ function* cleanup() {
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
}
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
}
do_register_cleanup(cleanup);
diff --git a/toolkit/components/places/tests/unit/test_317472.js b/toolkit/components/places/tests/unit/test_317472.js
index 7cb0666d7ec..f07dcec99b0 100644
--- a/toolkit/components/places/tests/unit/test_317472.js
+++ b/toolkit/components/places/tests/unit/test_317472.js
@@ -45,7 +45,7 @@ add_task(function test_execute()
// get charset from bookmarked page
do_check_eq((yield PlacesUtils.getCharsetForURI(TEST_BOOKMARKED_URI)), charset);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
// ensure that charset has gone for not-bookmarked page
do_check_neq((yield PlacesUtils.getCharsetForURI(TEST_URI)), charset);
diff --git a/toolkit/components/places/tests/unit/test_412132.js b/toolkit/components/places/tests/unit/test_412132.js
index 5ad0d47d6b8..305fd36ec36 100644
--- a/toolkit/components/places/tests/unit/test_412132.js
+++ b/toolkit/components/places/tests/unit/test_412132.js
@@ -34,7 +34,7 @@ add_task(function changeuri_unvisited_bookmark()
do_check_eq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function changeuri_visited_bookmark()
@@ -64,7 +64,7 @@ add_task(function changeuri_visited_bookmark()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function changeuri_bookmark_still_bookmarked()
@@ -95,7 +95,7 @@ add_task(function changeuri_bookmark_still_bookmarked()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function changeuri_nonexistent_bookmark()
@@ -127,7 +127,7 @@ add_task(function changeuri_nonexistent_bookmark()
tryChange(id);
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
///////////////////////////////////////////////////////////////////////////////
diff --git a/toolkit/components/places/tests/unit/test_adaptive.js b/toolkit/components/places/tests/unit/test_adaptive.js
index b57182fc859..4cd9a014dc1 100644
--- a/toolkit/components/places/tests/unit/test_adaptive.js
+++ b/toolkit/components/places/tests/unit/test_adaptive.js
@@ -373,7 +373,7 @@ add_task(function test_adaptive()
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
}
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
deferEnsureResults = Promise.defer();
yield test();
diff --git a/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js b/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
index 2b11bf563ad..1ff502eceb2 100644
--- a/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
+++ b/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
@@ -89,7 +89,7 @@ function run_next_test() {
}
let test = tests.shift();
- promiseClearHistory().then(function() {
+ PlacesTestUtils.clearHistory().then(function() {
remove_all_bookmarks();
do_execute_soon(test);
});
diff --git a/toolkit/components/places/tests/unit/test_browserhistory.js b/toolkit/components/places/tests/unit/test_browserhistory.js
index 249d590aa48..0e9c6685be0 100644
--- a/toolkit/components/places/tests/unit/test_browserhistory.js
+++ b/toolkit/components/places/tests/unit/test_browserhistory.js
@@ -56,7 +56,7 @@ add_task(function* test_removePages() {
// Cleanup.
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function* test_removePagesByTimeframe() {
@@ -97,8 +97,8 @@ add_task(function* test_removePagesFromHost_keepSubdomains() {
do_check_eq(1, PlacesUtils.history.hasHistoryEntries);
});
-add_task(function* test_removeAllPages() {
- PlacesUtils.bhistory.removeAllPages();
+add_task(function* test_history_clear() {
+ yield PlacesTestUtils.clearHistory();
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
});
diff --git a/toolkit/components/places/tests/unit/test_download_history.js b/toolkit/components/places/tests/unit/test_download_history.js
index 4ae9befd2e2..eab08bb39cf 100644
--- a/toolkit/components/places/tests/unit/test_download_history.js
+++ b/toolkit/components/places/tests/unit/test_download_history.js
@@ -111,7 +111,7 @@ add_test(function test_dh_addMultiRemoveDownload()
do_check_true(aURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.removeAllDownloads();
});
@@ -134,7 +134,7 @@ add_test(function test_dh_addBookmarkRemoveDownload()
do_check_true(aURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.removeAllDownloads();
});
@@ -156,7 +156,7 @@ add_test(function test_dh_addDownload_referrer()
// Verify that the URI is already available in results at this time.
do_check_true(!!page_in_database(DOWNLOAD_URI));
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.addDownload(DOWNLOAD_URI, REFERRER_URI, Date.now() * 1000);
@@ -185,7 +185,7 @@ add_test(function test_dh_addDownload_disabledHistory()
do_check_true(!!page_in_database(DOWNLOAD_URI));
do_check_false(!!page_in_database(PRIVATE_URI));
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
Services.prefs.setBoolPref("places.history.enabled", false);
@@ -221,7 +221,7 @@ add_test(function test_dh_details()
PlacesUtils.annotations.removeObserver(annoObserver);
PlacesUtils.history.removeObserver(historyObserver);
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
}
};
diff --git a/toolkit/components/places/tests/unit/test_frecency.js b/toolkit/components/places/tests/unit/test_frecency.js
index 96ad977fd4a..f67be09b25c 100644
--- a/toolkit/components/places/tests/unit/test_frecency.js
+++ b/toolkit/components/places/tests/unit/test_frecency.js
@@ -287,7 +287,7 @@ add_task(function test_frecency()
prefs.setBoolPref("browser.urlbar.suggest.openpage", false);
for (let [, test] in Iterator(tests)) {
remove_all_bookmarks();
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
deferEnsureResults = Promise.defer();
yield test();
diff --git a/toolkit/components/places/tests/unit/test_frecency_observers.js b/toolkit/components/places/tests/unit/test_frecency_observers.js
index f027e98e57c..118e2795b84 100644
--- a/toolkit/components/places/tests/unit/test_frecency_observers.js
+++ b/toolkit/components/places/tests/unit/test_frecency_observers.js
@@ -44,8 +44,7 @@ add_task(function test_nsNavHistory_invalidateFrecencies_somePages() {
// nsNavHistory::invalidateFrecencies for all pages
add_task(function test_nsNavHistory_invalidateFrecencies_allPages() {
- PlacesUtils.history.removeAllPages();
- yield onManyFrecenciesChanged();
+ yield Promise.all([onManyFrecenciesChanged(), PlacesTestUtils.clearHistory()]);
});
// nsNavHistory::DecayFrecency and nsNavHistory::FixInvalidFrecencies
diff --git a/toolkit/components/places/tests/unit/test_history_removeAllPages.js b/toolkit/components/places/tests/unit/test_history_clear.js
similarity index 98%
rename from toolkit/components/places/tests/unit/test_history_removeAllPages.js
rename to toolkit/components/places/tests/unit/test_history_clear.js
index 29b8b87de05..4ba8b0b902d 100644
--- a/toolkit/components/places/tests/unit/test_history_removeAllPages.js
+++ b/toolkit/components/places/tests/unit/test_history_clear.js
@@ -46,7 +46,7 @@ function run_test() {
run_next_test();
}
-add_task(function test_history_removeAllPages()
+add_task(function* test_history_clear()
{
yield promiseInit;
@@ -95,7 +95,7 @@ add_task(function test_history_removeAllPages()
// Clear history and wait for the onClearHistory notification.
let promiseWaitClearHistory = promiseOnClearHistoryObserved();
- PlacesUtils.bhistory.removeAllPages();
+ PlacesUtils.history.clear();
yield promiseWaitClearHistory;
// check browserHistory returns no entries
diff --git a/toolkit/components/places/tests/unit/test_hosts_triggers.js b/toolkit/components/places/tests/unit/test_hosts_triggers.js
index e4a35aea76e..24c5d3a29e5 100644
--- a/toolkit/components/places/tests/unit/test_hosts_triggers.js
+++ b/toolkit/components/places/tests/unit/test_hosts_triggers.js
@@ -91,7 +91,7 @@ add_task(function test_remove_places()
PlacesUtils.history.removePage(urls[idx].uri);
}
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
for (let idx in urls) {
do_check_false(isHostInMozHosts(urls[idx].uri, urls[idx].typed, urls[idx].prefix));
@@ -112,7 +112,7 @@ add_task(function test_bookmark_changes()
// Change the hostname
PlacesUtils.bookmarks.changeBookmarkURI(itemId, NetUtil.newURI(NEW_URL));
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
let newUri = NetUtil.newURI(NEW_URL);
do_check_true(isHostInMozPlaces(newUri));
@@ -126,7 +126,7 @@ add_task(function test_bookmark_removal()
PlacesUtils.bookmarks.DEFAULT_INDEX);
let newUri = NetUtil.newURI(NEW_URL);
PlacesUtils.bookmarks.removeItem(itemId);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
do_check_false(isHostInMozHosts(newUri, false, null));
});
@@ -145,7 +145,7 @@ add_task(function test_moz_hosts_typed_update()
yield promiseAddVisits(places);
do_check_true(isHostInMozHosts(TEST_URI, true, null));
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_moz_hosts_www_remove()
@@ -175,7 +175,7 @@ add_task(function test_moz_hosts_www_remove()
const TEST_WWW_URI = NetUtil.newURI("http://www.rem.mozilla.com");
yield test_removal(TEST_URI, TEST_WWW_URI);
yield test_removal(TEST_WWW_URI, TEST_URI);
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_moz_hosts_ftp_matchall()
diff --git a/toolkit/components/places/tests/unit/test_isURIVisited.js b/toolkit/components/places/tests/unit/test_isURIVisited.js
index 71e7fb4645f..696b86fc377 100644
--- a/toolkit/components/places/tests/unit/test_isURIVisited.js
+++ b/toolkit/components/places/tests/unit/test_isURIVisited.js
@@ -70,7 +70,7 @@ function step()
let checker = SCHEMES[scheme] ? do_check_true : do_check_false;
checker(aIsVisited);
- promiseClearHistory().then(function () {
+ PlacesTestUtils.clearHistory().then(function () {
history.isURIVisited(uri, function(aURI, aIsVisited) {
do_check_true(uri.equals(aURI));
do_check_false(aIsVisited);
diff --git a/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js b/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
index 9416ee66919..35f1004f4a1 100644
--- a/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
+++ b/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
@@ -129,29 +129,30 @@ add_test(function check_history_query() {
do_check_eq(resultObserver.invalidatedContainer, result.root);
// nsINavHistoryResultObserver.invalidateContainer
- bhist.removeAllPages();
- do_check_eq(root.uri, resultObserver.invalidatedContainer.uri);
+ PlacesTestUtils.clearHistoryEnabled().then(() => {
+ do_check_eq(root.uri, resultObserver.invalidatedContainer.uri);
- // nsINavHistoryResultObserver.batching
- do_check_false(resultObserver.inBatchMode);
- histsvc.runInBatchMode({
- runBatched: function (aUserData) {
- do_check_true(resultObserver.inBatchMode);
- }
- }, null);
- do_check_false(resultObserver.inBatchMode);
- bmsvc.runInBatchMode({
- runBatched: function (aUserData) {
- do_check_true(resultObserver.inBatchMode);
- }
- }, null);
- do_check_false(resultObserver.inBatchMode);
+ // nsINavHistoryResultObserver.batching
+ do_check_false(resultObserver.inBatchMode);
+ histsvc.runInBatchMode({
+ runBatched: function (aUserData) {
+ do_check_true(resultObserver.inBatchMode);
+ }
+ }, null);
+ do_check_false(resultObserver.inBatchMode);
+ bmsvc.runInBatchMode({
+ runBatched: function (aUserData) {
+ do_check_true(resultObserver.inBatchMode);
+ }
+ }, null);
+ do_check_false(resultObserver.inBatchMode);
- root.containerOpen = false;
- do_check_eq(resultObserver.closedContainer, resultObserver.openedContainer);
- result.removeObserver(resultObserver);
- resultObserver.reset();
- promiseAsyncUpdates().then(run_next_test);
+ root.containerOpen = false;
+ do_check_eq(resultObserver.closedContainer, resultObserver.openedContainer);
+ result.removeObserver(resultObserver);
+ resultObserver.reset();
+ promiseAsyncUpdates().then(run_next_test);
+ });
});
});
});
diff --git a/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js b/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
index 3e144f3c821..db431f3b76c 100644
--- a/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
+++ b/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
@@ -106,7 +106,7 @@ add_task(function test_addVisitAndCheckGuid() {
do_check_eq(root.getChild(0).bookmarkGuid, "");
root.containerOpen = false;
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
});
add_task(function test_addItemsWithInvalidGUIDsFails() {
diff --git a/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js b/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
index ae02d4ab8dc..15e84a542f0 100644
--- a/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
+++ b/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
@@ -9,7 +9,7 @@ const TEST_URI = uri("http://example.com/");
const PLACE_URI = uri("place:queryType=0&sort=8&maxResults=10");
function* cleanup() {
- yield promiseClearHistory();
+ yield PlacesTestUtils.clearHistory();
remove_all_bookmarks();
// This is needed to remove place: entries.
DBConn().executeSimpleSQL("DELETE FROM moz_places");
diff --git a/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js b/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js
index 4f1c22c6c98..5d0835e62a2 100644
--- a/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js
+++ b/toolkit/components/places/tests/unit/test_update_frecency_after_delete.js
@@ -34,7 +34,7 @@ add_test(function removed_bookmark()
do_check_eq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@@ -62,7 +62,7 @@ add_test(function removed_but_visited_bookmark()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@@ -94,7 +94,7 @@ add_test(function remove_bookmark_still_bookmarked()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@@ -122,7 +122,7 @@ add_test(function cleared_parent_of_visited_bookmark()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@@ -156,7 +156,7 @@ add_test(function cleared_parent_of_bookmark_still_bookmarked()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
- promiseClearHistory().then(run_next_test);
+ PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
diff --git a/toolkit/components/places/tests/unit/xpcshell.ini b/toolkit/components/places/tests/unit/xpcshell.ini
index d14ded8dc54..d815f91b5ef 100644
--- a/toolkit/components/places/tests/unit/xpcshell.ini
+++ b/toolkit/components/places/tests/unit/xpcshell.ini
@@ -95,9 +95,9 @@ skip-if = os == "android"
[test_history.js]
[test_history_autocomplete_tags.js]
[test_history_catobs.js]
+[test_history_clear.js]
[test_history_notifications.js]
[test_history_observer.js]
-[test_history_removeAllPages.js]
# Bug 676989: test hangs consistently on Android
skip-if = os == "android"
[test_history_sidebar.js]
diff --git a/toolkit/components/social/test/xpcshell/head.js b/toolkit/components/social/test/xpcshell/head.js
index f0328db4860..c9da73b06f0 100644
--- a/toolkit/components/social/test/xpcshell/head.js
+++ b/toolkit/components/social/test/xpcshell/head.js
@@ -205,22 +205,3 @@ function promiseAddVisits(aPlaceInfo)
return deferred.promise;
}
-
-function promiseTopicObserved(aTopic)
-{
- let deferred = Promise.defer();
-
- Services.obs.addObserver(
- function PTO_observe(aSubject, aTopic, aData) {
- Services.obs.removeObserver(PTO_observe, aTopic);
- deferred.resolve([aSubject, aData]);
- }, aTopic, false);
-
- return deferred.promise;
-}
-
-function promiseClearHistory() {
- let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- do_execute_soon(function() PlacesUtils.bhistory.removeAllPages());
- return promise;
-}
diff --git a/toolkit/components/social/test/xpcshell/test_SocialService.js b/toolkit/components/social/test/xpcshell/test_SocialService.js
index 410d6262662..f239de79f64 100644
--- a/toolkit/components/social/test/xpcshell/test_SocialService.js
+++ b/toolkit/components/social/test/xpcshell/test_SocialService.js
@@ -3,7 +3,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PlacesUtils.jsm");
+
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
function run_test() {
initApp();
@@ -161,6 +163,6 @@ function testOrderedProviders(manifests, next) {
do_check_eq(orderedProviders[0], providers[1]);
do_check_eq(orderedProviders[1], providers[0]);
do_check_true(orderedProviders[0].frecency > orderedProviders[1].frecency);
- promiseClearHistory().then(next);
+ PlacesTestUtils.clearHistory().then(next);
yield;
}
diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json
index 99471ed8081..7aed4824e65 100644
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -6979,7 +6979,7 @@
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 4,
- "description": "Tracking protection shield (0 = not shown, 1 = blocked, 2 = loaded, 3 = due to mixed content"
+ "description": "Tracking protection shield (0 = not shown, 1 = loaded, 2 = blocked, 3 = due to mixed content"
},
"TRACKING_PROTECTION_EVENTS": {
"expires_in_version": "never",
diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
index 3577730c335..962260ba134 100644
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -19,6 +19,8 @@ Cu.import("resource://gre/modules/ForgetAboutSite.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
+ "resource://testing-common/PlacesTestUtils.jsm");
const COOKIE_EXPIRY = Math.round(Date.now() / 1000) + 60;
const COOKIE_NAME = "testcookie";
@@ -414,7 +416,7 @@ function test_history_not_cleared_with_uri_contains_domain()
do_check_true(yield promiseIsURIVisited(TEST_URI));
// Clear history since we left something there from this test.
- PlacesUtils.bhistory.removeAllPages();
+ yield PlacesTestUtils.clearHistory();
}
// Cookie Service
diff --git a/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul b/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul
index 45eab5a88a3..e9eee32e94b 100644
--- a/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul
@@ -39,6 +39,7 @@ let os = Cc["@mozilla.org/observer-service;1"]
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
+Components.utils.import("resource://testing-common/PlacesTestUtils.jsm");
let checkDestination = false,
checkFileName = false;
@@ -185,7 +186,7 @@ function endTest() {
Services.prefs.clearUserPref("browser.download.useToolkitUI");
- waitForClearHistory(SimpleTest.finish);
+ PlacesTestUtils.clearHistory().then(SimpleTest.finish);
}
]]>
diff --git a/toolkit/mozapps/downloads/tests/chrome/utils.js b/toolkit/mozapps/downloads/tests/chrome/utils.js
index 245073c48fd..5732f595f8f 100644
--- a/toolkit/mozapps/downloads/tests/chrome/utils.js
+++ b/toolkit/mozapps/downloads/tests/chrome/utils.js
@@ -146,15 +146,3 @@ function setCleanState()
let win = getDMWindow();
if (win) win.close();
}
-
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback) {
- Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
- Services.obs.addObserver(function observeClearHistory(aSubject, aTopic) {
- Services.obs.removeObserver(observeClearHistory, aTopic);
- aCallback();
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}